| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
set -u |
| 38 |
set -o pipefail |
| 39 |
|
| 40 |
HOST="${ASTRA_HOST:-astra}" |
| 41 |
DEST="${ASTRA_DIR:-mnw-test}" |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
THREADS="${ASTRA_THREADS:-16}" |
| 49 |
|
| 50 |
ROOT="$(cd "$(dirname "$0")/../.." && pwd)" |
| 51 |
CODE="$(cd "$ROOT/.." && pwd)" |
| 52 |
CARGO_CONFIG="$CODE/.cargo/config.toml" |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
REPOS=(MNW quasi synckit Libraries/docengine) |
| 58 |
|
| 59 |
say() { printf '%s\n' "$*" >&2; } |
| 60 |
die() { say "test-on-astra: $*"; exit 1; } |
| 61 |
|
| 62 |
[ -f "$CARGO_CONFIG" ] || die "no $CARGO_CONFIG; nothing says where the siblings are" |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
missing="" |
| 68 |
while read -r patched; do |
| 69 |
covered="" |
| 70 |
for repo in "${REPOS[@]}"; do |
| 71 |
case "$patched" in "$repo"/*|"$repo") covered=1; break;; esac |
| 72 |
done |
| 73 |
[ -n "$covered" ] || missing="$missing $patched" |
| 74 |
done < <(grep -oP '(?<=path = ")[^"]+' "$CARGO_CONFIG" | sort -u) |
| 75 |
[ -z "$missing" ] || die "these patched paths are not in REPOS:$missing" |
| 76 |
|
| 77 |
say "test-on-astra: syncing to $HOST:~/$DEST" |
| 78 |
for repo in "${REPOS[@]}"; do |
| 79 |
[ -d "$CODE/$repo" ] || die "$CODE/$repo does not exist" |
| 80 |
ssh "$HOST" "mkdir -p ~/$DEST/$(dirname "$repo")" || die "cannot reach $HOST" |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
rsync -a --delete \ |
| 88 |
--exclude 'target/' --exclude '.git/' --exclude 'node_modules/' \ |
| 89 |
--exclude 'mutants.out/' \ |
| 90 |
"$CODE/$repo/" "$HOST:$DEST/$repo/" \ |
| 91 |
|| die "rsync of $repo failed" |
| 92 |
done |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
awk ' |
| 99 |
/^\[/ { keep = ($0 !~ /^\[build\]/ && $0 !~ /^\[profile/) } |
| 100 |
keep { print } |
| 101 |
' "$CARGO_CONFIG" | ssh "$HOST" "mkdir -p ~/$DEST/.cargo && cat > ~/$DEST/.cargo/config.toml" \ |
| 102 |
|| die "could not write the remote cargo config" |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
ARGS=("$@") |
| 110 |
[ ${#ARGS[@]} -gt 0 ] || ARGS=(--test integration) |
| 111 |
|
| 112 |
say "test-on-astra: building and running ($THREADS threads, aarch64)" |
| 113 |
ssh "$HOST" bash -s -- "$DEST" "$THREADS" "${ARGS[@]}" <<'REMOTE' |
| 114 |
set -u |
| 115 |
DEST="$1"; shift |
| 116 |
THREADS="$1"; shift |
| 117 |
|
| 118 |
cd "$HOME/$DEST/MNW/server" || exit 1 |
| 119 |
# rustup's toolchain, not the distro's: /usr/bin/rustc is older than the |
| 120 |
# dependency tree's floor and fails with a resolver error that names a crate |
| 121 |
# rather than the compiler. |
| 122 |
export PATH="$HOME/.cargo/bin:$PATH" |
| 123 |
# The default 1024 is exhausted by the per-test database pool. |
| 124 |
ulimit -n 65536 |
| 125 |
# Socket form, no host: astra's postgres has no TCP listener, and the harness's |
| 126 |
# `replace_db_name` splits on the last `/`, so a `?host=` query string is |
| 127 |
# mangled rather than honoured. |
| 128 |
export TEST_DATABASE_URL=postgres:///postgres |
| 129 |
# Verify against the committed `.sqlx` metadata rather than a live database. |
| 130 |
# astra's `makenotwork` has drifted from the schema in the tree, and pointing |
| 131 |
# the compile-time macros at it fails the build with errors that read like code |
| 132 |
# faults. Drift in the metadata is itself a finding. |
| 133 |
export SQLX_OFFLINE=true |
| 134 |
|
| 135 |
started=$(date +%s) |
| 136 |
cargo test --features fast-tests "$@" -- --test-threads="$THREADS" |
| 137 |
status=$? |
| 138 |
echo "test-on-astra: $(( $(date +%s) - started ))s wall on astra, aarch64" >&2 |
| 139 |
exit $status |
| 140 |
REMOTE |
| 141 |
|