From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id YBlaHTsbjGL4gQEAbAwnHQ (envelope-from ) for ; Tue, 24 May 2022 01:39:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id GBAfHTsbjGIYZQEAauVa8A (envelope-from ) for ; Tue, 24 May 2022 01:39:39 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (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 3BF521F6B6 for ; Tue, 24 May 2022 01:39:39 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6B6B85F79F; Mon, 23 May 2022 23:39:15 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 95DB25F782 for ; Mon, 23 May 2022 23:39:12 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id A19955FC01; Mon, 23 May 2022 19:39:11 -0400 (EDT) Received: (nullmailer pid 3506945 invoked by uid 1000); Mon, 23 May 2022 23:39:02 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 3/8] test: _notmuch_message_remove_term catches exceptions. Date: Mon, 23 May 2022 20:38:56 -0300 Message-Id: <20220523233901.3506880-4-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: 4RRBIFPLDHWMC6CQAY25QQPOM7EL6NU2 X-Message-ID-Hash: 4RRBIFPLDHWMC6CQAY25QQPOM7EL6NU2 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=1653349179; 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=b5gtRm8ZufLmGC8LRdUCCV2co+SFlYOsccyUipC9tUg=; b=UUF3k2TjjuNyXNR40UpdWM/WZfhWTgjB+bXYLafBRDfpuoloTxhhY+5X2mnkBRukwxwaK7 IzOibQg4f0ewMuarIzn8cIPpJxylbjg+rK8tLFSEvtuZaxyL6MEGGd2AGNeENKNpXNiQvD 3kZcLBxwd6an2VeOxHLkoAuZddRWpOiH0JCsPxerbArbo2OfqVdIXxDbveJIerfwAQa6sr UO6oZfum7fMeeLqy291XU5E8kyfp/K9LKZsxKQCPzlwADD+/cNWgHDf9RWVrKL0HETG38W EUYDoVVGCRJ9yGnVn3w7I7sI78QknT9JOGLvODPSAhiY9WcHVBPcsAH3Gl8Vjg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653349179; a=rsa-sha256; cv=none; b=ZkbgmVXbAiuOvJNdyuq2Q78S9nssnySAoYZgfDXBD2Tiory7d/GdJzSSks9KyjOHsbLhHz pCgg/awI6BxBDpQkXpdCSVpAGduwTHW4pdsrV4hsGjtbCnoBgN4GRWDjuEWGLqVRkDCXAY x61IYdDEugCPzwoqvy8wmPED10h62zkylya9dWl2OeyhhL39xeGQ49iUaxBRvwQcZqZu0k xPU6ipufRO08PytDsHa3Ld/maGypIPA8DcW3+ayM3XE4Ho+BcIZsiBu/rugF9SaCLUj1Ve PnFNx20tKhsIvdoKV/w0k7mV3G/+YTMpXaSaVXdZtn9sZhCbN0+WGEG6cg6DlA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.52 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 3BF521F6B6 X-Spam-Score: -1.52 X-Migadu-Scanner: scn0.migadu.com X-TUID: sCA7njLcZ6lO Unfortunately we can't differentiate between the two distinct error conditions for Document::remove_term. --- test/T566-lib-message.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh index 08ab2765..5b6c937e 100755 --- a/test/T566-lib-message.sh +++ b/test/T566-lib-message.sh @@ -322,6 +322,24 @@ cat < EXPECTED EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "_notmuch_message_remove_term catches exceptions" +cat c_head0 - c_tail <<'EOF' | test_private_C ${MAIL_DIR} + { + notmuch_private_status_t status; + /* Xapian throws the same exception for empty and non-existent terms; + * error string varies between Xapian versions. */ + status = _notmuch_message_remove_term (message, "tag", "nonexistent"); + 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