From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2JifAwm0Ll/JAwAA0tVLHw (envelope-from ) for ; Sat, 08 Aug 2020 14:17:45 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id CLEBOwi0Ll+9ZgAA1q6Kng (envelope-from ) for ; Sat, 08 Aug 2020 14:17:44 +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) server-signature RSA-PSS (2048 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9C32D940223 for ; Sat, 8 Aug 2020 14:17:44 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id BA3E029AF2; Sat, 8 Aug 2020 10:17:20 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 18B7E29AC5 for ; Sat, 8 Aug 2020 10:17:11 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 118F15FA66; Sat, 8 Aug 2020 10:17:11 -0400 (EDT) Received: (nullmailer pid 1124270 invoked by uid 1000); Sat, 08 Aug 2020 14:17:04 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 07/19] test/libconfig; use n_database_open_with_config Date: Sat, 8 Aug 2020 11:16:41 -0300 Message-Id: <20200808141653.1124111-8-david@tethera.net> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200808141653.1124111-1-david@tethera.net> References: <20200808141653.1124111-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: G3UQ6BAYLC6S22TBXZCGIUTG3GYH7O5T X-Message-ID-Hash: G3UQ6BAYLC6S22TBXZCGIUTG3GYH7O5T 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-Scanner: scn0 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-Spam-Score: 0.03 X-TUID: iAbz7Rh61gSX This allows testing the "override database config with file functionality". It also requires passing a config file explicitly to each test program. --- test/T590-libconfig.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/test/T590-libconfig.sh b/test/T590-libconfig.sh index c2bce4a2..a34eae0b 100755 --- a/test/T590-libconfig.sh +++ b/test/T590-libconfig.sh @@ -16,7 +16,12 @@ int main (int argc, char** argv) char *val; notmuch_status_t stat; - EXPECT0(notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_WRITE, &db)); + EXPECT0(notmuch_database_open_with_config (argv[1], + NOTMUCH_DATABASE_MODE_READ_WRITE, + argv[2], + NULL, + &db, + NULL)); EOF @@ -26,7 +31,7 @@ cat < c_tail EOF test_begin_subtest "notmuch_database_{set,get}_config" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { EXPECT0(notmuch_database_set_config (db, "test.key1", "testvalue1")); EXPECT0(notmuch_database_set_config (db, "test.key2", "testvalue2")); @@ -46,7 +51,7 @@ test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch_database_get_config_list: empty list" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { notmuch_config_list_t *list; EXPECT0(notmuch_database_get_config_list (db, "nonexistent", &list)); @@ -78,7 +83,7 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch_database_get_config_list: all pairs" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { notmuch_config_list_t *list; EXPECT0(notmuch_database_set_config (db, "zzzafter", "afterval")); @@ -142,7 +147,7 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "dump config" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { EXPECT0(notmuch_database_set_config (db, "key with spaces", "value, with, spaces!")); } @@ -160,7 +165,7 @@ test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "restore config" notmuch dump --include=config >EXPECTED -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { EXPECT0(notmuch_database_set_config (db, "test.key1", "mutatedvalue")); } @@ -170,7 +175,7 @@ notmuch dump --include=config >OUTPUT test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch_config_get" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { printf("test.key1 = %s\n", notmuch_config_get (db, "test.key1")); printf("test.key2 = %s\n", notmuch_config_get (db, "test.key2")); @@ -186,7 +191,7 @@ test_expect_equal_file EXPECTED OUTPUT backup_database test_begin_subtest "notmuch_config_set" -cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} +cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${NOTMUCH_CONFIG} { char *val; printf("test.key1 = %s\n", notmuch_config_get (db, "test.key1")); -- 2.28.0