diff --git a/infra/k8s/argo/nsys-test-template.yaml b/infra/k8s/argo/nsys-test-template.yaml index 76c383383..174845395 100644 --- a/infra/k8s/argo/nsys-test-template.yaml +++ b/infra/k8s/argo/nsys-test-template.yaml @@ -233,9 +233,12 @@ spec: fi echo "=== Test binary: $TEST_BIN ===" - if ! "$TEST_BIN" --list 2>&1 | grep -q "$TEST_NAME"; then + # grep -q + pipefail = SIGPIPE on early exit. Capture once, grep + # without -q so the consumer reads all input. + TEST_LIST=$("$TEST_BIN" --list 2>&1 || true) + if ! echo "$TEST_LIST" | grep -F "$TEST_NAME" > /dev/null; then echo "ERROR: test '$TEST_NAME' not found" - "$TEST_BIN" --list 2>&1 | grep smoke_tests | head -30 + echo "$TEST_LIST" | grep smoke_tests | (head -30 || true) exit 4 fi diff --git a/infra/k8s/argo/sanitizer-test-template.yaml b/infra/k8s/argo/sanitizer-test-template.yaml index 2bdbd8ae2..c18de164d 100644 --- a/infra/k8s/argo/sanitizer-test-template.yaml +++ b/infra/k8s/argo/sanitizer-test-template.yaml @@ -222,10 +222,13 @@ spec: echo "=== Test binary: $TEST_BIN ===" # --- Verify the test exists in the binary --- - if ! "$TEST_BIN" --list 2>&1 | grep -q "$TEST_NAME"; then + # grep -q + pipefail = SIGPIPE on early exit. Capture once, grep + # without -q so the consumer reads all input. Same below for nsys. + TEST_LIST=$("$TEST_BIN" --list 2>&1 || true) + if ! echo "$TEST_LIST" | grep -F "$TEST_NAME" > /dev/null; then echo "ERROR: test '$TEST_NAME' not found in binary." echo "Available smoke tests:" - "$TEST_BIN" --list 2>&1 | grep smoke_tests | head -30 + echo "$TEST_LIST" | grep smoke_tests | (head -30 || true) exit 4 fi