diff --git a/infra/k8s/argo/nsys-test-template.yaml b/infra/k8s/argo/nsys-test-template.yaml index 4862bc78f..b5be4bc9b 100644 --- a/infra/k8s/argo/nsys-test-template.yaml +++ b/infra/k8s/argo/nsys-test-template.yaml @@ -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 ===" diff --git a/infra/k8s/argo/sanitizer-test-template.yaml b/infra/k8s/argo/sanitizer-test-template.yaml index 252b730b3..7bbf6dfcc 100644 --- a/infra/k8s/argo/sanitizer-test-template.yaml +++ b/infra/k8s/argo/sanitizer-test-template.yaml @@ -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 ==="