From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2kvPMMQMdGHpkQAAgWs5BA (envelope-from ) for ; Sat, 23 Oct 2021 15:23:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oHr1K8QMdGF8egAAB5/wlQ (envelope-from ) for ; Sat, 23 Oct 2021 13:23:16 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5BC4114224 for ; Sat, 23 Oct 2021 15:23:16 +0200 (CEST) Received: from nmbug.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B600E2C1D3; Sat, 23 Oct 2021 09:23:02 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id C6B922C1E8 for ; Sat, 23 Oct 2021 09:22:56 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 7F07A5FC42; Sat, 23 Oct 2021 09:22:56 -0400 (EDT) Received: (nullmailer pid 1864474 invoked by uid 1000); Sat, 23 Oct 2021 13:22:51 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 1/6] test: add two known broken tests for missing config files Date: Sat, 23 Oct 2021 10:22:33 -0300 Message-Id: <20211023132238.1864400-2-david@tethera.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211023132238.1864400-1-david@tethera.net> References: <20211023132238.1864400-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: JA5CTHOIGU4TVXRHAXB5GX2UH6HMCF5X X-Message-ID-Hash: JA5CTHOIGU4TVXRHAXB5GX2UH6HMCF5X 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; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634995396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc: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-unsubscribe:list-subscribe:list-post; bh=MGd670S28FV1vqIiGKDLzVKbq8SsKLiR4Pt9Aa3SEws=; b=Yf1owoB7isfPh4NU0ebvNpjXxMXADcuxWFYEkiL+/Rl5q7rYFNLM7P3MGtgLpRSzphHmhi qOExM3KsA2LXHfQCiGKt3OOKf9zidRtC9w8rqWo/loZY9mov6Y6V6iNt9D9M5+717Q34Pl do/41zjUrPQ7jvjZWwaLrzYf/ES1q93T6rnHMvtkkoqhxgc/R84871+C+zbCXCRePjnO/G kXyrHGsmoXqp8rZSYalBuaIL1cQoR7FHjnGe6k+9dzPUCFqlroP10D2ZQPDb7C/mW+I3fm zcKzGwT1UeFyu5/cEve6muAcrN0z/4OAjacErjkzWwxLN4/ZFDbntc0ToKVwoA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634995396; a=rsa-sha256; cv=none; b=ttWsNIIUU4z2n/syskqsJY7JTX1DG9Pw9tSB4pXhWv2zq9YjdRD1SkrbNE8rHbE4+BUdE5 FYIhcxrKcMM1y292GOHPuntfFqhjN1tjsVy0BPdTYNq2ynW1ha+SSf7b6MGNJgBTtmit0x VzmnzoiMsjo4CvwEMkYUa3x6x/Vzem3uZnSG/+4SzvlynMmrWcgshRHVTtvyLBb17v+AND AtzKlLz2Qb/orM8c4R73dUAZBt20WiSuFyWR13XUbxwScpbz9rIY5o4WnMEB3eievN7phr hS6V2aZHO3uziYqvvH07weQWxNmnddqo7eA1VI+EqQrgTYH1YikdaEoYGpWTrg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.15 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 5BC4114224 X-Spam-Score: -1.15 X-Migadu-Scanner: scn1.migadu.com X-TUID: 4MdCr/Nsg/+C The documentation claims that the database will be set to NULL in this case, but it is currently not happening. Based on a reproducer [1] from Austin Ray. [1]: id:20211021190401.imirxau2ewke6e2m@athena --- test/T590-libconfig.sh | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index 59b82a6f..ed12b005 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -849,4 +849,47 @@ zzzafter afterval EOF test_expect_equal_file EXPECTED OUTPUT +cat < c_head3 +#include +int main (int argc, char **argv) { + notmuch_status_t stat; + notmuch_database_t *db = NULL; +EOF + +cat < c_tail3 + printf("db == NULL: %d\n", db == NULL); +} +EOF + +test_begin_subtest "open: database set to null on missing config" +test_subtest_known_broken +cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} "/nonexistent" + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + argv[2], NULL, &db, NULL); +EOF +cat < EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + +test_begin_subtest "open: database set to null on missing config (env)" +test_subtest_known_broken +old_NOTMUCH_CONFIG=${NOTMUCH_CONFIG} +NOTMUCH_CONFIG="/nonexistent" +cat c_head3 - c_tail3 <<'EOF' | test_C ${MAIL_DIR} + notmuch_status_t st = notmuch_database_open_with_config(argv[1], + NOTMUCH_DATABASE_MODE_READ_ONLY, + NULL, NULL, &db, NULL); +EOF +NOTMUCH_CONFIG=${old_NOTMUCH_CONFIG} +cat < EXPECTED +== stdout == +db == NULL: 1 +== stderr == +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done -- 2.33.0