From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 46DA76DE141E for ; Mon, 20 May 2019 23:12:19 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.432 X-Spam-Level: X-Spam-Status: No, score=0.432 tagged_above=-999 required=5 tests=[AWL=-0.220, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g3dBXXg4hOgC for ; Mon, 20 May 2019 23:12:17 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 42DE76DE141B for ; Mon, 20 May 2019 23:12:16 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id D5EF21000D0; Tue, 21 May 2019 09:12:12 +0300 (EEST) From: Tomi Ollila To: Daniel Kahn Gillmor , Notmuch Mail Subject: Re: [PATCH] test: avoid hanging older gdb under GNU timeout and moreutils parallel In-Reply-To: <20190521010304.417-1-dkg@fifthhorseman.net> References: <87mujgab6j.fsf@fifthhorseman.net> <20190521010304.417-1-dkg@fifthhorseman.net> User-Agent: Notmuch/0.28.3+84~g41389bb (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 06:12:19 -0000 On Mon, May 20 2019, Daniel Kahn Gillmor wrote: > > A marginally cleaner patch be to consistently use gdb with either one > of: > > * -tty /dev/null > * < /dev/null This looks like a good read: https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_21.html and is used to speculate below. I also run the following commands: trace gdb --batch strace -ox gdb --batch strace -oy gdb --batch /dev/null strace -og gdb --batch /dev/null 2>/dev/null and then looked for ioctl() calls in created output file. the latest (-og) was the only one where gdb(1) was not able to mess with tty (i.e. even gdb had tty it did not try to find it on its fd's or open("/dev/tty")... when run in parallel(1), all the other have possibility to mess w/ tty *at the same time* if winds are favorable -- but that means that 1) process had controlling tty before running parallel 2) processes parallel run had controlling tty (same tty) I did not check this. > 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. In T050 and T060, IIUC the above link, -tty /dev/null makes the inferior process have /dev/null in its stdin, stdout and stderr -- so there is no output (I tested T050, not even looked T060). It is strange that T070 does not work. < /dev/null should only affect the gdb(1) itself, and not the inside redirection -- but would have to dig deeper to understand and just now I don't have time... ... anyway all stdin, stdout and stderr should be redirected if --tty option is not used (or even then, look above), to avoid potential mess w/ controlling tty possibly shared with other processes... Tomi > > 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 > --- > 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 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 < 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