fortrangoingonforty/fortsh / 2d9f611

Browse files

fix: filter broken pipe errors from pipeline test — timing-dependent on macOS. int-pipeline 5.3

Authored by espadonne
SHA
2d9f61195c8171983a15a9a64df2f805f99e461b
Parents
e85c697
Tree
13c82f6

1 changed file

StatusFile+-
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[@]}'
4747
 section "5. pipeline subshell semantics"
4848
 compare_output "var set in pipeline doesnt leak" 'X=before; echo y | read X; echo $X'
4949
 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
5156
 compare_output "cmd sub in pipeline" 'echo "$(echo hello)" | tr h H'
5257
 compare_output "subshell in pipeline" '(echo from_sub) | tr a-z A-Z'
5358