Diff options
Diffstat (limited to '')
-rwxr-xr-xtests/t0303-robustness.sh10
1 file changed, 7 insertions, 3 deletions
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 "<div class=.commit-subject.>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 "</html>" tmp
+ test $(grep -c "^Status:" tmp) = 1
'
test_expect_success 'a commit encoding header is read without its newline' '