[PATCH] test: gdb insert: redirect input inside gdb script

Subject: [PATCH] test: gdb insert: redirect input inside gdb script

Date: Mon, 28 Nov 2016 23:07:08 +0200

To: notmuch@notmuchmail.org

Cc: tomi.ollila@iki.fi

From: Tomi Ollila


Running `gdb command < input` is not as reliable way to give input
to the command (some installations of gdb consume it). Use "set args"
gdb command to have input redirected at gdb 'run' time.
---

With this change, these tests work on FreeBSD-11.0-RELEASE-amd64[.qcow2]
when adding gdb 7.11.1 using pkg install (and having /usr/local/bin in
front of path) -- before this gdb just hang -- and it took a while...

On Linux this test keeps working.

After commit and before amend(*) I dropped '-nx' command line option
(to not read any gdbinit files). Perhaps all gdb invocations should
have that (currently none has).

(*) git commit -a --amend -C HEAD ;: let the virus spread :)


 test/T070-insert.sh | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index c2485bb..43b3abc 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -202,13 +202,15 @@ end
 run
 EOF
 test_begin_subtest "error exit when add_message returns $code"
-gdb --batch-silent --return-child-result -x index-file-$code.gdb \
-    --args notmuch insert  < $gen_msg_filename
+gdb --batch-silent --return-child-result \
+    -ex "set args insert < $gen_msg_filename" \
+    -x index-file-$code.gdb notmuch
 test_expect_equal $? 1
 
 test_begin_subtest "success exit with --keep when add_message returns $code"
-gdb --batch-silent --return-child-result -x index-file-$code.gdb \
-    --args notmuch insert --keep  < $gen_msg_filename
+gdb --batch-silent --return-child-result \
+    -ex "set args insert --keep < $gen_msg_filename" \
+    -x index-file-$code.gdb notmuch
 test_expect_equal $? 0
 done
 
-- 
2.10.0


Thread: