From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oH8XAC1E62EmWwEAgWs5BA (envelope-from ) for ; Sat, 22 Jan 2022 00:39:25 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IPo0OCxE62HfcgEAauVa8A (envelope-from ) for ; Sat, 22 Jan 2022 00:39:24 +0100 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 BC19512FB0 for ; Sat, 22 Jan 2022 00:39:20 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id AE1285F71C; Fri, 21 Jan 2022 23:39:06 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id 90D5F5F705 for ; Fri, 21 Jan 2022 23:39:02 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id C1DD65FC01; Fri, 21 Jan 2022 18:39:01 -0500 (EST) Received: (nullmailer pid 1049218 invoked by uid 1000); Fri, 21 Jan 2022 23:38:58 -0000 From: David Bremner To: David Bremner , David Edmondson , notmuch@notmuchmail.org Subject: [PATCH 1/6] test: sanitize generated message files names Date: Fri, 21 Jan 2022 19:38:48 -0400 Message-Id: <20220121233853.1049166-2-david@tethera.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220121233853.1049166-1-david@tethera.net> References: <871stgid7j.fsf@tethera.net> <20220121233853.1049166-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: HISWD5X2DCNXQKATM4PE2NOJIB7JA6V4 X-Message-ID-Hash: HISWD5X2DCNXQKATM4PE2NOJIB7JA6V4 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-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642808360; 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=GMrIWD5Xpjw8f1BdidC0vYrLTc5yJyX8dI0BMyXWqSw=; b=fdx8IfvJsTmoEm1xidVbY/jHleMjpF1OGbXDyICTtQwsX8P5+h5dT0u3RUGJduLCJ6BN2H svV66M03m0120epOkar9pWZH1BoQsxNXRxHbxOm7CPH/XTqTJNOfugHSqcnb7SwwpJmjcy L/l56Ts15dcvxbfE5rIIq/ZlvlSUYrgrnj9SxSyaZk39M9KBenvp3QlTjEFyiEqszXZcxu 2KfYqMynwd5lUeg2i13hr7lBJ+rjLQOC+rdb3TW5bo1GesRZUkt5IqPFgrqb4ksbqUM4Mr aPPRzYuSN1jB4NETk7Jz0ZNr7NRdMSN3BEhoB/Z7/fcrT2y4jlm4sGxldaTW+g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642808360; a=rsa-sha256; cv=none; b=XBhRcd0QhZOqOvRln12fVVihvSujlSJgnw2gVIy3fcc6kfvXNeqkepbpFebPjP6RRmvy3a K8Iz7cwFDZWyFvIdGBqHJ8E95273WY2GZ/I0750lMnevI5VxuU5GgXGV4pBpOr8RNQhmGg Q1Kd7zCOYzNP75NIPckYt81otlM72Rf+7K0h/fv05pu0Nt1fVAMH3zYbRw23HdujGghrkV SbVDqx0jKNu6kMlh8Tzh7kxx+URZEm2E7cIuXQXgo+VgfK5W3OO48N9dZwIa2n08vIbW6l iU+smK2qsE0UG1NXCSodeqv/UFEiZwahDs+pAwmppDC3KsHnSyUD9GomvbYMdA== 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.85 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: BC19512FB0 X-Spam-Score: -1.85 X-Migadu-Scanner: scn0.migadu.com X-TUID: J9K6BIxWijGw It is fragile to encode the generated names into tests, as it makes tests break when e.g. new tests are added. There is a possibility that this will hide certain failures; in that case meaningful filenames should be chosen for the generated messages. --- test/T081-sexpr-search.sh | 2 +- test/T100-search-by-folder.sh | 6 +++--- test/T370-search-folder-coherence.sh | 4 ++-- test/T750-gzip.sh | 14 +++++++------- test/test-lib.sh | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/T081-sexpr-search.sh b/test/T081-sexpr-search.sh index 73f45041..0e5af635 100755 --- a/test/T081-sexpr-search.sh +++ b/test/T081-sexpr-search.sh @@ -346,7 +346,7 @@ output=$(notmuch search --query=sexp '(attachment (starts-with not))' | notmuch_ test_expect_equal "$output" 'thread:XXX 2009-11-18 [2/2] Lars Kellogg-Stedman; [notmuch] "notmuch help" outputs to stderr? (attachment inbox signed unread)' test_begin_subtest "starts-with, folder" -notmuch search --output=files --query=sexp '(folder (starts-with bad))' | notmuch_dir_sanitize | sed 's/[0-9]*$/XXX/' > OUTPUT +notmuch search --output=files --query=sexp '(folder (starts-with bad))' | notmuch_search_files_sanitize > OUTPUT cat < EXPECTED MAIL_DIR/bad/msg-XXX MAIL_DIR/bad/news/msg-XXX diff --git a/test/T100-search-by-folder.sh b/test/T100-search-by-folder.sh index 409cfdcc..fc9ad5f8 100755 --- a/test/T100-search-by-folder.sh +++ b/test/T100-search-by-folder.sh @@ -28,8 +28,8 @@ test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1(2)] Notmuch Test Suite test_begin_subtest "Folder search with --output=files" output=$(notmuch search --output=files folder:bad/news | notmuch_search_files_sanitize) -test_expect_equal "$output" "MAIL_DIR/bad/news/msg-003 -MAIL_DIR/duplicate/bad/news/msg-003" +test_expect_equal "$output" "MAIL_DIR/bad/news/msg-XXX +MAIL_DIR/duplicate/bad/news/msg-XXX" test_begin_subtest "After removing duplicate instance of matching path" rm -r "${MAIL_DIR}/bad/news" @@ -39,7 +39,7 @@ test_expect_equal "$output" "" test_begin_subtest "Folder search with --output=files part #2" output=$(notmuch search --output=files folder:duplicate/bad/news | notmuch_search_files_sanitize) -test_expect_equal "$output" "MAIL_DIR/duplicate/bad/news/msg-003" +test_expect_equal "$output" "MAIL_DIR/duplicate/bad/news/msg-XXX" test_begin_subtest "After removing duplicate instance of matching path part #2" output=$(notmuch search folder:duplicate/bad/news | notmuch_search_sanitize) diff --git a/test/T370-search-folder-coherence.sh b/test/T370-search-folder-coherence.sh index 0a2727e7..cf202bb3 100755 --- a/test/T370-search-folder-coherence.sh +++ b/test/T370-search-folder-coherence.sh @@ -24,8 +24,8 @@ test_expect_equal "$output" "No new mail." test_begin_subtest "Multiple files for same message" cat <EXPECTED -MAIL_DIR/msg-001 -MAIL_DIR/spam/msg-001 +MAIL_DIR/msg-XXX +MAIL_DIR/spam/msg-XXX EOF notmuch search --output=files id:$id_x | notmuch_search_files_sanitize >OUTPUT test_expect_equal_file EXPECTED OUTPUT diff --git a/test/T750-gzip.sh b/test/T750-gzip.sh index 4408d085..5648896f 100755 --- a/test/T750-gzip.sh +++ b/test/T750-gzip.sh @@ -58,13 +58,13 @@ test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "notmuch search --output=files with partially gzipped mail store" notmuch search --output=files '*' | notmuch_search_files_sanitize > OUTPUT cat < EXPECTED -MAIL_DIR/msg-001.gz -MAIL_DIR/msg-002.gz -MAIL_DIR/msg-003.gz -MAIL_DIR/msg-004 -MAIL_DIR/msg-005.gz -MAIL_DIR/msg-006 -MAIL_DIR/msg-007.gz +MAIL_DIR/msg-XXX.gz +MAIL_DIR/msg-XXX.gz +MAIL_DIR/msg-XXX.gz +MAIL_DIR/msg-XXX +MAIL_DIR/msg-XXX.gz +MAIL_DIR/msg-XXX +MAIL_DIR/msg-XXX.gz EOF test_expect_equal_file EXPECTED OUTPUT diff --git a/test/test-lib.sh b/test/test-lib.sh index f1275b85..02b67f02 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -537,7 +537,7 @@ notmuch_search_sanitize () { } notmuch_search_files_sanitize () { - notmuch_dir_sanitize + notmuch_dir_sanitize | sed 's/msg-[0-9][0-9][0-9]/msg-XXX/' } notmuch_dir_sanitize () { -- 2.34.1