Test code only. The suite had only ever run on macOS; the first Linux trial
found clippy red on three unused imports and 11 failing tests.
- Unused imports (lucisv_server hover.rs, includes.rs test modules): they now
carry the same cfg as the macOS/Windows-only tests that use them.
- Eight permission-denied tests (lucisv cli, lucisv_core walk, lucisv_mcp
apply/cache/qa_m6, lucisv_server filelist): each first probes that the
mode it relies on is enforced and says 'skipped' if not (root ignores
modes); std only, no uid check.
- file_ops' case-mismatched include test probes the filesystem's case
sensitivity first.
- large.rs' two linear-time tests bound growth (8x input <= 24x time, best
of five) instead of wall-clock; shown to fail at ~60-74x on a quadratic
implementation by dev and QA independently.
- scan_trace's stage-sum lower bound is asserted on the best of three
sessions (reproduced flaky on macOS under load: 2.21 ms of 5.10 ms).
- walk.rs' TempTree test helper gains the Drop its doc promised.
- tools/linux_check.sh runs the working tree in the luhpe-linux-x64 runner's
job image, as root or --user, without a push.
Linux: root green and --user green but for the scan_trace flake were seen
once, on 88546c8 plus round 1 of this lane. Nothing since has run there (the
owner's ssh key expired), so TODO §70's Linux line and the ci.yml linux job
stay open. Dev, QA (mutation table) and lead review:
docs/features/linux-test-portability/README.md.
TODO.md also gains §71, the owner's eight-feature queue, with its waves.
Gates: tools/gates.sh PASS on this tree (0.65.4 + this), lucisv_server 1977/0.
Co-Authored-By: Claude Mythos 5.2 <[email protected]>
115 lines
4.5 KiB
Bash
Executable File
115 lines
4.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Run a command against this working tree on Linux, inside the same job image
|
|
# the luhpe-linux-x64 Actions runner uses, without pushing anything.
|
|
#
|
|
# The tree is streamed over ssh into a throwaway container started by the
|
|
# runner's own Docker daemon on luhpe, so it runs under the runner's cpu and
|
|
# memory limits. What is sent: every tracked file as it is on disk, plus every
|
|
# UNTRACKED file git does not ignore (a stray .env or key file included -
|
|
# check `git status` first). A tracked file deleted from the working tree, or
|
|
# any other local tar error, fails the run before anything is judged; a
|
|
# partial tree is never shipped. The Rust toolchain and the cargo target
|
|
# directory are kept in a Docker volume between runs, so only the first run
|
|
# is a cold build.
|
|
#
|
|
# One run at a time: the runs share that volume (toolchain install, target
|
|
# dirs, a --user run's chown), so the container has a fixed name and a second
|
|
# run while one is in flight is refused by Docker ("name ... already in use").
|
|
# A run whose ssh dropped keeps its container until its command ends.
|
|
#
|
|
# Usage: tools/linux_check.sh [--user] [--dry-run] [--] <command...>
|
|
# tools/linux_check.sh 'cargo clippy --all-targets -- -D warnings'
|
|
# tools/linux_check.sh --user cargo test -p lucisv_core
|
|
# tools/linux_check.sh grep -rn "two words" crates
|
|
#
|
|
# One argument is a shell command line, run as written (pipes, ;, quotes).
|
|
# Several arguments are one command and its arguments, each kept whole.
|
|
# By default the command runs as root, which is how the runner's jobs run and
|
|
# so what CI will see. --user runs it as an unprivileged user instead: file
|
|
# permissions are enforced there, which root ignores. --dry-run builds the
|
|
# archive locally (to check the local half), prints its size and the remote
|
|
# command, and contacts nothing.
|
|
#
|
|
# Needs: ssh access to the host `luhpe` (LUCISV_LINUX_HOST overrides) and the
|
|
# gitea-runner container on it (docs: tools/RELEASING.md, "CI releases").
|
|
# Exit status is the command's, or non-zero if the archive or the
|
|
# connection failed.
|
|
|
|
set -eu -o pipefail
|
|
|
|
host=${LUCISV_LINUX_HOST:-luhpe}
|
|
image=docker.gitea.com/runner-images:ubuntu-latest
|
|
name=lucisv-linux-check
|
|
as_user=0
|
|
dry_run=0
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case $1 in
|
|
--user) as_user=1; shift ;;
|
|
--dry-run) dry_run=1; shift ;;
|
|
--) shift; break ;;
|
|
-h|--help) sed -n '2,37p' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
|
|
*) break ;;
|
|
esac
|
|
done
|
|
[ $# -ge 1 ] || { echo "usage: $0 [--user] [--dry-run] [--] <command...>" >&2; exit 2; }
|
|
if [ $# -eq 1 ]; then
|
|
cmd=$1
|
|
else
|
|
cmd=$(printf '%q ' "$@")
|
|
fi
|
|
|
|
repo_root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
cd "$repo_root"
|
|
|
|
# Inside the container: unpack stdin to /w, make sure the toolchain is in the
|
|
# cache volume, then run the command as root or as uid 1001.
|
|
inner='
|
|
set -eu
|
|
export RUSTUP_HOME=/cache/rustup CARGO_HOME=/cache/cargo
|
|
mkdir -p /w && tar xzf - -C /w
|
|
if [ ! -x "$CARGO_HOME/bin/cargo" ]; then
|
|
curl --proto =https --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --profile minimal -c clippy,rustfmt --no-modify-path >/dev/null 2>&1
|
|
fi
|
|
export PATH="$CARGO_HOME/bin:$PATH"
|
|
if [ "$AS_USER" = 1 ]; then
|
|
export CARGO_TARGET_DIR=/cache/target-user HOME=/tmp/home
|
|
mkdir -p "$CARGO_TARGET_DIR" "$HOME"
|
|
chown -R 1001:1001 /w /cache "$HOME"
|
|
cd /w && exec setpriv --reuid 1001 --regid 1001 --clear-groups bash -c "$CMD"
|
|
fi
|
|
export CARGO_TARGET_DIR=/cache/target-root
|
|
# An earlier --user run leaves the cache owned by uid 1001; root does not mind.
|
|
cd /w && exec bash -c "$CMD"
|
|
'
|
|
|
|
remote="docker exec -i gitea-runner docker run --rm -i --name $name \
|
|
-v lucisv-linux-check:/cache \
|
|
-e AS_USER=$as_user -e CMD=$(printf '%q' "$cmd") \
|
|
$image bash -c $(printf '%q' "$inner")"
|
|
|
|
# The tree as a gzipped tar on stdout. COPYFILE_DISABLE and --no-xattrs keep
|
|
# macOS tar from adding ._* entries and extended-attribute headers that GNU
|
|
# tar on the other side warns about. Errors are not hidden: with pipefail a
|
|
# file tar cannot read fails the whole run.
|
|
archive() {
|
|
git ls-files -z --cached --others --exclude-standard \
|
|
| COPYFILE_DISABLE=1 tar czf - --no-xattrs --null -T -
|
|
}
|
|
|
|
if [ "$dry_run" = 1 ]; then
|
|
bytes=$(archive | wc -c)
|
|
echo "archive: $((bytes)) bytes; would run on $host:"
|
|
echo "$remote"
|
|
exit 0
|
|
fi
|
|
|
|
status=0
|
|
archive | ssh -o BatchMode=yes "$host" "$remote" || status=$?
|
|
if [ "$status" = 125 ]; then
|
|
echo "linux_check: docker refused to start the container; if it says the name" \
|
|
"\"$name\" is in use, another run is in flight - wait for it." >&2
|
|
fi
|
|
exit "$status"
|