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