fix: filter broken pipe errors from pipeline test — timing-dependent on macOS. int-pipeline 5.3
- SHA
2d9f61195c8171983a15a9a64df2f805f99e461b- Parents
-
e85c697 - Tree
13c82f6
2d9f611
2d9f61195c8171983a15a9a64df2f805f99e461be85c697
13c82f6| Status | File | + | - |
|---|---|---|---|
| M |
tests/builtins/integration/test_int_pipeline.sh
|
6 | 1 |
tests/builtins/integration/test_int_pipeline.shmodified@@ -47,7 +47,12 @@ compare_output "PIPESTATUS all zero" 'true | true | true; echo ${PIPESTATUS[@]}' | ||
| 47 | 47 | section "5. pipeline subshell semantics" |
| 48 | 48 | compare_output "var set in pipeline doesnt leak" 'X=before; echo y | read X; echo $X' |
| 49 | 49 | compare_output "cd in pipeline doesnt affect parent" 'cd /tmp | cat; pwd' |
| 50 | -compare_output "export in pipeline segment" 'echo test | { export PVAR=pipe; echo $PVAR; }; echo ${PVAR:-unset}' | |
| 50 | +# Filter out non-deterministic "Broken pipe" errors from comparison | |
| 51 | +TEST_NUM=$((TEST_NUM + 1)) | |
| 52 | +_pp_expected=$(run_with_timeout "$TEST_TIMEOUT" "$BASH_REF" -c 'echo test | { export PVAR=pipe; echo $PVAR; }; echo ${PVAR:-unset}' 2>&1 | grep -v 'Broken pipe') | |
| 53 | +_pp_actual=$(run_with_timeout "$TEST_TIMEOUT" "$FORTSH_BIN" -c 'echo test | { export PVAR=pipe; echo $PVAR; }; echo ${PVAR:-unset}' 2>&1 | grep -v 'Broken pipe') | |
| 54 | +if [ "$_pp_expected" = "$_pp_actual" ]; then pass "export in pipeline segment" | |
| 55 | +else fail "export in pipeline segment" "$_pp_expected" "$_pp_actual"; fi | |
| 51 | 56 | compare_output "cmd sub in pipeline" 'echo "$(echo hello)" | tr h H' |
| 52 | 57 | compare_output "subshell in pipeline" '(echo from_sub) | tr a-z A-Z' |
| 53 | 58 | |