From: Tomi Ollila Date: Thu, 18 Oct 2012 05:43:21 +0000 (+0300) Subject: Re: [PATCH] test: handle filenames that have directories in them X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=6183e5a0133304364f5353fe6066086f66e9b2c6;p=notmuch-archives.git Re: [PATCH] test: handle filenames that have directories in them --- diff --git a/b4/e882943e8e6f9819be25b63d4737fb53b304f9 b/b4/e882943e8e6f9819be25b63d4737fb53b304f9 new file mode 100644 index 000000000..1f1775196 --- /dev/null +++ b/b4/e882943e8e6f9819be25b63d4737fb53b304f9 @@ -0,0 +1,113 @@ +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 189AA431FBF + for ; Wed, 17 Oct 2012 22:43:25 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 V3Vwm8skSfTX for ; + Wed, 17 Oct 2012 22:43:20 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 518D9431FB6 + for ; Wed, 17 Oct 2012 22:43:20 -0700 (PDT) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id D3F941000E5; + Thu, 18 Oct 2012 08:43:21 +0300 (EEST) +From: Tomi Ollila +To: Ethan Glasser-Camp , notmuch@notmuchmail.org +Subject: Re: [PATCH] test: handle filenames that have directories in them +In-Reply-To: <1350074609-21769-1-git-send-email-ethan@betacantrips.com> +References: <1350074609-21769-1-git-send-email-ethan@betacantrips.com> +User-Agent: Notmuch/0.14+51~g62cd13b (http://notmuchmail.org) Emacs/24.2.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Thu, 18 Oct 2012 05:43:25 -0000 + +On Fri, Oct 12 2012, Ethan Glasser-Camp wrote: + +> 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. + + +LGTM. + +Removing needs-review (for this trivial change) as this helps the +good review work Ethan is doing :D + +Tomi + +Ps: some shell "trivia ;)" basename=`basename "$file"` works for variable +assignment; when giving as argument to command that needs one more quotes: +e.g. wc "`basename "$file"`" +fun?! + +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch