fix(argo): TEST_BIN path must honour CARGO_TARGET_DIR not repo-relative target/

The workflow sets CARGO_TARGET_DIR=/cargo-target so cargo writes binaries
to /cargo-target/release/deps/ml-*, not target/release/deps/ml-*. Both
templates were globbing the wrong path and failed with exit 3 (now
caught by the explicit error message).

Compile finished cleanly in 4m14s (sccache cache hit on first run after
re-checkout); test binary lookup then failed and the script exited at
the 'could not locate compiled test binary' check.
This commit is contained in:
jgrusewski
2026-04-28 22:26:02 +02:00
parent 09e10db99b
commit 8e6b9684fb
2 changed files with 12 additions and 6 deletions

View File

@@ -213,12 +213,15 @@ spec:
cargo test -p ml --release --lib --no-run 2>&1 | tee /cargo-target/nsys-compile.log
cargo build -p ml --release --example train_baseline_rl 2>&1 | tee -a /cargo-target/nsys-compile.log
TEST_BIN=$(ls -t target/release/deps/ml-* 2>/dev/null \
# Honour CARGO_TARGET_DIR — outputs go to ${CARGO_TARGET_DIR}/release/deps,
# NOT the repo-relative target/. (CI workflow sets CARGO_TARGET_DIR=/cargo-target.)
TARGET_DIR="${CARGO_TARGET_DIR:-target}"
TEST_BIN=$(ls -t "$TARGET_DIR/release/deps/ml-"* 2>/dev/null \
| grep -vE '\.(d|rcgu|rmeta|rlib|so|json)$' \
| head -1)
if [ -z "$TEST_BIN" ] || [ ! -x "$TEST_BIN" ]; then
echo "ERROR: could not locate compiled test binary"
ls -la target/release/deps/ | head -20
echo "ERROR: could not locate compiled test binary in $TARGET_DIR/release/deps/"
ls -la "$TARGET_DIR/release/deps/" 2>&1 | head -20
exit 3
fi
echo "=== Test binary: $TEST_BIN ==="

View File

@@ -201,12 +201,15 @@ spec:
cargo build -p ml --release --example train_baseline_rl 2>&1 | tee -a /cargo-target/sanitizer-compile.log
# Locate the freshest ml-* test binary
TEST_BIN=$(ls -t target/release/deps/ml-* 2>/dev/null \
# Honour CARGO_TARGET_DIR — outputs go to ${CARGO_TARGET_DIR}/release/deps,
# NOT the repo-relative target/. (CI workflow sets CARGO_TARGET_DIR=/cargo-target.)
TARGET_DIR="${CARGO_TARGET_DIR:-target}"
TEST_BIN=$(ls -t "$TARGET_DIR/release/deps/ml-"* 2>/dev/null \
| grep -vE '\.(d|rcgu|rmeta|rlib|so|json)$' \
| head -1)
if [ -z "$TEST_BIN" ] || [ ! -x "$TEST_BIN" ]; then
echo "ERROR: could not locate compiled test binary in target/release/deps/"
ls -la target/release/deps/ | head -20
echo "ERROR: could not locate compiled test binary in $TARGET_DIR/release/deps/"
ls -la "$TARGET_DIR/release/deps/" 2>&1 | head -20
exit 3
fi
echo "=== Test binary: $TEST_BIN ==="