This is an empirical fix for a strange interaction we're seeing
between gdb 7.12-6 on debian stretch, GNU timeout, and parallel from
moreutils, reported by Bremner in id:87ef56io5d....@tethera.net.

The problem manifested itself as several concurrent test suite
subprocesses getting stopped by SIGTTOU (including some that don't use
gdb!), which ultimately caused a timeout for the test suite.

This problem itself does not appear to afflict the test suite when
using more modern version of gdb (e.g. 8.2.1-2 in debian buster), and
this fix doesn't cause any problems on newer versions of gdb either,
so it should be safe.

This fix was inspired by a comment from amdragon introduced back in
9ade8160a6a3f6f55996d7a58dc2cd81a6df8395 (now in
tests/T380-atomicity.sh) about an interaction between timeout and gdb.

A marginally cleaner patch be to consistently use gdb with either one
of:

 * -tty /dev/null
 * < /dev/null

in all of T050, T060, and T070.  But T070 can't use "< /dev/null"
because it needs stdin.  And when i tried to use "-tty /dev/null" in
T050 and T060, i got test suite failures that i wasn't able to
understand.

So, here is a patch that fixes the hanging problems on the older setup
without understanding them exactly.  I welcome any improvements or
actual understanding.

Signed-off-by: Daniel Kahn Gillmor <d...@fifthhorseman.net>
---
 test/T050-new.sh    | 2 +-
 test/T060-count.sh  | 2 +-
 test/T070-insert.sh | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index dfc8508f..9b3d41df 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -366,7 +366,7 @@ run
 EOF
 
 ${TEST_GDB} --batch-silent --return-child-result -x notmuch-new-vanish.gdb \
-    --args notmuch new 2>OUTPUT 1>/dev/null
+    --args notmuch new 2>OUTPUT 1>/dev/null </dev/null
 echo "exit status: $?" >> OUTPUT
 
 # Clean up the file in case gdb isn't available.
diff --git a/test/T060-count.sh b/test/T060-count.sh
index 0c0bf473..a393edb6 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -116,7 +116,7 @@ EOF
 backup_database
 test_begin_subtest "error message from query_search_messages"
 ${TEST_GDB} --batch-silent --return-child-result -x count-files.gdb \
-    --args notmuch count --output=files '*' 2>OUTPUT 1>/dev/null
+    --args notmuch count --output=files '*' 2>OUTPUT 1>/dev/null < /dev/null
 cat <<EOF > EXPECTED
 notmuch count: A Xapian exception occurred
 A Xapian exception occurred performing query
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 05be473a..e30f0a43 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -267,12 +267,14 @@ for code in  FILE_NOT_EMAIL READ_ONLY_DATABASE 
UPGRADE_REQUIRED PATH_ERROR; do
     test_begin_subtest "EXIT_FAILURE when index_file returns $code"
     test_expect_code 1 \
          "${TEST_GDB} --batch-silent --return-child-result \
+            -tty /dev/null \
             -ex 'set args insert < $gen_msg_filename' \
             -x index-file-$code.gdb notmuch"
 
     test_begin_subtest "success exit with --keep when index_file returns $code"
     test_expect_code 0 \
          "${TEST_GDB} --batch-silent --return-child-result \
+            -tty /dev/null \
             -ex 'set args insert --keep < $gen_msg_filename' \
             -x index-file-$code.gdb notmuch"
 done
@@ -281,12 +283,14 @@ for code in OUT_OF_MEMORY XAPIAN_EXCEPTION ; do
     test_begin_subtest "EX_TEMPFAIL when index_file returns $code"
     test_expect_code 75 \
          "${TEST_GDB} --batch-silent --return-child-result \
+            -tty /dev/null \
             -ex 'set args insert < $gen_msg_filename' \
             -x index-file-$code.gdb notmuch"
 
     test_begin_subtest "success exit with --keep when index_file returns $code"
     test_expect_code 0 \
          "${TEST_GDB} --batch-silent --return-child-result \
+            -tty /dev/null \
             -ex 'set args insert --keep < $gen_msg_filename' \
             -x index-file-$code.gdb notmuch"
 done
-- 
2.20.1

_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to