Skip to content

Commit 800016b

Browse files
committed
Fixes #115
We observed broken pipe output messages with bash_unit test in some environments: github CI and nix builds. The tests are passing but display this suspiscious error message. @Pamplemousse has been able to reproduce them locally by trapping SIGPIPE: # trap '' SIGPIPE # ./bash_unit -p test_fail_fails tests/test_core.sh Running tests in tests/test_core.sh Running test_fail_fails ... /nix/store/11b3chszacfr9liy829xqknzp3q88iji-gnugrep-3.11/bin/grep: write error: Broken pipe SUCCESS ✓ Overall result: SUCCESS ✓ From man, SIGPIPE appears when a process writes on a pipe with no reader. Looking at the problematic tests, we see that they all rely on a muted bash_unit with a stacktrace output being muted. When we look at how the stacktrace is muted, the code was like this: notify_stack () { : ; } And when we look at how the stacktrace is outputed by bash_unit we see the following code: stacktrace | notify_stack So we have some process run by stacktrace that is piped to a void function, that is, no process on the right of this pipe is reading which makes it a good candidate to generate a SIGPIPE. By replacing the muted notify_stack with the following code, the issue is solved: notify_stack () { $CAT >/dev/null ; }
1 parent a637d46 commit 800016b

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

tests/test_core.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ mute() {
335335
notify_test_succeeded() { : ; }
336336
notify_test_failed () { : ; }
337337
notify_message () { : ; }
338-
notify_stack () { : ; }
338+
notify_stack () { $CAT >/dev/null ; }
339339
notify_stdout () { : ; }
340340
notify_stderr () { : ; }
341341
notify_suites_succeded () { : ; }

tests/test_doc.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,14 @@ prepare_tests() {
1919
while grep -E "^${TEST_PATTERN}$" "$remaining" >/dev/null
2020
do
2121
((++block))
22-
run_doc_test "$remaining" "$swap" |& sed "\$a\\" | work_around_github_action_problem > "$test_output$block"
22+
run_doc_test "$remaining" "$swap" |& sed "\$a\\" > "$test_output$block"
2323
doc_to_output "$remaining" "$swap" > "$expected_output$block"
2424
eval 'function test_block_'"$(printf "%02d" "$block")"'() {
2525
assert "diff -u '"$expected_output$block"' '"$test_output$block"'"
2626
}'
2727
done
2828
}
2929

30-
work_around_github_action_problem() {
31-
# I have no idea what is happening with these broken pipes on github actions
32-
grep -v '^/usr/bin/grep: write error: Broken pipe$'
33-
}
34-
3530
function run_doc_test() {
3631
local remaining="$1"
3732
local swap="$2"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy