fix(argo): replace grep -q | TEST_BIN--list pipe with capture-then-grep to avoid SIGPIPE
`grep -q` exits early on first match, closing stdin to upstream `$TEST_BIN --list`. With pipefail enabled, that SIGPIPE on the upstream process bubbles up as exit 141 and kills the workflow before the sanitizer/nsys can launch. Capture --list output once into a variable, then grep the captured string (which doesn't pipe to a process). Same pattern for the already-broken-but-defensive head -30 in the error branch.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user