From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uGoDKi8bjGL4gQEAbAwnHQ (envelope-from ) for ; Tue, 24 May 2022 01:39:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MG8FKS8bjGIZDQAAG6o9tA (envelope-from ) for ; Tue, 24 May 2022 01:39:27 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 41FD542C8D for ; Tue, 24 May 2022 01:39:27 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 5A08C5F731; Mon, 23 May 2022 23:39:10 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id A79EA5F70D for ; Mon, 23 May 2022 23:39:08 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id BB9815FBD7; Mon, 23 May 2022 19:39:07 -0400 (EDT) Received: (nullmailer pid 3506962 invoked by uid 1000); Mon, 23 May 2022 23:39:03 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 8/8] test: error handling in _n_message_{add,remove}_filename Date: Mon, 23 May 2022 20:39:01 -0300 Message-Id: <20220523233901.3506880-9-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220523233901.3506880-1-david@tethera.net> References: <20220523233901.3506880-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: LAEA7VALU5LAN2QTL6GK7NOPWD2MPUFC X-Message-ID-Hash: LAEA7VALU5LAN2QTL6GK7NOPWD2MPUFC X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653349167; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=94yfTfPCH+Rm6TwBWavVAb4Geqrv6tyf5TJkUcTstaE=; b=j1kix8JzvR0bcfUVHnx13Y1bjrzs1Y6v6E+1krvTGTVMwgyfkqqr75E0mreVEW3QEcq3hJ tvibvMbjmyb9S240lnIR8tuTE0gWl0kjtEQbGpSeRcVvYLVq8xsmG+qkkx+3xboy87VpHX lnmaLQzIJJ+LWS1xas3rZJmzobJ0GG1He3mBRqOiaZCz8NSd0Z1Iv3neq4+1EfOhAFehZ+ RSMOjL/aEhK0AEHq9F5w7tYLXvpLmA+97hFbUN2ChXHs/Bduwe7Nafsc4Z9VhMQ2LPGtRg jWnBY/XDHdyhClk6123aVFU+fRW0jCVf0fAMtDArPfdUwoLahh5o6vKE3g+qBg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653349167; a=rsa-sha256; cv=none; b=lLXQU0Kj0pwF9nd/wKovkBvtp1kNPwi3VuJjukENqrgFAEZYk1nd7mAmdzbqBVOrZi6yvs m92XkwuCMvSqCfjtzwrTGiGgibR7i2SFXZcImsLvmYSQIeTlWPxbqMOwTnGd2aGIB8tM/0 V8/KddYgo6rG0oaDlUTtK8q1ckVzfStC1a63Y/sGf7OcRn2D3auoWsrP96/jsYBNTu+36q TC98QFlNdRAxEXf5UAKmeLOLRi7W/A33joBVINXwHs/hJStg6aQJx/rpC/AaQs4yZaDvTz N4ZygfcgYmScoO00L89Wd0ha0m5pE+GB3dn1885d4sltF6HQGvfpwf/ut5hNfw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.00 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 41FD542C8D X-Spam-Score: -1.00 X-Migadu-Scanner: scn1.migadu.com X-TUID: 02fWkaagn5o7 Use a closed database to force throwing a Xapian exception. Leave the check vague to accomodate a potential explicit check for open database. --- test/T566-lib-message.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh index 5b6c937e..30040634 100755 --- a/test/T566-lib-message.sh +++ b/test/T566-lib-message.sh @@ -340,6 +340,38 @@ cat < EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "_notmuch_message_add_filename on closed db" +cat c_head - c_tail <<'EOF' | test_private_C ${MAIL_DIR} + { + notmuch_private_status_t status; + status = _notmuch_message_add_filename (message, "some-filename"); + printf("%d\n%d\n", message != NULL, status != NOTMUCH_STATUS_SUCCESS); + } +EOF +cat < EXPECTED +== stdout == +1 +1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "_notmuch_message_remove_filename on closed db" +cat c_head - c_tail <<'EOF' | test_private_C ${MAIL_DIR} + { + notmuch_private_status_t status; + status = _notmuch_message_remove_filename (message, "some-filename"); + printf("%d\n%d\n", message != NULL, status != NOTMUCH_STATUS_SUCCESS); + } +EOF +cat < EXPECTED +== stdout == +1 +1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "Handle removing all tags with closed db" cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} { -- 2.35.2