From c7253ae01d5cab88fec89b62c21944183cc725e4 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 24 Jan 2016 08:49:26 +2000 Subject: [PATCH] [PATCH] test: refactor directory name sanitization --- dc/0d681202f902b251e73aa00f47ec3a4f27fc0a | 98 +++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 dc/0d681202f902b251e73aa00f47ec3a4f27fc0a diff --git a/dc/0d681202f902b251e73aa00f47ec3a4f27fc0a b/dc/0d681202f902b251e73aa00f47ec3a4f27fc0a new file mode 100644 index 000000000..0bb1bbcef --- /dev/null +++ b/dc/0d681202f902b251e73aa00f47ec3a4f27fc0a @@ -0,0 +1,98 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A3C666DE0B2F + for ; Sat, 23 Jan 2016 04:49:42 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.309 +X-Spam-Level: +X-Spam-Status: No, score=-0.309 tagged_above=-999 required=5 tests=[AWL=0.242, + RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id xQ0AP3w5HxVg for ; + Sat, 23 Jan 2016 04:49:40 -0800 (PST) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id C8AB16DE0217 + for ; Sat, 23 Jan 2016 04:49:40 -0800 (PST) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aMxcg-0007xW-TJ; Sat, 23 Jan 2016 07:48:58 -0500 +Received: (nullmailer pid 7655 invoked by uid 1000); + Sat, 23 Jan 2016 12:49:35 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH] test: refactor directory name sanitization +Date: Sat, 23 Jan 2016 08:49:26 -0400 +Message-Id: <1453553366-7454-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.6.4 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 23 Jan 2016 12:49:42 -0000 + +test_C and notmuch_search_files_sanitize were giving different output on +the same path, which is not technically wrong, but slightly +confusing. +--- + test/T560-lib-error.sh | 2 +- + test/test-lib.sh | 11 ++++++++--- + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh +index c280939..59a479c 100755 +--- a/test/T560-lib-error.sh ++++ b/test/T560-lib-error.sh +@@ -183,7 +183,7 @@ int main (int argc, char** argv) + EOF + cat <<'EOF' >EXPECTED + == stdout == +-Path already exists: CWD/mail ++Path already exists: MAIL_DIR + + == stderr == + EOF +diff --git a/test/test-lib.sh b/test/test-lib.sh +index 0c9b366..c8f14d9 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -684,9 +684,14 @@ notmuch_search_sanitize () + perl -pe 's/("?thread"?: ?)("?)................("?)/\1\2XXX\3/' + } + +-notmuch_search_files_sanitize() ++notmuch_search_files_sanitize () + { +- sed -e "s,$MAIL_DIR,MAIL_DIR," ++ notmuch_dir_sanitize ++} ++ ++notmuch_dir_sanitize () ++{ ++ sed -e "s,$MAIL_DIR,MAIL_DIR," -e "s,${PWD},CWD,g" "$@" + } + + NOTMUCH_SHOW_FILENAME_SQUELCH='s,filename:.*/mail,filename:/XXX/mail,' +@@ -1186,7 +1191,7 @@ test_C () { + echo "== stdout ==" > OUTPUT.stdout + echo "== stderr ==" > OUTPUT.stderr + ./${exec_file} "$@" 1>>OUTPUT.stdout 2>>OUTPUT.stderr +- sed "s,${PWD},CWD,g" OUTPUT.stdout OUTPUT.stderr > OUTPUT ++ notmuch_dir_sanitize OUTPUT.stdout OUTPUT.stderr > OUTPUT + } + + +-- +2.6.4 + -- 2.26.2