[PATCH] test: handle filenames that have directories in them
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Fri, 12 Oct 2012 20:43:28 +0000 (16:43 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:45 +0000 (09:49 -0800)
c7/8b6ae8f6f39f41f1f84cebd857235caa9c37aa [new file with mode: 0644]

diff --git a/c7/8b6ae8f6f39f41f1f84cebd857235caa9c37aa b/c7/8b6ae8f6f39f41f1f84cebd857235caa9c37aa
new file mode 100644 (file)
index 0000000..c1e31a5
--- /dev/null
@@ -0,0 +1,102 @@
+Return-Path: <ethan.glasser.camp@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 0C86F431FAF\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 13:43:39 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id LzvIBJcfPLQ8 for <notmuch@notmuchmail.org>;\r
+       Fri, 12 Oct 2012 13:43:38 -0700 (PDT)\r
+Received: from mail-qa0-f46.google.com (mail-qa0-f46.google.com\r
+       [209.85.216.46]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 5252F431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 13:43:38 -0700 (PDT)\r
+Received: by mail-qa0-f46.google.com with SMTP id c26so53503qad.5\r
+       for <notmuch@notmuchmail.org>; Fri, 12 Oct 2012 13:43:37 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer;\r
+       bh=9e2Z5Dj6IbNPPgSC6psBtWDqNCSA4Jc4xBAtLZ8pjPQ=;\r
+       b=kqmsFcKo/eDJdqRy8hyTs6VfTLrrcg2KaEBjrtYHfS2WNvNd1hyKdXa90MY3gFdLLV\r
+       ZNdt9aUefyXcpnxNu9DHvUpsnc7ujRtbPVctXY+cx29UW+pToBx3uBLMTicTP1clROTT\r
+       REfvDPaOA/RtbXQEGhlN/8azfUnsFLsKHA0pbiZNHahdrEIkcZB27hLBxvwzBz24YIKw\r
+       t3VB9JD0yLIR1qOPcykn4MzY6YaYGNro2sF1Br9nNBUotLK2bBA5ixYPFe+21NJWGwFh\r
+       0PkvfoxKw97Dvd40CUMPP2xVBn/jBpHNsTKcyHkiXVfMVBaaOGmjc1iRIqHJYhNojoMT\r
+       UpTA==\r
+Received: by 10.224.192.70 with SMTP id dp6mr9211201qab.87.1350074617792;\r
+       Fri, 12 Oct 2012 13:43:37 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id jt10sm7268825qeb.4.2012.10.12.13.43.35\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 12 Oct 2012 13:43:36 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] test: handle filenames that have directories in them\r
+Date: Fri, 12 Oct 2012 16:43:28 -0400\r
+Message-Id: <1350074609-21769-1-git-send-email-ethan@betacantrips.com>\r
+X-Mailer: git-send-email 1.7.9.5\r
+Cc: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 12 Oct 2012 20:43:39 -0000\r
+\r
+Since $TEST_DIRECTORY is an absolute path, any filenames generated\r
+with it will be complete paths. Only use the basename to generate\r
+suffixes for filenames.\r
+\r
+Signed-off-by: Ethan Glasser-Camp <ethan@betacantrips.com>\r
+---\r
+Discovered this while reviewing the patch queue. test/emacs generates\r
+filenames using $TEST_DIRECTORY, which is generated using pwd(1). Test\r
+failures then cause failures in the test harness.\r
+\r
+ test/test-lib.sh |    8 +++++---\r
+ 1 file changed, 5 insertions(+), 3 deletions(-)\r
+\r
+diff --git a/test/test-lib.sh b/test/test-lib.sh\r
+index 7448b45..8de5e32 100644\r
+--- a/test/test-lib.sh\r
++++ b/test/test-lib.sh\r
+@@ -498,16 +498,18 @@ test_expect_equal_file ()\r
+       error "bug in the test script: not 2 or 3 parameters to test_expect_equal"\r
\r
+       file1="$1"\r
++      basename1=`basename "$file1"`\r
+       file2="$2"\r
++      basename2=`basename "$file2"`\r
+       if ! test_skip "$test_subtest_name"\r
+       then\r
+               if diff -q "$file1" "$file2" >/dev/null ; then\r
+                       test_ok_ "$test_subtest_name"\r
+               else\r
+                       testname=$this_test.$test_count\r
+-                      cp "$file1" "$testname.$file1"\r
+-                      cp "$file2" "$testname.$file2"\r
+-                      test_failure_ "$test_subtest_name" "$(diff -u "$testname.$file1" "$testname.$file2")"\r
++                      cp "$file1" "$testname.$basename1"\r
++                      cp "$file2" "$testname.$basename2"\r
++                      test_failure_ "$test_subtest_name" "$(diff -u "$testname.$basename1" "$testname.$basename2")"\r
+               fi\r
+     fi\r
+ }\r
+-- \r
+1.7.9.5\r
+\r