From b270cf958fc2d16ca74a0dea65d55ca322a1221e Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 15:45:11 -0700 Subject: Check only what the racing filter tests can promise Both tests passed or failed with the order in which cgit and the exec filter happened to run, about one run in four under UBSan and on Alpine. They now check what holds either way. --- tests/t0303-robustness.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/t0303-robustness.sh b/tests/t0303-robustness.sh index f1ae9cd..c881045 100755 --- a/tests/t0303-robustness.sh +++ b/tests/t0303-robustness.sh @@ -186,6 +186,8 @@ test_expect_success 'a bare query parameter does not swallow the next one' ' grep "
commit 2" tmp ' +# Whether cgit first sees the filter's exit status or its closed pipe +# depends on which side runs first, so either message will do. test_expect_success 'a filter that cannot run answers one error page' ' { echo "commit-filter=exec:$PWD/no/such/filter" && @@ -194,18 +196,20 @@ test_expect_success 'a filter that cannot run answers one error page' ' cgit_rc badfilterrc "url=rob/commit/" >tmp 2>err && test $(grep -c "^Status:" tmp) = 1 && grep "Unable to complete the request" tmp && - grep "Unable to run filter $PWD/no/such/filter" err && + grep -e "Unable to run filter $PWD/no/such/filter" -e "Unable to write the page" err && grep "Unable to exec filter" err ' +# The filter may exit before or after cgit writes to it, so the page either +# completes or ends where the write failed. Either way cgit answers once and +# exits cleanly rather than dying of SIGPIPE. test_expect_success 'a filter that exits without reading does not end cgit' ' { echo "email-filter=exec:true" && cat robrc } >truerc && cgit_rc truerc "url=rob/log/" >tmp && - grep "^Status: 200" tmp && - grep "" tmp + test $(grep -c "^Status:" tmp) = 1 ' test_expect_success 'a commit encoding header is read without its newline' ' -- cgit