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 025016DE0F80 for ; Mon, 10 Jun 2019 04:20:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 2.159 X-Spam-Level: ** X-Spam-Status: No, score=2.159 tagged_above=-999 required=5 tests=[AWL=-0.243, DATE_IN_PAST_06_12=1.103, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SORBS_WEB=1.5, SPF_PASS=-0.001] 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 K6x0W6evbO1b for ; Mon, 10 Jun 2019 04:20:49 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTPS id 77FEE6DE143D for ; Mon, 10 Jun 2019 04:20:38 -0700 (PDT) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019; t=1560165637; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=xOJlXx+RjerEBxxrkGFreV6lfb3KN2u/QRZrNMsa7SA=; b=V6QJU2Qmft/UU7QTr/JQ6TSPnfzaqESsP9ZAcVvnF+YT/X+CP8Sg0skQ aOIrRtaQbejbFwAiV+uK6iiyJkxkBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fifthhorseman.net; i=@fifthhorseman.net; q=dns/txt; s=2019rsa; t=1560165636; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : from; bh=xOJlXx+RjerEBxxrkGFreV6lfb3KN2u/QRZrNMsa7SA=; b=rOxMB8hUyWblHICkvdK5fv8xYjlhKPaO7Om2DIp9remDF9Nmg8RkgcUx OvcjqmUoz1iaJSUuJd4pEGumA76R8E/qZypWXQUuGns8BLgh1H3+ZUGjFs Q3qdp64iiakHG71PSH73MtoEoc3znrEbwGLTUNQczebyfJ97g19xaoa1Gf /z9P5kV7/VUDGv6SDO5g2tvXzscI1HdYPg5lXxt9/bRAvErdCNtMCGxJny UfFxry3ymNExU66ISYQYDpSc1U5rxyPyrIOfrnv58w47Fe5U6R3ZLVPtPW NHcKfZ6jpLffsC2qjA/6hXrIyPBkrGFz52sBntNS07TbXwtYPznRug== Received: from fifthhorseman.net (unknown [41.226.24.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by che.mayfirst.org (Postfix) with ESMTPSA id 1627DF99E; Mon, 10 Jun 2019 07:20:36 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id 9213420BEE; Sun, 9 Jun 2019 20:53:10 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH v2 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh Date: Mon, 10 Jun 2019 03:53:10 +0300 Message-Id: <20190610005310.15119-1-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <87lfyantx3.fsf@fifthhorseman.net> References: <87lfyantx3.fsf@fifthhorseman.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: Mon, 10 Jun 2019 11:20:50 -0000 From: David Bremner This removes the dependency of this test script on gdb, and considerably speeds up the running of the tests. --- dkg cleaned up the placement of gen_insert_msg, and used printf's %q to handle the perverse case where $gen_msg_filename happens to have a U+0022 QUOTATION MARK ('"') in it. Signed-off-by: Daniel Kahn Gillmor --- test/T070-insert.sh | 48 ++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/test/T070-insert.sh b/test/T070-insert.sh index 48165caa..017124fc 100755 --- a/test/T070-insert.sh +++ b/test/T070-insert.sh @@ -2,8 +2,6 @@ test_description='"notmuch insert"' . $(dirname "$0")/test-lib.sh || exit 1 -test_require_external_prereq gdb - # subtests about file permissions assume that we're working with umask # 022 by default. umask 022 @@ -246,19 +244,19 @@ test_expect_code 1 "notmuch insert $gen_msg_filename 2>&1" notmuch config set new.tags $OLDCONFIG # DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass. - -for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \ - READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do -cat < index-file-$code.gdb -set breakpoint pending on -set logging file index-file-$code.log -set logging on -break notmuch_database_index_file -commands -return NOTMUCH_STATUS_$code -continue -end -run +# pregenerate all of the test shims +for code in FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR OUT_OF_MEMORY XAPIAN_EXCEPTION; do + make_shim shim-$code < +#include +notmuch_status_t +notmuch_database_index_file (notmuch_database_t *notmuch, + const char *filename, + notmuch_indexopts_t *indexopts, + notmuch_message_t **message_ret) +{ + return NOTMUCH_STATUS_$code; +} EOF done @@ -266,30 +264,18 @@ gen_insert_msg 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 \ - -ex 'set args insert < $gen_msg_filename' \ - -x index-file-$code.gdb notmuch" + test_expect_code 1 "$(printf "notmuch_with_shim shim-%q insert < %q" "$code" "$gen_msg_filename")" test_begin_subtest "success exit with --keep when index_file returns $code" - test_expect_code 0 \ - "${TEST_GDB} --batch-silent --return-child-result \ - -ex 'set args insert --keep < $gen_msg_filename' \ - -x index-file-$code.gdb notmuch" + test_expect_code 0 "$(printf "notmuch_with_shim shim-%q insert --keep < %q" "$code" "$gen_msg_filename")" done 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 \ - -ex 'set args insert < $gen_msg_filename' \ - -x index-file-$code.gdb notmuch" + test_expect_code 75 "$(printf "notmuch_with_shim shim-%q insert < %q" "$code" "$gen_msg_filename")" test_begin_subtest "success exit with --keep when index_file returns $code" - test_expect_code 0 \ - "${TEST_GDB} --batch-silent --return-child-result \ - -ex 'set args insert --keep < $gen_msg_filename' \ - -x index-file-$code.gdb notmuch" + test_expect_code 0 "$(printf "notmuch_with_shim shim-%q insert --keep < %q" "$code" "$gen_msg_filename")" done test_done -- 2.20.1