From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 4C9366DE1370 for ; Sun, 9 Oct 2016 13:35:25 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.207 X-Spam-Level: X-Spam-Status: No, score=0.207 tagged_above=-999 required=5 tests=[AWL=0.216, HEADER_FROM_DIFFERENT_DOMAINS=0.001, T_RP_MATCHES_RCVD=-0.01] 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 Zh4YUAfLq4CP for ; Sun, 9 Oct 2016 13:35:24 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 759906DE136E for ; Sun, 9 Oct 2016 13:35:24 -0700 (PDT) Received: by guru.guru-group.fi (Postfix, from userid 501) id C2BB01001E9; Sun, 9 Oct 2016 23:36:08 +0300 (EEST) From: Tomi Ollila To: notmuch@notmuchmail.org Cc: tomi.ollila@iki.fi Subject: [PATCH] test/test-lib.sh: execute basename(1)s lazier in test_expect_equal_file () Date: Sun, 9 Oct 2016 23:36:07 +0300 Message-Id: <1476045367-26825-1-git-send-email-tomi.ollila@iki.fi> X-Mailer: git-send-email 2.8.2 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sun, 09 Oct 2016 20:35:25 -0000 Moved the 2 basename(1) executions to the test failure branch in test_expect_equal_file (). The output of basename(1) executions in function test_expect_equal_file () are only used when tests fails -- when all tests pass these 2 basename(1) executions are no longer done at all. --- test/test-lib.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-lib.sh b/test/test-lib.sh index bda8a80..397408a 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -618,15 +618,15 @@ 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_ else testname=$this_test.$test_count + basename1=`basename "$file1"` + basename2=`basename "$file2"` cp "$file1" "$testname.$basename1" cp "$file2" "$testname.$basename2" test_failure_ "$(diff -u "$testname.$basename1" "$testname.$basename2")" -- 2.7.4