From patchwork Wed Mar 2 17:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766361 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B040C433F5 for ; Wed, 2 Mar 2022 17:28:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243868AbiCBR2o (ORCPT ); Wed, 2 Mar 2022 12:28:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243832AbiCBR2a (ORCPT ); Wed, 2 Mar 2022 12:28:30 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2956DDF44 for ; Wed, 2 Mar 2022 09:27:32 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id y5so1629495wmi.0 for ; Wed, 02 Mar 2022 09:27:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5SY529CcRIlVbl/C3sDDkM+YleIbXQRB7rOTOXmu7aU=; b=qNjADGxx++BNisxLo9mB/QJB6Ba6OAvVM0ZZI34xlQkfyKKOu0e+GM30evhneVxFNg 7WcAgh5fAPKvin5gh1nFAfPATBEx5IKC4TpjZfkkKaFtS/EmA96LmWt7YC2OTx8cPOJz d63dwI3r2ZTVSHyrCgc9BM+zm41v7tOwMvHhe8LYq+B/kNJ2PvNBBM0eiTtw85+xEFtk s+h4ZyRdtn0J1qzabz3pabYgajyfeRG+6hkJ3avBc6dVbPCqom7rNo89E3tWYKexB4xB 9C5rZVDNWNiGYEhvK1YIES9ilIy9z1h/xPmmNfFLsbQL6kiGylASAACeDdnIlSYEuA/0 edbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5SY529CcRIlVbl/C3sDDkM+YleIbXQRB7rOTOXmu7aU=; b=fDlk35rERZnKioaCiSQdlRxtDrputG7RQJgXgjLDkTJHkGnoyRmdtCJAPgpraYsnVy DqkOHGH9HdeXIU73ZRVmX7aV0kzSN0UJiAEoZZQOSvyx4U33Q++jhUotEMyyg5uFFHAO 3QXPupF+/vx0y+pIscVX06adJpWdhUWcmOaPTmeaGC2+mp59X8weVlVf7fgw8oGory1G FAxtvnjZDCaQxUII1sfsndip/8eJ8z4TPHIk9zzo2zMiMWngYP7UoMIIncKlzwF9KxcI pxHwAIL4j+/nAPcoaiTObZQcj8G6i3wF0EdR2kyojJBW/sz1YNjRMOiMTGdJAzvZy5tX ZnvQ== X-Gm-Message-State: AOAM533e6T9JGpsU9LTbjUo6MQioxLojkN7AOmmc1bS4sSx06sltqZrF UeQvm1pigvRmYF0jiNTffqfTebLlo2Fv7A== X-Google-Smtp-Source: ABdhPJw922095Z0mHiQblhmUQO5Twh86teB7QGzcmpkOec9Tg74KHlspNYoESEqBQoaQsNWaysoFMw== X-Received: by 2002:a05:600c:5014:b0:381:6829:96bd with SMTP id n20-20020a05600c501400b00381682996bdmr661524wmr.123.1646242051063; Wed, 02 Mar 2022 09:27:31 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:30 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 01/15] tests: change some 'test $(git) = "x"' to test_cmp Date: Wed, 2 Mar 2022 18:27:10 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change some of the patterns in the test suite where we were hiding the exit code from "git" by invoking it in a sub-shell within a "test" expression to use temporary files and test_cmp instead. These are not all the occurrences of this anti-pattern, but these in particular hid issues where LSAN was dying, and I'd thus marked these tests as passing under the linux-leaks CI job in past commits with "TEST_PASSES_SANITIZE_LEAK=true". Let's deal with that by either removing that marking, or skipping specific tests under !SANITIZE_LEAK. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t0002-gitfile.sh | 6 ++++-- t/t2200-add-update.sh | 33 +++++++++++++++++++++------------ t/t4128-apply-root.sh | 33 ++++++++++++++++++++------------- t/t7103-reset-bare.sh | 7 +++++-- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh index 76052cb5620..f6356db183b 100755 --- a/t/t0002-gitfile.sh +++ b/t/t0002-gitfile.sh @@ -65,9 +65,11 @@ test_expect_success 'check commit-tree' ' test_path_is_file "$REAL/objects/$(objpath $SHA)" ' -test_expect_success 'check rev-list' ' +test_expect_success !SANITIZE_LEAK 'check rev-list' ' git update-ref "HEAD" "$SHA" && - test "$SHA" = "$(git rev-list HEAD)" + git rev-list HEAD >actual && + echo $SHA >expected && + test_cmp expected actual ' test_expect_success 'setup_git_dir twice in subdir' ' diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index acd3650d3c0..0c38f8e3569 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -14,7 +14,6 @@ only the updates to dir/sub. Also tested are "git add -u" without limiting, and "git add -u" without contents changes, and other conditions' -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success setup ' @@ -41,20 +40,28 @@ test_expect_success update ' ' test_expect_success 'update noticed a removal' ' - test "$(git ls-files dir1/sub1)" = "" + git ls-files dir1/sub1 >out && + test_must_be_empty out ' test_expect_success 'update touched correct path' ' - test "$(git diff-files --name-status dir2/sub3)" = "" + git diff-files --name-status dir2/sub3 >out && + test_must_be_empty out ' test_expect_success 'update did not touch other tracked files' ' - test "$(git diff-files --name-status check)" = "M check" && - test "$(git diff-files --name-status top)" = "M top" + echo "M check" >expect && + git diff-files --name-status check >actual && + test_cmp expect actual && + + echo "M top" >expect && + git diff-files --name-status top >actual && + test_cmp expect actual ' test_expect_success 'update did not touch untracked files' ' - test "$(git ls-files dir2/other)" = "" + git ls-files dir2/other >out && + test_must_be_empty out ' test_expect_success 'cache tree has not been corrupted' ' @@ -76,9 +83,8 @@ test_expect_success 'update from a subdirectory' ' ' test_expect_success 'change gets noticed' ' - - test "$(git diff-files --name-status dir1)" = "" - + git diff-files --name-status dir1 >out && + test_must_be_empty out ' test_expect_success 'non-qualified update in subdir updates from the root' ' @@ -103,7 +109,8 @@ test_expect_success 'replace a file with a symlink' ' test_expect_success 'add everything changed' ' git add -u && - test -z "$(git diff-files)" + git diff-files >out && + test_must_be_empty out ' @@ -111,7 +118,8 @@ test_expect_success 'touch and then add -u' ' touch check && git add -u && - test -z "$(git diff-files)" + git diff-files >out && + test_must_be_empty out ' @@ -119,7 +127,8 @@ test_expect_success 'touch and then add explicitly' ' touch check && git add check && - test -z "$(git diff-files)" + git diff-files >out && + test_must_be_empty out ' diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh index cb3181e8b71..ba89a2f2d73 100755 --- a/t/t4128-apply-root.sh +++ b/t/t4128-apply-root.sh @@ -2,8 +2,6 @@ test_description='apply same filename' - -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup' ' @@ -26,10 +24,11 @@ diff a/bla/blub/dir/file b/bla/blub/dir/file EOF test_expect_success 'apply --directory -p (1)' ' - git apply --directory=some/sub -p3 --index patch && - test Bello = $(git show :some/sub/dir/file) && - test Bello = $(cat some/sub/dir/file) + echo Bello >expect && + git show :some/sub/dir/file >actual && + test_cmp expect actual && + test_cmp expect some/sub/dir/file ' @@ -37,8 +36,10 @@ test_expect_success 'apply --directory -p (2) ' ' git reset --hard initial && git apply --directory=some/sub/ -p3 --index patch && - test Bello = $(git show :some/sub/dir/file) && - test Bello = $(cat some/sub/dir/file) + echo Bello >expect && + git show :some/sub/dir/file >actual && + test_cmp expect actual && + test_cmp expect some/sub/dir/file ' @@ -55,8 +56,10 @@ EOF test_expect_success 'apply --directory (new file)' ' git reset --hard initial && git apply --directory=some/sub/dir/ --index patch && - test content = $(git show :some/sub/dir/newfile) && - test content = $(cat some/sub/dir/newfile) + echo content >expect && + git show :some/sub/dir/newfile >actual && + test_cmp expect actual && + test_cmp expect some/sub/dir/newfile ' cat > patch << EOF @@ -72,8 +75,10 @@ EOF test_expect_success 'apply --directory -p (new file)' ' git reset --hard initial && git apply -p2 --directory=some/sub/dir/ --index patch && - test content = $(git show :some/sub/dir/newfile2) && - test content = $(cat some/sub/dir/newfile2) + echo content >expect && + git show :some/sub/dir/newfile2 >actual && + test_cmp expect actual && + test_cmp expect some/sub/dir/newfile2 ' cat > patch << EOF @@ -107,8 +112,10 @@ EOF test_expect_success 'apply --directory (quoted filename)' ' git reset --hard initial && git apply --directory=some/sub/dir/ --index patch && - test content = $(git show :some/sub/dir/quotefile) && - test content = $(cat some/sub/dir/quotefile) + echo content >expect && + git show :some/sub/dir/quotefile >actual && + test_cmp expect actual && + test_cmp expect some/sub/dir/quotefile ' test_done diff --git a/t/t7103-reset-bare.sh b/t/t7103-reset-bare.sh index 0de83e36199..a60153f9f32 100755 --- a/t/t7103-reset-bare.sh +++ b/t/t7103-reset-bare.sh @@ -63,9 +63,12 @@ test_expect_success '"mixed" reset is not allowed in bare' ' test_must_fail git reset --mixed HEAD^ ' -test_expect_success '"soft" reset is allowed in bare' ' +test_expect_success !SANITIZE_LEAK '"soft" reset is allowed in bare' ' git reset --soft HEAD^ && - test "$(git show --pretty=format:%s | head -n 1)" = "one" + git show --pretty=format:%s >out && + echo one >expect && + head -n 1 out >actual && + test_cmp expect actual ' test_done From patchwork Wed Mar 2 17:27:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766359 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61E6EC433EF for ; Wed, 2 Mar 2022 17:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243836AbiCBR2k (ORCPT ); Wed, 2 Mar 2022 12:28:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239047AbiCBR2a (ORCPT ); Wed, 2 Mar 2022 12:28:30 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A090DFC1 for ; Wed, 2 Mar 2022 09:27:33 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id q7-20020a7bce87000000b00382255f4ca9so3266112wmj.2 for ; Wed, 02 Mar 2022 09:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FNIF0q7ZDCVLWp1BceXWEHZ0G2K3UnMz0jLwN3DsKzI=; b=Y0xJR9VFLIpHkZonYVARttoac4NDh47Ky5ZoFX3FGMAxv1f4rQgI46F5OvOpMXmqJe PL5/fSBPBe/BCAUdp3PinnvuWKYlX/EZ7O4b2BVZIKAcFyTYByqkKHQGo9YBmceC2G/P bldd4NaWD8tXXcvwS4/4UJiMs8JnioZXMKB+xMpg2XocWuafiDZbsO/RnBHAR8xd77wF JC4ZcoyQAWD5Cx8PNGCG5yAaxBBXUYH4qo5zZfKb58uqdeKAazS/PGkhSnKpvHEHORMt TN4/K4xBVRrmAuqbLDzXhwZjzR1XrfJKoUpBAB5eP89O6zqerpP2PwyCvuMs2ZyJvxjO RS3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FNIF0q7ZDCVLWp1BceXWEHZ0G2K3UnMz0jLwN3DsKzI=; b=no5Z7WGq0CRhYj05FJ3RM/vw6FliHWWJ6TRBCEeErYM/i11j1lbMArAyQ26SXXuNwK ENURocP2Y/RYPth3AonVEQSb+s9ztnU5mGB2rTblENk+xP8zQQp0+0vbIncaVABLtJwX foWIMmG6NjBHeQNRfmAz3/NCchAjuyg3607UEIqX2TIxeZT6OeQZzgfYBByQQ2nTicXs LKtIP66G0ZKEOa/5Tuk7SnIsExLjwDQ28ugwJUyUMeAoM4BZPx0OSzHL+cZt2JBzjWw0 SnOWXpEPU3LFC0vu19Xz9zx10u7jbSbqA3Pwuiqylt1Yqafssi0SH8yhYAFfto4YX3ip ZuaQ== X-Gm-Message-State: AOAM531f1Gwz1HVbq6QALXItXtI6QSB3+3wr9Qwdm6y70gXD53KmNpGf cES0Uv7e0W1WNxA+llDgqlElczJE4lY+GQ== X-Google-Smtp-Source: ABdhPJx1AdaCofr5l6UqQpdXKV6pynpjc0r5Jk5ekZzfQ8PTF64anWXq5lrUwtNBfP/AqNAFH1sZkg== X-Received: by 2002:a1c:acc6:0:b0:380:e35f:ff1f with SMTP id v189-20020a1cacc6000000b00380e35fff1fmr715723wme.52.1646242051857; Wed, 02 Mar 2022 09:27:31 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:31 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 02/15] tests: use "test_stdout_line_count", not "test $(git [...] | wc -l)" Date: Wed, 2 Mar 2022 18:27:11 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Use the test_stdout_line_count helper added in cdff1bb5a3d (test-lib-functions: introduce test_stdout_line_count, 2021-07-04) so that we'll spot if git itself dies, segfaults etc in these expressions. Because we didn't distinguish these failure conditions before I'd mistakenly marked these tests as passing under SANITIZE=leak in dd9cede9136 (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31). While we're at it let's re-indent these lines to match our usual style, as we're having to change all of them anyway. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t6005-rev-list-count.sh | 43 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/t/t6005-rev-list-count.sh b/t/t6005-rev-list-count.sh index 86542c650e2..e960049f647 100755 --- a/t/t6005-rev-list-count.sh +++ b/t/t6005-rev-list-count.sh @@ -2,7 +2,6 @@ test_description='git rev-list --max-count and --skip test' -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup' ' @@ -14,39 +13,39 @@ test_expect_success 'setup' ' ' test_expect_success 'no options' ' - test $(git rev-list HEAD | wc -l) = 5 + test_stdout_line_count = 5 git rev-list HEAD ' test_expect_success '--max-count' ' - test $(git rev-list HEAD --max-count=0 | wc -l) = 0 && - test $(git rev-list HEAD --max-count=3 | wc -l) = 3 && - test $(git rev-list HEAD --max-count=5 | wc -l) = 5 && - test $(git rev-list HEAD --max-count=10 | wc -l) = 5 + test_stdout_line_count = 0 git rev-list HEAD --max-count=0 && + test_stdout_line_count = 3 git rev-list HEAD --max-count=3 && + test_stdout_line_count = 5 git rev-list HEAD --max-count=5 && + test_stdout_line_count = 5 git rev-list HEAD --max-count=10 ' test_expect_success '--max-count all forms' ' - test $(git rev-list HEAD --max-count=1 | wc -l) = 1 && - test $(git rev-list HEAD -1 | wc -l) = 1 && - test $(git rev-list HEAD -n1 | wc -l) = 1 && - test $(git rev-list HEAD -n 1 | wc -l) = 1 + test_stdout_line_count = 1 git rev-list HEAD --max-count=1 && + test_stdout_line_count = 1 git rev-list HEAD -1 && + test_stdout_line_count = 1 git rev-list HEAD -n1 && + test_stdout_line_count = 1 git rev-list HEAD -n 1 ' test_expect_success '--skip' ' - test $(git rev-list HEAD --skip=0 | wc -l) = 5 && - test $(git rev-list HEAD --skip=3 | wc -l) = 2 && - test $(git rev-list HEAD --skip=5 | wc -l) = 0 && - test $(git rev-list HEAD --skip=10 | wc -l) = 0 + test_stdout_line_count = 5 git rev-list HEAD --skip=0 && + test_stdout_line_count = 2 git rev-list HEAD --skip=3 && + test_stdout_line_count = 0 git rev-list HEAD --skip=5 && + test_stdout_line_count = 0 git rev-list HEAD --skip=10 ' test_expect_success '--skip --max-count' ' - test $(git rev-list HEAD --skip=0 --max-count=0 | wc -l) = 0 && - test $(git rev-list HEAD --skip=0 --max-count=10 | wc -l) = 5 && - test $(git rev-list HEAD --skip=3 --max-count=0 | wc -l) = 0 && - test $(git rev-list HEAD --skip=3 --max-count=1 | wc -l) = 1 && - test $(git rev-list HEAD --skip=3 --max-count=2 | wc -l) = 2 && - test $(git rev-list HEAD --skip=3 --max-count=10 | wc -l) = 2 && - test $(git rev-list HEAD --skip=5 --max-count=10 | wc -l) = 0 && - test $(git rev-list HEAD --skip=10 --max-count=10 | wc -l) = 0 + test_stdout_line_count = 0 git rev-list HEAD --skip=0 --max-count=0 && + test_stdout_line_count = 5 git rev-list HEAD --skip=0 --max-count=10 && + test_stdout_line_count = 0 git rev-list HEAD --skip=3 --max-count=0 && + test_stdout_line_count = 1 git rev-list HEAD --skip=3 --max-count=1 && + test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=2 && + test_stdout_line_count = 2 git rev-list HEAD --skip=3 --max-count=10 && + test_stdout_line_count = 0 git rev-list HEAD --skip=5 --max-count=10 && + test_stdout_line_count = 0 git rev-list HEAD --skip=10 --max-count=10 ' test_done From patchwork Wed Mar 2 17:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25587C433F5 for ; Wed, 2 Mar 2022 17:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243844AbiCBR3B (ORCPT ); Wed, 2 Mar 2022 12:29:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243831AbiCBR2a (ORCPT ); Wed, 2 Mar 2022 12:28:30 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29C93DF9B for ; Wed, 2 Mar 2022 09:27:34 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id q7-20020a7bce87000000b00382255f4ca9so3266162wmj.2 for ; Wed, 02 Mar 2022 09:27:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZxKgkV3DVbuKgapAZ1Rbuk7060U/0rZJjX6KXsUJmGo=; b=P9JZpuMgyIJ+RtXNexs1MWbrIuJ2bD96w4bTPOZgkw1LF+ipOsn7DqwP+rhzTPf9dZ zj4UX2lurxmnYFQvc3qRt39GGnA28QVB8744FGSHlcOGbbCXyTVx5HcyEYL0M6x4FhIB 4DaoICQHXbgFWCLdVw4FU6+W8ydWxkr2rvi1HgFxUVMZ3ExW3EtnDDbruuEtQGWmD3gG 0vWBXp81tc2n0JCbXdVtoTY4oncOUzyRiNheVyOVDM7ogOJgKpsZ+k3Q4H2zEsFFLLxc 02nggMytbgUzqFRnbim72QHcOtC2OblBJqzXdmPEPI1Usx6R2iHD7d4ctluH3pWOWEz7 e5kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZxKgkV3DVbuKgapAZ1Rbuk7060U/0rZJjX6KXsUJmGo=; b=TS4cljHGVUDZ89Ysie49OV89FgjEJUcx+6AxwRF/VEfv237A+g4EIO+LoY0Wjo/L3K b8z9M8wXHQNNBmyGZOVeWLI7cQ5lE2zYIVmjL6bcEe7U2G0PQmzJ2JiqHCAA1RQjph8U F1/N0YLG7TQYO/2MqMl6uOEsAHwqSP3OBnbkJWP+njfuJjaqWuXJV1DuLORbP3YMNjLC wIhFCYHfAgtFRTa6ZRLk6xFya+04LEVTIZUGwOl3d+rSDwom6HnYip3bt8lA06EyqTRt KGIrwIV3/+2PSS5yb6FG6Imr4D6UjNSBxC2dmM1fCRLmYnvvtnrhvb2wIDpiMg35PXWE KuBA== X-Gm-Message-State: AOAM532c7BxSIw4mnLPFSu9GrS+lM7PikSUcDbxhEqdT9QPvfssr4k0E LHCXIroV3NyOkpRpxh4BbVMXXi2R3FKU4Q== X-Google-Smtp-Source: ABdhPJzTkdsqdjscPN7hA+ZN1hFDVVnIT84v6dbqHBRW//VSwvxTsicN0KpibcRdUbWvFZQ8paySNA== X-Received: by 2002:a7b:ce83:0:b0:37b:f1f1:3a0c with SMTP id q3-20020a7bce83000000b0037bf1f13a0cmr698273wmj.10.1646242052660; Wed, 02 Mar 2022 09:27:32 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:32 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 03/15] read-tree tests: check "diff-files" exit code on failure Date: Wed, 2 Mar 2022 18:27:12 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix an issue with the exit code of "diff-files" being ignored, which has been ignored ever since these tests were originally added in c859600954d ([PATCH] read-tree: save more user hassles during fast-forward., 2005-06-07). Since the exit code was ignored we'd hide errors here under SANITIZE=leak, which resulted in me mistakenly marking these tests as passing under SANITIZE=leak in e5a917fcf42 (unpack-trees: don't leak memory in verify_clean_subdirectory(), 2021-10-07) and 4ea08416b8e (leak tests: mark a read-tree test as passing SANITIZE=leak, 2021-10-31). As it would be non-trivial to fix these tests (the leak is in revision.c) let's un-mark them as passing under SANITIZE=leak in addition to fixing the issue of ignoring the exit code. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t1001-read-tree-m-2way.sh | 6 +++--- t/t1002-read-tree-m-u-2way.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh index d1115528cb9..0710b1fb1e9 100755 --- a/t/t1001-read-tree-m-2way.sh +++ b/t/t1001-read-tree-m-2way.sh @@ -21,7 +21,6 @@ In the test, these paths are used: yomin - not in H or M ' -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh @@ -38,11 +37,12 @@ compare_change () { } check_cache_at () { - clean_if_empty=$(git diff-files -- "$1") + git diff-files -- "$1" >out && + clean_if_empty=$(cat out) && case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; - esac + esac && case "$2,$clean_if_empty" in clean,) : ;; clean,?*) false ;; diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index ca5c5510c73..46cbd5514a6 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -9,7 +9,6 @@ This is identical to t1001, but uses -u to update the work tree as well. ' -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-read-tree.sh @@ -23,11 +22,12 @@ compare_change () { } check_cache_at () { - clean_if_empty=$(git diff-files -- "$1") + git diff-files -- "$1" >out && + clean_if_empty=$(cat out) && case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; - esac + esac && case "$2,$clean_if_empty" in clean,) : ;; clean,?*) false ;; From patchwork Wed Mar 2 17:27:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766371 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 988CEC4332F for ; Wed, 2 Mar 2022 17:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241805AbiCBR3H (ORCPT ); Wed, 2 Mar 2022 12:29:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243847AbiCBR23 (ORCPT ); Wed, 2 Mar 2022 12:28:29 -0500 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29BF6DF9A for ; Wed, 2 Mar 2022 09:27:35 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 19so1327934wmy.3 for ; Wed, 02 Mar 2022 09:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1edbebZXhnVH1I/m7MAQDheXpzx9CjcZTWDifU35E0U=; b=SAPzM2elc5CCNqWiCApllUUxxlljcp7QDLigTiAIGbiVOno2nOz6fgXaRyCDbcidzj DaRpmHZUNhIZPVp33ZNQ5Iuw8OwWyTYhWqpMZJId9zo0nyXmj+M4Z6MdE3XRdtvPM20N MtzhYlFKYDyr4OCu19gfmzHPG69tW8i/2lr5kn3LS6f/1UqeQVW8B4g18E7aA/ucXMBY D7dqsuAZ+2ANAwpY8xpCPnrKkdUwC5UsNvqOfNt67t/BlsB276EWGoje+gLp9DYRONk+ aLM7svn2sa+NsAr1RhSQcoNAeSp9Gkljj+KudhQfKZB9kACX49BILj1ozvfX5ndB4dhM hZLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1edbebZXhnVH1I/m7MAQDheXpzx9CjcZTWDifU35E0U=; b=1Q93cu/KbSfZHKoXz379P7PYKuXiRS3QSVyj+XeXZXjsF/8+CBdEZVl/4uAM5R0/9z 4LKJ8zWZJC1F74zjZhu2pd/+V1tzE0y7nF7m2k3buWlkrt4Ccvu3KVeQ0wetMJme/4Dx 5SJ56mv5YergMF7UJGSx0JSZ/se++Fs46xPvtLUavzprBTt3xUJjGRhtuqUzl2LTFBWC 3FMzyZ7TsVEfQYXB3EYUOzFbh/z9EL5RbLLu45H6NYw6XjaLwyfwNq2KMC6zOc8C0HHV Iil3FNQGDQGh0a4WPG+dZ9maenCvCsDiZ1jXLPZ7YJKCGk/aPz513MxJt9rLfY5iqCcM A3Hw== X-Gm-Message-State: AOAM532FAALY7eKHHgjcpznCvetQgmoX1j4e+5sll6V8wEQlAiDHWbfz Lu5HKtESuJwHUhmfycuDbI+QV+bRwcGzBg== X-Google-Smtp-Source: ABdhPJyZ6+R4/bJOvCXnkhnAq4su+UN3V8ALoz1sum/Q8POu/PufIeDkBXzmi8FqMKr4ZqAH67whqg== X-Received: by 2002:a05:600c:508:b0:380:fd39:2c42 with SMTP id i8-20020a05600c050800b00380fd392c42mr664034wmc.178.1646242053510; Wed, 02 Mar 2022 09:27:33 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:32 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 04/15] diff tests: don't ignore "git diff" exit code Date: Wed, 2 Mar 2022 18:27:13 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix a test pattern that originated in f1af60bdba4 (Support 'diff=pgm' attribute, 2007-04-22) so that we'll stop using "git diff" on the left-hand-side of a pipe, and thus ignoring its exit code. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4020-diff-external.sh | 49 ++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 54bb8ef27e7..879ee04d291 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -37,17 +37,15 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment' ' ' -test_expect_success 'GIT_EXTERNAL_DIFF environment should apply only to diff' ' - - GIT_EXTERNAL_DIFF=echo git log -p -1 HEAD | - grep "^diff --git a/file b/file" +test_expect_success !SANITIZE_LEAK 'GIT_EXTERNAL_DIFF environment should apply only to diff' ' + GIT_EXTERNAL_DIFF=echo git log -p -1 HEAD >out && + grep "^diff --git a/file b/file" out ' test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' ' - - GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff | - grep "^diff --git a/file b/file" + GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff >out && + grep "^diff --git a/file b/file" out ' @@ -83,16 +81,16 @@ test_expect_success 'diff.external' ' } ' -test_expect_success 'diff.external should apply only to diff' ' +test_expect_success !SANITIZE_LEAK 'diff.external should apply only to diff' ' test_config diff.external echo && - git log -p -1 HEAD | - grep "^diff --git a/file b/file" + git log -p -1 HEAD >out && + grep "^diff --git a/file b/file" out ' test_expect_success 'diff.external and --no-ext-diff' ' test_config diff.external echo && - git diff --no-ext-diff | - grep "^diff --git a/file b/file" + git diff --no-ext-diff >out && + grep "^diff --git a/file b/file" out ' test_expect_success 'diff attribute' ' @@ -115,17 +113,15 @@ test_expect_success 'diff attribute' ' ' -test_expect_success 'diff attribute should apply only to diff' ' - - git log -p -1 HEAD | - grep "^diff --git a/file b/file" +test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' ' + git log -p -1 HEAD >out && + grep "^diff --git a/file b/file" out ' test_expect_success 'diff attribute and --no-ext-diff' ' - - git diff --no-ext-diff | - grep "^diff --git a/file b/file" + git diff --no-ext-diff >out && + grep "^diff --git a/file b/file" out ' @@ -148,17 +144,15 @@ test_expect_success 'diff attribute' ' ' -test_expect_success 'diff attribute should apply only to diff' ' - - git log -p -1 HEAD | - grep "^diff --git a/file b/file" +test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' ' + git log -p -1 HEAD >out && + grep "^diff --git a/file b/file" out ' test_expect_success 'diff attribute and --no-ext-diff' ' - - git diff --no-ext-diff | - grep "^diff --git a/file b/file" + git diff --no-ext-diff >out && + grep "^diff --git a/file b/file" out ' @@ -177,7 +171,8 @@ test_expect_success 'attributes trump GIT_EXTERNAL_DIFF and diff.external' ' test_expect_success 'no diff with -diff' ' echo >.gitattributes "file -diff" && - git diff | grep Binary + git diff >out && + grep Binary out ' echo NULZbetweenZwords | perl -pe 'y/Z/\000/' > file From patchwork Wed Mar 2 17:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766360 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1CFFC433FE for ; Wed, 2 Mar 2022 17:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243865AbiCBR2n (ORCPT ); Wed, 2 Mar 2022 12:28:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243837AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D81DFB8 for ; Wed, 2 Mar 2022 09:27:35 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id i8so3896568wrr.8 for ; Wed, 02 Mar 2022 09:27:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=37n3U3cASYystLlv+L5dlRBXBl9W6X/QMZRmlX/BCY8=; b=Ty3XEYkcHyanE/BY6SVJpzFtb1/i/cJQ5Dc7K+SqT+tfPVIZw1ZKKOGKC6v7zRsYf1 pHCuwoospi0xEmwV3x4eA3DSxUp58n911feOYb1/CP7GPUufuj+lqPXUj7LXfbmahQef WimcEphYTstRfji5yc3OxdTU8oCFl9VNXJciBQLUHZA4gTXjVBTFwbPzj00LEzdD2zhb rqPnOdWBN6czsnPH6rMjFNZ2/crSHLOkAkm61pUZ9wF4LVT8INc4PwDFRTnc8eAx/RzQ hVj6zFluiJABKDtn3RoaL+NeGfjwKADEX0jRvZhzxISYfW2OdwfkS49US691O60rnczM s+rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=37n3U3cASYystLlv+L5dlRBXBl9W6X/QMZRmlX/BCY8=; b=OweZ7u4WfsQVQ85c0acT+Oy5Ds6q1Fywa7YoLoPhWtdUq6nvaY2eIReC81cztS82Vx hyztMpFxHxbmt8XWEZ3E6xkC+ntW8M6nvsyEF28DJDgX7IMRoqefybIt+HyJcpGCJB5D RMfCAaHXKLesW2+FSAx350tXa1/v2ZfYy9BVE7190te/3A/JGMa+C0vPs9blc7V7YhwF QbTadM+irigKMtCWuQlREnmOYEYrB+gQRhVFGl+M12GOSpAJtXsNTtXiha4gb/L7/GrS I40zjdJPnoQOWbefukwTjOywzFUnQhQHsMYbr95prHLLtjZz9uFzE5otciQjEjvDT/FQ NQng== X-Gm-Message-State: AOAM531Mog6THdSJt/4n+oSO1+V0qcRpV2mPOruIutBITLOnimWuW0xq BbfpmOdztAT4nLvvNYhScz0kR+RNdDt/bQ== X-Google-Smtp-Source: ABdhPJyWOwt2AAZ63/DlahEupFqbOsCXKfe8/ZVxzxOx0jEp6S/Jw7uXRNl2MjbFiBImLIIXKc4sdA== X-Received: by 2002:adf:c10b:0:b0:1ed:c40f:7f91 with SMTP id r11-20020adfc10b000000b001edc40f7f91mr23709167wre.276.1646242054377; Wed, 02 Mar 2022 09:27:34 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:33 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 05/15] diff tests: don't ignore "git diff" exit code in "read" loop Date: Wed, 2 Mar 2022 18:27:14 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix a test pattern that originated in f1af60bdba4 (Support 'diff=pgm' attribute, 2007-04-22) so that we'll stop using "git diff" on the left-hand-side of a pipe, and thus ignoring its exit code. Rather than use intermediate files let's rewrite these tests to a much simpler but more exhaustive "test_tmp" where we'll ignore certain fields in the output. Note that this is not a faithful conversion of the previous "read/test" in some cases, as we were ignoring more fields there than we strictly needed to. Now we'll "test_cmp" everything we can, and only ignore the likes of paths to $TEMPDIR etc. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4020-diff-external.sh | 104 ++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index 879ee04d291..1219f8bd4c0 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -24,16 +24,12 @@ test_expect_success setup ' ' test_expect_success 'GIT_EXTERNAL_DIFF environment' ' - - GIT_EXTERNAL_DIFF=echo git diff | { - read path oldfile oldhex oldmode newfile newhex newmode && - test "z$path" = zfile && - test "z$oldmode" = z100644 && - test "z$newhex" = "z$ZERO_OID" && - test "z$newmode" = z100644 && - oh=$(git rev-parse --verify HEAD:file) && - test "z$oh" = "z$oldhex" - } + cat >expect <<-EOF && + file $(git rev-parse --verify HEAD:file) 100644 file $(test_oid zero) 100644 + EOF + GIT_EXTERNAL_DIFF=echo git diff >out && + cut -d" " -f1,3- actual && + test_cmp expect actual ' @@ -52,15 +48,14 @@ test_expect_success 'GIT_EXTERNAL_DIFF environment and --no-ext-diff' ' test_expect_success SYMLINKS 'typechange diff' ' rm -f file && ln -s elif file && - GIT_EXTERNAL_DIFF=echo git diff | { - read path oldfile oldhex oldmode newfile newhex newmode && - test "z$path" = zfile && - test "z$oldmode" = z100644 && - test "z$newhex" = "z$ZERO_OID" && - test "z$newmode" = z120000 && - oh=$(git rev-parse --verify HEAD:file) && - test "z$oh" = "z$oldhex" - } && + + cat >expect <<-EOF && + file $(git rev-parse --verify HEAD:file) 100644 $(test_oid zero) 120000 + EOF + GIT_EXTERNAL_DIFF=echo git diff >out && + cut -d" " -f1,3-4,6- actual && + test_cmp expect actual && + GIT_EXTERNAL_DIFF=echo git diff --no-ext-diff >actual && git diff >expect && test_cmp expect actual @@ -70,15 +65,13 @@ test_expect_success 'diff.external' ' git reset --hard && echo third >file && test_config diff.external echo && - git diff | { - read path oldfile oldhex oldmode newfile newhex newmode && - test "z$path" = zfile && - test "z$oldmode" = z100644 && - test "z$newhex" = "z$ZERO_OID" && - test "z$newmode" = z100644 && - oh=$(git rev-parse --verify HEAD:file) && - test "z$oh" = "z$oldhex" - } + + cat >expect <<-EOF && + file $(git rev-parse --verify HEAD:file) 100644 $(test_oid zero) 100644 + EOF + git diff >out && + cut -d" " -f1,3-4,6- actual && + test_cmp expect actual ' test_expect_success !SANITIZE_LEAK 'diff.external should apply only to diff' ' @@ -101,16 +94,12 @@ test_expect_success 'diff attribute' ' echo >.gitattributes "file diff=parrot" && - git diff | { - read path oldfile oldhex oldmode newfile newhex newmode && - test "z$path" = zfile && - test "z$oldmode" = z100644 && - test "z$newhex" = "z$ZERO_OID" && - test "z$newmode" = z100644 && - oh=$(git rev-parse --verify HEAD:file) && - test "z$oh" = "z$oldhex" - } - + cat >expect <<-EOF && + file $(git rev-parse --verify HEAD:file) 100644 $(test_oid zero) 100644 + EOF + git diff >out && + cut -d" " -f1,3-4,6- actual && + test_cmp expect actual ' test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' ' @@ -132,16 +121,12 @@ test_expect_success 'diff attribute' ' echo >.gitattributes "file diff=color" && - git diff | { - read path oldfile oldhex oldmode newfile newhex newmode && - test "z$path" = zfile && - test "z$oldmode" = z100644 && - test "z$newhex" = "z$ZERO_OID" && - test "z$newmode" = z100644 && - oh=$(git rev-parse --verify HEAD:file) && - test "z$oh" = "z$oldhex" - } - + cat >expect <<-EOF && + file $(git rev-parse --verify HEAD:file) 100644 $(test_oid zero) 100644 + EOF + git diff >out && + cut -d" " -f1,3-4,6- actual && + test_cmp expect actual ' test_expect_success !SANITIZE_LEAK 'diff attribute should apply only to diff' ' @@ -159,14 +144,26 @@ test_expect_success 'diff attribute and --no-ext-diff' ' test_expect_success 'GIT_EXTERNAL_DIFF trumps diff.external' ' >.gitattributes && test_config diff.external "echo ext-global" && - GIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-env + + cat >expect <<-EOF && + ext-env file $(git rev-parse --verify HEAD:file) 100644 file $(test_oid zero) 100644 + EOF + GIT_EXTERNAL_DIFF="echo ext-env" git diff >out && + cut -d" " -f1-2,4- actual && + test_cmp expect actual ' test_expect_success 'attributes trump GIT_EXTERNAL_DIFF and diff.external' ' test_config diff.foo.command "echo ext-attribute" && test_config diff.external "echo ext-global" && echo "file diff=foo" >.gitattributes && - GIT_EXTERNAL_DIFF="echo ext-env" git diff | grep ext-attribute + + cat >expect <<-EOF && + ext-attribute file $(git rev-parse --verify HEAD:file) 100644 file $(test_oid zero) 100644 + EOF + GIT_EXTERNAL_DIFF="echo ext-env" git diff >out && + cut -d" " -f1-2,4- actual && + test_cmp expect actual ' test_expect_success 'no diff with -diff' ' @@ -212,7 +209,12 @@ test_expect_success 'GIT_EXTERNAL_DIFF generates pretty paths' ' touch file.ext && git add file.ext && echo with extension > file.ext && - GIT_EXTERNAL_DIFF=echo git diff file.ext | grep ......_file\.ext && + + cat >expect <<-EOF && + file.ext file $(git rev-parse --verify HEAD:file) 100644 file.ext $(test_oid zero) 100644 + EOF + GIT_EXTERNAL_DIFF=echo git diff file.ext >out && + cut -d" " -f1,3- actual && git update-index --force-remove file.ext && rm file.ext ' From patchwork Wed Mar 2 17:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766370 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33B11C433F5 for ; Wed, 2 Mar 2022 17:28:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243831AbiCBR3F (ORCPT ); Wed, 2 Mar 2022 12:29:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240774AbiCBR2a (ORCPT ); Wed, 2 Mar 2022 12:28:30 -0500 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A176DFCE for ; Wed, 2 Mar 2022 09:27:36 -0800 (PST) Received: by mail-wm1-x32a.google.com with SMTP id a5-20020a05600c224500b003832be89f25so1712517wmm.2 for ; Wed, 02 Mar 2022 09:27:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LVhMduWjY0+ZV5ohOgkGQuyvuX3pmF6ixfLxtAgmbd4=; b=lg8dvEwAn3pcMTAvhFnRGadDhQ3ivzSxdRyMxriQTxjIDW1PsfauqvT3HIz92zte3a 2vySf6mumzgU/vGGs+8sM4BnvmFNaGnprGjy9qJlCawNOsMZU48N9BH5BBgK9AE5fjTG j1JSUqL/3Botllj7ozSCbaxADFaN7lCD8EwDdwtQnYm9lpeGC0Nj+7qHku6vNcwvlxf1 sN9Rb1F6T/0t3zTdO+ksMg5KVD9RSRTZ7vVWIlADx3dO1H8gjJHO82fl2L4wZPQIqjKt pSwxV+LM2re8Bj5XglXzo2nw2M8Frk2WkUsmdgVGXm0AVr4xnGjnzh7hXw1aydBxk1bO 28Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LVhMduWjY0+ZV5ohOgkGQuyvuX3pmF6ixfLxtAgmbd4=; b=ZBi9DCqoj4lOLFya/82khzzF2V6NLi5M3IvckqXDcDAlSjvPaUxNyuIZ/ULcnsqgcT UxnckNIgOXQvcme2/rLRS4YyLopoMSug73YU+Hbmd1yLTTulL2idp2cGKMk3MwMC+hPf fMHNGVdWiemqYGXT0WzgbxM/3EEkS8Kj39uK5qUKxOe9bQbz6Pd3zH2q60mwgr9d/skz FuoG4l8QKYe60JP66CVC/ldE5y6N0wW8Dsr64Xo32czcRINnDFu87bx9ef+ozjP1IBMQ RMXE0HUIUttBKomcapGSvl9y1qSRFRb0vCwnIyWJPT1J9AquLgqwD5suwI3E8a0HrpzB b8Sg== X-Gm-Message-State: AOAM530woCPcbZwQYJLutoQ8Hy2fw/MeNWWjaKC05xbRP7gSeUAoLUav Op9Y4eF3fxMz5tTrge65LzqBfS8ZbNu4hw== X-Google-Smtp-Source: ABdhPJwkXfFHFBSBzQIBBe6pv2zG8JRH13SjsPKpQasRyiWzHu9oSYfk5sN5nRvm3hmsQiTjGbbd7w== X-Received: by 2002:a1c:a382:0:b0:381:cfd:5564 with SMTP id m124-20020a1ca382000000b003810cfd5564mr664592wme.103.1646242055204; Wed, 02 Mar 2022 09:27:35 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:34 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 06/15] apply tests: use "test_must_fail" instead of ad-hoc pattern Date: Wed, 2 Mar 2022 18:27:15 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a fragile test pattern introduced in 6b763c424e4 (git-apply: do not read past the end of buffer, 2007-09-05). Before this we wouldn't distinguish normal "git apply" failures from segfaults or abort(). I'd previously marked this test as passing under SANITIZE=leak in f54f48fc074 (leak tests: mark some apply tests as passing with SANITIZE=leak, 2021-10-31). Let's remove that annotation as this test will no longer pass. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4123-apply-shrink.sh | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/t/t4123-apply-shrink.sh b/t/t4123-apply-shrink.sh index dfa053ff28e..3ef84619f53 100755 --- a/t/t4123-apply-shrink.sh +++ b/t/t4123-apply-shrink.sh @@ -2,8 +2,6 @@ test_description='apply a patch that is larger than the preimage' - -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh cat >F <<\EOF @@ -41,20 +39,8 @@ test_expect_success setup ' ' test_expect_success 'apply should fail gracefully' ' - - if git apply --index patch - then - echo Oops, should not have succeeded - false - else - status=$? && - echo "Status was $status" && - if test -f .git/index.lock - then - echo Oops, should not have crashed - false - fi - fi + test_must_fail git apply --index patch && + test_path_is_missing .git/index.lock ' test_done From patchwork Wed Mar 2 17:27:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766356 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36101C433EF for ; Wed, 2 Mar 2022 17:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236799AbiCBR2d (ORCPT ); Wed, 2 Mar 2022 12:28:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243855AbiCBR23 (ORCPT ); Wed, 2 Mar 2022 12:28:29 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A29BDFD1 for ; Wed, 2 Mar 2022 09:27:37 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id bk29so3913346wrb.4 for ; Wed, 02 Mar 2022 09:27:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bE6yg5we+dT02JER2NCqX+0HDyVKP3s4uZWCawKiZIU=; b=FqJ9jdHiKJsA40sF3hnExQrgvl0r9mZxtH4HNqOD535QmujtHtci2l8ZP3JQv5kxlY 4jnCLWbzxSLQxm4kHhk1UYOyP0zBovTGnp//kDJ+YKld+h4tondVBLvslANynjLDCjyQ qAKOmv0fIBTpaRorzSxld87fbI2Vnw+XdAvMvqjqLAqP8QYjQJqmaajhVdFFo2FwlDnv EHgPTz8od5peR1guLDX23QedTnCQ7IlBPag7YEWTdQj+rrKK2+C/TIbz99BxH3y5AZ+2 cosVZYKXq3gfRY8HI7qu4ZLGQmCAzPhyE5dfgPrmlfbYXXuUEF8/ohqQrsv0YcyA0bEq XeEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bE6yg5we+dT02JER2NCqX+0HDyVKP3s4uZWCawKiZIU=; b=PKsHg6fdQbxf+A4dnPsO06OK8jT/yG+iOoyKNDRNsu/BVysB8K3AfLBXaQsIde5g10 Mx2KzcWgv6GN00lS3KdEJP24KCwioo09eBSftqmei7YZCgljAxKPN+6OesuBBF+1YYls a6OtWkvCi8uJKSiV0AyM18p7MOcneXnmCsVDTQyFBm9O9XUeZyxR+6/HmI8qJHV7qvd/ +K1F8LKf1M7yCRTd4gq16yVsKg0XULlfstwr2T3vrIVwfwzrubHkBXQA1hoftMWrBD5C HFKco4EDjzGBHmlE/0uORpKs9GmNS8l1E5lTnQoQpy3IUsDpRtS2cTyh38jzkiIKMYuw puwA== X-Gm-Message-State: AOAM530WBScA7A28bD6d4qx3Cfnf0ganSuOG7I8qxUwW0AswJeFhX84O vxvvstF+hNW2ctuud+aeA5W7IWutxxYD7Q== X-Google-Smtp-Source: ABdhPJx4+NomLk6TxQU5Jh5KS75PA+4XDo2PrH+PEg3F1Yi0ywHKCU9j+yNpSx2hQzq1FiRTeBT51g== X-Received: by 2002:a5d:4310:0:b0:1ef:fb60:e1d8 with SMTP id h16-20020a5d4310000000b001effb60e1d8mr8466785wrq.92.1646242056047; Wed, 02 Mar 2022 09:27:36 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:35 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 07/15] merge tests: use "test_must_fail" instead of ad-hoc pattern Date: Wed, 2 Mar 2022 18:27:16 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As in the preceding commit change a similar fragile test pattern introduced in b798671fa93 (merge-recursive: do not rudely die on binary merge, 2007-08-14) to use a "test_must_fail" instead. Before this we wouldn't distinguish normal "git merge" failures from segfaults or abort(). Unlike the preceding commit we didn't end up hiding any SANITIZE=leak failures in this case, but let's correspondingly change these anyway. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t6407-merge-binary.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/t/t6407-merge-binary.sh b/t/t6407-merge-binary.sh index 8e6241f92e6..0753fc95f45 100755 --- a/t/t6407-merge-binary.sh +++ b/t/t6407-merge-binary.sh @@ -43,14 +43,9 @@ test_expect_success resolve ' rm -f a* m* && git reset --hard anchor && - if git merge -s resolve main - then - echo Oops, should not have succeeded - false - else - git ls-files -s >current && - test_cmp expect current - fi + test_must_fail git merge -s resolve main && + git ls-files -s >current && + test_cmp expect current ' test_expect_success recursive ' @@ -58,14 +53,9 @@ test_expect_success recursive ' rm -f a* m* && git reset --hard anchor && - if git merge -s recursive main - then - echo Oops, should not have succeeded - false - else - git ls-files -s >current && - test_cmp expect current - fi + test_must_fail git merge -s recursive main && + git ls-files -s >current && + test_cmp expect current ' test_done From patchwork Wed Mar 2 17:27:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766358 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F0BCC433EF for ; Wed, 2 Mar 2022 17:27:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243937AbiCBR2i (ORCPT ); Wed, 2 Mar 2022 12:28:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243861AbiCBR2a (ORCPT ); Wed, 2 Mar 2022 12:28:30 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1825FD16 for ; Wed, 2 Mar 2022 09:27:38 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id r65so1604895wma.2 for ; Wed, 02 Mar 2022 09:27:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6VyXf7EcgSc6ABJcoZBJLd6bY76SpfXGUQYhq5MpIR0=; b=OOqxnI+pXtbO2xAzbPbtk6L/CRT6/xL/NMAc2tqFYwd//mnkSALiDgXCeAHzlrSwYW 6juZkhMJdUhSne8NTLttzjYl2+GWYBrh25mX432OYEgDWJYvVpYayXSs4E01lzu5lgpK EH4MADMZ+EGOYz8O72GazD+CFI/9gSU7NWyfuGOZGNlZUTFfNO9mgTYNrCzBdyJycna6 uCAjrQ1E3wBCi6SbjYZEQh08P8dKdVBCJRKnkZAdtipphIM9a1CTFs4XT/j1OLK93IG8 xx+Uc6j3oWXVFD3J3MVkgyFm0PTjPukuO7G8xeAx/klHAd7997qPoVceBrRlpfqndzNA Vy6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6VyXf7EcgSc6ABJcoZBJLd6bY76SpfXGUQYhq5MpIR0=; b=xRHbmQsfFZnwGoxXW2S2eQoHcqMlk3eYdJZjWHHpXSaNEVCraK8hXwzJmZmRCuf1lH 1Q/yAstLM+egIEUfjckMnRKFr7jMliAi9FHe00N2Pqyhg5ulN+9v2vjr+uvJBSzoJHVY 4CmyAgXoVb5fRkml6eLIfR4E3b8z4eoNKYS1ssReqD2Lr0hzB6lrbhRHsT53LblRYyVT qXf6pk0ZIJdwDVjzhA+WTB/spIZY3o/pw1sd3uu2XFdkq5m6dFHlIv8ctlWhae2sTfMB cJOjiNJGQEnaHb6pWFQW48TOuG5k1dzSfTOUvv6zyWN12ZFvzlH0abeNPdcn/paoYDLa ocKg== X-Gm-Message-State: AOAM530XZiQG1Rn8EDaiX3KkzAIyYXG2lydDbfIqdzUC+L7iqFSPzSDx E/5wd0iJLUDWWBmqogjmZW+Lihrg8oHuTQ== X-Google-Smtp-Source: ABdhPJxUrWf9Kx2dIQ8o4guWkL/XKJ8QGS8dwLWWX8xS2yI4Kegt14TkgEFDrheOh2wAVNQItRchkg== X-Received: by 2002:a05:600c:4fc4:b0:37c:9116:ef3d with SMTP id o4-20020a05600c4fc400b0037c9116ef3dmr649796wmq.167.1646242056994; Wed, 02 Mar 2022 09:27:36 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:36 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 08/15] rev-parse tests: don't ignore "git reflog" exit code Date: Wed, 2 Mar 2022 18:27:17 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Amend a test added in 9c46c054ae4 (rev-parse: tests git rev-parse --verify master@{n}, for various n, 2010-08-24) so that we'll stop ignoring the exit code of "git reflog" by having it on the left-hand-side of a pipe. Because of this I'd marked this test as passing under SANITIZE=leak in f442c94638d (leak tests: mark some rev-parse tests as passing with SANITIZE=leak, 2021-10-31). As all of it except this specific test will now pass, let's skip it under the !SANITIZE_LEAK prerequisite. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t1503-rev-parse-verify.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh index 94fe413ee37..ba43168d123 100755 --- a/t/t1503-rev-parse-verify.sh +++ b/t/t1503-rev-parse-verify.sh @@ -132,8 +132,9 @@ test_expect_success 'use --default' ' test_must_fail git rev-parse --verify --default bar ' -test_expect_success 'main@{n} for various n' ' - N=$(git reflog | wc -l) && +test_expect_success !SANITIZE_LEAK 'main@{n} for various n' ' + git reflog >out && + N=$(wc -l X-Patchwork-Id: 12766368 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8790AC43217 for ; Wed, 2 Mar 2022 17:28:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243875AbiCBR27 (ORCPT ); Wed, 2 Mar 2022 12:28:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243834AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B8410FD4 for ; Wed, 2 Mar 2022 09:27:39 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id j17so3969432wrc.0 for ; Wed, 02 Mar 2022 09:27:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dS4moiO4CP3GF1mdLM6VHA4wDT9p/lCoym4zQZrn5KM=; b=Tt1ZCgFmWwDiORV4w570/MUCwzrq8mK6aVl3lT4/Ekhu2wrLisTqD94ImMhFkOl7ES xYW22NaMyVGTFKOATCwodbhXmOW5Rq0efb0hcFufTGh5Jqubp3uAvEqk7WX7SaC7lBw6 CWz52yFXaB2u9gX88PZCZq4xdAOH82Ha9CZfpxGvacdx74DRNAB4KQ6glTQvQ6muAsoL PmYmEdVvChIesw0xW8IwdcZJ5EDfOHTzsd9fEkknBzlLKnyvb2TSLJDBW8ZdN2zhnnWO bIPLt+S4TtiqhLOQaW342UCDQYDsCxRffiMDDTv9J8Hn50s2MVNG2U9pIpvW9A/bYCse +9Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dS4moiO4CP3GF1mdLM6VHA4wDT9p/lCoym4zQZrn5KM=; b=cihXCK3Icxw178EhI1gC5NKRUU6mdPCasxdO3b/hJP8ca2D9fGVI4rsi2kzHj/jhyS +uVQojwQRRaQeuYjgJMTOGz6NM+JaCqH5DUy8NRBhT1BBy0EsAiEvargZoNIj6CGixYb EwXkgjg/lePMQr+xJ6ydO7hSYfluzJfmpc4us0MY5yP9tqGX0TG5RFTN2mkf2Ri0wfRB 5gKXzKWANUr/rx2ujZWPCc8l5OEX4MzpqRvakP7oRlHxvFDMecSBEHsoo1neh9lzGU9f 9rJL8r6v7NoilakgY5qRWg1T3qZmCB335vVfovPp3fzCyd6Lx0COuM3aQPp8EAj+R55G +mNg== X-Gm-Message-State: AOAM532wn8ntNI4pVp3YrJxFblWpOIyF5BO0FJsTHvNLEMs50Sv/eG+b WvVeHM5WY/DtsSrqrYgOJiSs0Afz0DCmdw== X-Google-Smtp-Source: ABdhPJyabrcAgqlryUwRplGZOM7kyh/CMF6ohdcLXxVeUz4OT+y3/ItL2Y7e01JnSiU/KJRgDfm3zw== X-Received: by 2002:adf:e444:0:b0:1ef:caa9:b980 with SMTP id t4-20020adfe444000000b001efcaa9b980mr12306438wrm.549.1646242057896; Wed, 02 Mar 2022 09:27:37 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:37 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 09/15] notes tests: don't ignore "git" exit code Date: Wed, 2 Mar 2022 18:27:18 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a fragile test pattern that's been with us ever since these tests were introduced in [1], [2] and [3] to properly return the exit code of the failing command on failure. Because of this I'd marked this test as passing under SANITIZE=leak in [4] and [5]. We need to remove those annotations as these tests will no longer pass. 1. 9081a421a6d (checkout: fix "branch info" memory leaks, 2021-11-16) 2. 0057c0917d3 (Add selftests verifying that we can parse notes trees with various fanouts, 2009-10-09) 3. 048cdd4665e (t3305: Verify that adding many notes with git-notes triggers increased fanout, 2010-02-13) 4. ca089724952 (leak tests: mark some notes tests as passing with SANITIZE=leak, 2021-10-31) 5. 9081a421a6d (checkout: fix "branch info" memory leaks, 2021-11-16) --- t/t3302-notes-index-expensive.sh | 6 +++--- t/t3303-notes-subtrees.sh | 9 ++++----- t/t3305-notes-fanout.sh | 14 +++++++------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/t/t3302-notes-index-expensive.sh b/t/t3302-notes-index-expensive.sh index bc9d8ee1e6a..bb5fea02a03 100755 --- a/t/t3302-notes-index-expensive.sh +++ b/t/t3302-notes-index-expensive.sh @@ -8,7 +8,6 @@ test_description='Test commit notes index (expensive!)' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh create_repo () { @@ -65,7 +64,8 @@ create_repo () { test_notes () { count=$1 && git config core.notesRef refs/notes/commits && - git log | grep "^ " >output && + git log >tmp && + grep "^ " tmp >output && i=$count && while test $i -gt 0 do @@ -90,7 +90,7 @@ write_script time_notes <<\EOF unset GIT_NOTES_REF ;; esac - git log + git log || exit $? i=$(($i+1)) done >/dev/null EOF diff --git a/t/t3303-notes-subtrees.sh b/t/t3303-notes-subtrees.sh index 7e0a8960af8..eac193757bf 100755 --- a/t/t3303-notes-subtrees.sh +++ b/t/t3303-notes-subtrees.sh @@ -5,7 +5,6 @@ test_description='Test commit notes organized in subtrees' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh number_of_commits=100 @@ -79,7 +78,7 @@ test_sha1_based () { ( start_note_commit && nr=$number_of_commits && - git rev-list refs/heads/main | + git rev-list refs/heads/main >out && while read sha1; do note_path=$(echo "$sha1" | sed "$1") cat <gfi && + git fast-import --quiet /dev/null | + git ls-tree -r --name-only $notes_commit | while read path do path_has_fanout $path $fanout || return 1 @@ -51,8 +50,9 @@ test_expect_success 'creating many notes with git-notes' ' done ' -test_expect_success 'many notes created correctly with git-notes' ' - git log | grep "^ " > output && +test_expect_success !SANITIZE_LEAK 'many notes created correctly with git-notes' ' + git log >output.raw && + grep "^ " output.raw >output && i=$num_notes && while test $i -gt 0 do @@ -91,13 +91,13 @@ test_expect_success 'stable fanout 0 is followed by stable fanout 1' ' test_expect_success 'deleting most notes with git-notes' ' remove_notes=285 && i=0 && - git rev-list HEAD | + git rev-list HEAD >revs && while test $i -lt $remove_notes && read sha1 do i=$(($i + 1)) && test_tick && - git notes remove "$sha1" 2>/dev/null || return 1 - done + git notes remove "$sha1" || return 1 + done X-Patchwork-Id: 12766367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 800A5C433FE for ; Wed, 2 Mar 2022 17:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243883AbiCBR25 (ORCPT ); Wed, 2 Mar 2022 12:28:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243833AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80CE012761 for ; Wed, 2 Mar 2022 09:27:40 -0800 (PST) Received: by mail-wm1-x330.google.com with SMTP id v2-20020a7bcb42000000b0037b9d960079so3799191wmj.0 for ; Wed, 02 Mar 2022 09:27:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/0Th5kAVkJQP7YK5fgH3aCw1QZ8pTYKhtwLTOunqiwg=; b=AzPHsLD/xrunB2WvRj0lkS3EThr0KFUbfG8Ots4haB3HVmWkwQUyz5wZwTBKm6T9mM zprjoaQpF7/VtfWJZdsfwjyfpbIhMOMvV6Cv8cShV9M8DMM1SJM4wj+bgvrqyOssrwR8 U+8/Dxl1H0tzVvqWp+cS8SGOsCgGYncm3iBOwGhulxFSlVLaVrJWJorOLC257gLDLG23 RQr/+WPDgUhpqGhs5iAHX+fKTaIJkGXOjwiPRjabhxkfsl+JMg/xCvEsxkPg/fyZGbnB QOPvvUZkqgzztQxj39bVBORTMHT9CYcMLdBk9TwqA+7xMWdRdBA+glVnU4+cw5uIiqL2 qJEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/0Th5kAVkJQP7YK5fgH3aCw1QZ8pTYKhtwLTOunqiwg=; b=YS31Tkb2LHrW+deiycf02RU0LxL/0n/FYOEhqnQU+fRkV/OPuPf3IOkU3ijkRl9bix KU/eALm2oPmjnQxnN8rOyUlZXGDO4jKq4iy9BMGy67jBoKj63ujkfzBE+qoIapzLNfXv qaTBDgPyWMSjculbxz1F6RReSFPTVR3seb8sGn4Yb9k8gjjIdH08hDPkIRHaPc42P/te yhnoqMqCUDbA+LYqMZgVVI6BdzBiBgkqypHL3YL9Wax2fzseSyp/4kXfGmqu+tVdxEoi CxlLs3kDbg9vgtoloanQ8SmZh3W+viSXDhRGOALyhN6p4yEwoE8N5/bEVQb6C7aXBLgl 4Ktw== X-Gm-Message-State: AOAM531AR3NXW/FZbWR7WSB9Y3KLWPbYJx92vXjMipP/S0ZnhMnP5+XM 5mYTw4aAWN7jQC/ZjzhEtMntG7WlG3rwUQ== X-Google-Smtp-Source: ABdhPJw07uPvxdcQM3mU8hoZMB7Zkn9wiRV1SlUqswtdEd5jJEzrIolLDSuM7ucmsK9b1i7ckd2hOg== X-Received: by 2002:a05:600c:4e94:b0:381:84cf:e9b0 with SMTP id f20-20020a05600c4e9400b0038184cfe9b0mr671601wmq.79.1646242058814; Wed, 02 Mar 2022 09:27:38 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:38 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 10/15] diff tests: don't ignore "git rev-list" exit code Date: Wed, 2 Mar 2022 18:27:19 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a fragile pattern introduced in 2b459b483cb (diff: make sure work tree side is shown as 0{40} when different, 2008-03-02) to check the exit code of "git rev-list", while we're at it let's get rid of the needless sub-shell for invoking it in favor of the "-C" option. Because of this I'd marked these tests as passing under SANITIZE=leak in 16d4bd4f14e (leak tests: mark some diff tests as passing with SANITIZE=leak, 2021-10-31), let's remove the "TEST_PASSES_SANITIZE_LEAK=true" annotation as they no longer do. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4027-diff-submodule.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/t/t4027-diff-submodule.sh b/t/t4027-diff-submodule.sh index 6cef0da982f..295da987cce 100755 --- a/t/t4027-diff-submodule.sh +++ b/t/t4027-diff-submodule.sh @@ -2,7 +2,6 @@ test_description='difference in submodules' -TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-diff.sh @@ -28,10 +27,8 @@ test_expect_success setup ' git commit -m "submodule #2" ) && - set x $( - cd sub && - git rev-list HEAD - ) && + git -C sub rev-list HEAD >revs && + set x $(cat revs) && echo ":160000 160000 $3 $ZERO_OID M sub" >expect && subtip=$3 subprev=$2 ' From patchwork Wed Mar 2 17:27:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB0E7C4332F for ; Wed, 2 Mar 2022 17:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243860AbiCBR24 (ORCPT ); Wed, 2 Mar 2022 12:28:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243908AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6033012AB3 for ; Wed, 2 Mar 2022 09:27:41 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id i8so3896889wrr.8 for ; Wed, 02 Mar 2022 09:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M9TrVgCuBOb7yuOG4o98H3LBVPyEe8tnm83mzh3DWAI=; b=XAe2sjt6R3GOpEIvl+qUy+ahkq18bicowvhwYmyIRYaT/VKA4nwS2oCWXik1+kCNys hOgqU3T/HgPuVVzKkKPV8sKA2yR4dwPoah8gNopaHfjQQ5sLRnuJXS/ZU8hVVCrkaof9 mrfNSreEqeU8GJ1VyWLYmTR4Zn/4tHEKO4qQXCeb1n+oIgcCLwvx2Ce2VVH2Wvoxjw7l Mi9+XmaFl/XliYagBFDeEAOTnD8ekjT/meKq7DOfCT5tm6JSYDmT7BtqUdH1ZWGcDHJc L/8hvi7IrnfBoWlWHC1UwITLFlwKXWNwce7WF7dpZe2wzbq/E83taF7jZcuwrutPkNMh n4pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=M9TrVgCuBOb7yuOG4o98H3LBVPyEe8tnm83mzh3DWAI=; b=ktKSZ8k9I5yvXeeQX9zKQjS+/aeObT8v6Ufdw3IUdvS5AsfUDFuQwBCymyIXLuNAuf R7qfQ1I0CXaAmav8w7Ukygu1FCPFsUJW0KQXi57bAQd0xlcXwfkCatHKzde99sNvMA1T uZx6wYZRYaXHgMvs6uGRNOtrWujw48NcxGyZ3TtiwkOFibuJdp3Z1CXvQEqE+g2VC/2G QudUPyB2IWd61OFuk6xe30pCPIQnPuOGo9ahTf61EKgkq3nIDZVKe7ul+U0s1n4JbN+L Kmf56VfQvzw7Lz6EiQYAFcSe+rQuGGibOqtofsU2/JXW2J/1GZdjf+ubLFLM9S+0fqPj P3qA== X-Gm-Message-State: AOAM5328D+j36VNHjQV3Je/CCa/rMBV1RXCJZIRIgBZv92cjBmpZrw6l /mJDAUhxQzp1IwR8oBo9aGCeRkRNjDtgvw== X-Google-Smtp-Source: ABdhPJyCo1s4QLhR2GMUpoGdXG+1HwJe6dzScatiGgnMkn+dCGUi+mO7ROsOEPnFUd5NGjEEu2V+gQ== X-Received: by 2002:adf:dbd2:0:b0:1ea:9382:6bff with SMTP id e18-20020adfdbd2000000b001ea93826bffmr23548551wrj.705.1646242059686; Wed, 02 Mar 2022 09:27:39 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:39 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 11/15] rev-list tests: don't hide abort() in "test_expect_failure" Date: Wed, 2 Mar 2022 18:27:20 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a couple of uses of "test_expect_failure" to use a "test_expect_success" to positively assert the current behavior, and replace the intent of "test_expect_failure" with a "TODO" comment int the description. As noted in [1] the "test_expect_failure" feature is overly eager to accept any failure as OK, and thus by design hides segfaults, abort() etc. Because of that I didn't notice in dd9cede9136 (leak tests: mark some rev-list tests as passing with SANITIZE=leak, 2021-10-31) that this test leaks memory under SANITIZE=leak. I have some larger local changes to add a better "test_expect_failure", which would work just like "test_expect_success", but would allow us say "test_todo" here (and "success" would emit a "not ok [...] # TODO", not "ok [...]". In lieu of those larger changes let's more narrowly fix the problem at hand here and stop conflating the current "success" with actual SANITIZE=leak failures. 1. https://lore.kernel.org/git/87tuhmk19c.fsf@evledraar.gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t6102-rev-list-unexpected-objects.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/t/t6102-rev-list-unexpected-objects.sh b/t/t6102-rev-list-unexpected-objects.sh index 6f0902b8638..cf0195e8263 100755 --- a/t/t6102-rev-list-unexpected-objects.sh +++ b/t/t6102-rev-list-unexpected-objects.sh @@ -17,8 +17,13 @@ test_expect_success 'setup unexpected non-blob entry' ' broken_tree="$(git hash-object -w --literally -t tree broken-tree)" ' -test_expect_failure 'traverse unexpected non-blob entry (lone)' ' - test_must_fail git rev-list --objects $broken_tree +test_expect_success !SANITIZE_LEAK 'TODO (should fail!): traverse unexpected non-blob entry (lone)' ' + sed "s/Z$//" >expect <<-EOF && + $broken_tree Z + $tree foo + EOF + git rev-list --objects $broken_tree >actual && + test_cmp expect actual ' test_expect_success 'traverse unexpected non-blob entry (seen)' ' @@ -116,8 +121,8 @@ test_expect_success 'setup unexpected non-blob tag' ' tag=$(git hash-object -w --literally -t tag broken-tag) ' -test_expect_failure 'traverse unexpected non-blob tag (lone)' ' - test_must_fail git rev-list --objects $tag +test_expect_success !SANITIZE_LEAK 'TODO (should fail!): traverse unexpected non-blob tag (lone)' ' + git rev-list --objects $tag ' test_expect_success 'traverse unexpected non-blob tag (seen)' ' From patchwork Wed Mar 2 17:27:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15D13C4332F for ; Wed, 2 Mar 2022 17:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243853AbiCBR2r (ORCPT ); Wed, 2 Mar 2022 12:28:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243931AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D8D613F77 for ; Wed, 2 Mar 2022 09:27:42 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id u10so2272192wra.9 for ; Wed, 02 Mar 2022 09:27:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2fsmGshl7kkXCmKDy14XbDAEO/EEX9bnMvyB5ThBT10=; b=pRczs67lixXnzYpv95ZrXOa30ciNqJBKzfiDy6l0P0RCOUVBNUlF0K8GmCOfGQvA5l O0XgCfgp8dtu8b9psm7VQZZROPKaS3F/3S6W+7gV131BAVjDwVeNp0wQroP018nzUmmr iWRcWxld1P4897CZZgFuCimXQCSdNl9Fxf/lG5bEQHxMQalSsecJR/qeVyzKVAc7QJaQ MPcegk3PEap+pKrjX8SS1GJXGFBjX48R4MJAmtdeakk2twNRXptxUu5VCtf2bqk2NuPo rbRF2iw8nXVfCC52TrEmb0jiRATJw4+DChHh/RdgLMOxhXPa6G+f9+NCRh7CxXJtwTqp UdaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2fsmGshl7kkXCmKDy14XbDAEO/EEX9bnMvyB5ThBT10=; b=4Ryz2GkhHvNe8kK3W0a3/QPzdcQa59UGkmrba82Dcg4xvwsZMMif8fQohz3FqifpL/ m5LgreQTQTKP5mvF0Z0HTO5VSbTkYcbECeT/5FJvDA4YWBby/T23VgNQzNN5ApvWYlIb PCosqomVuCY0QTjIMyID2u8Ac3NsHMlj1lHucpTRMB4Eyd2qUk+JLREB0MKRUuQUShWb gt5OqdC+Pvhmge8D7eeYZzFbhUqLd6s52Is3peRVk+ZV17CLs2e6PO2MLOFd5ExFKy5s Hkdgtjevt6GZm4KYTLQJoYuu3mTYFTC+1xcW1fGdV8NnRIuAM6j1i0DYyFyfQT44CZhb Helg== X-Gm-Message-State: AOAM532DW5WZYzJeVVMMcOHqtUVRfF+pg/7phFVl/SG9EC10+mM2QnP6 LyZIA01U6xF6NUhwCF5VmYmS1hPrSutdfw== X-Google-Smtp-Source: ABdhPJyFj5J6aeLNMHo7WkyAm81FFBZKyVwNEKu2vcdNw/PPyI2RWL3AxI72s0MATHtPKoeiWeIQDQ== X-Received: by 2002:a05:6000:1864:b0:1ef:d2b0:560a with SMTP id d4-20020a056000186400b001efd2b0560amr11862654wri.38.1646242060554; Wed, 02 Mar 2022 09:27:40 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:39 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 12/15] gettext tests: don't ignore "test-tool regex" exit code Date: Wed, 2 Mar 2022 18:27:21 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Amend a prerequisite check added in 5c1ebcca4d1 (grep/icase: avoid kwsset on literal non-ascii strings, 2016-06-25) to do invoke 'test-tool regex' in such a way that we'll notice if it dies under SANITIZE=leak due to having a memory leak, as opposed to us not having the "ICASE" support we're checking for. Because we weren't making a distinction between the two I'd marked these tests as passing under SANITIZE=leak in 03d85e21951 (leak tests: mark remaining leak-free tests as such, 2021-12-17). Doing this is tricky. Ideally "test_lazy_prereq" would materialize as a "real" test that we could check the exit code of with the same signal matching that "test_must_fail" does. However lazy prerequisites aren't real tests, and are instead lazily materialized in the guts of "test_have_prereq" when we've already started another test. We could detect the abort() (or similar) there and pass that exit code down, and fail the test that caused the prerequisites to be materialized. But that would require extensive changes to test-lib.sh and test-lib-functions.sh. Let's instead simply check if the exit code of "test-tool regex" is zero, and if so set the prerequisites. If it's non-zero let's run it again with "test_must_fail". We'll thus make a distinction between "bad" non-zero (segv etc) and "good" (exit 1 etc.). Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t7812-grep-icase-non-ascii.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/t/t7812-grep-icase-non-ascii.sh b/t/t7812-grep-icase-non-ascii.sh index ca3f24f8079..347bf4a12f3 100755 --- a/t/t7812-grep-icase-non-ascii.sh +++ b/t/t7812-grep-icase-non-ascii.sh @@ -11,9 +11,14 @@ test_expect_success GETTEXT_LOCALE 'setup' ' export LC_ALL ' -test_have_prereq GETTEXT_LOCALE && -test-tool regex "HALLÓ" "Halló" ICASE && -test_set_prereq REGEX_LOCALE +test_expect_success GETTEXT_LOCALE 'setup REGEX_LOCALE prerequisite' ' + if test-tool regex "HALLÓ" "Halló" ICASE + then + test_set_prereq REGEX_LOCALE + else + test_must_fail test-tool regex "HALLÓ" "Halló" ICASE + fi +' test_expect_success REGEX_LOCALE 'grep literal string, no -F' ' git grep -i "TILRAUN: Halló Heimur!" && From patchwork Wed Mar 2 17:27:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F67FC433FE for ; Wed, 2 Mar 2022 17:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243884AbiCBR2t (ORCPT ); Wed, 2 Mar 2022 12:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243935AbiCBR2b (ORCPT ); Wed, 2 Mar 2022 12:28:31 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3741E17A95 for ; Wed, 2 Mar 2022 09:27:42 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id x15so3868296wru.13 for ; Wed, 02 Mar 2022 09:27:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gk64hYmDDzx7I1kXYmzgn8G8sS/A1+pzGNK0kxNhdRI=; b=WZje2nKu7dSzmLUndPjGgNiPP9DN6iozaCbay38drr8IRIILLclT1y/LrwGwdH9VRM OdpMccdOSSOPfJ/k9bmySbwbP7YahMkTKSvX3o2ajx0G9fBRWtlWhRz1JShSwpZczjyo T1UHSzYOAzC502oIou2jzSHEusMs+KgA5mOU16uytSLKdWmmmDfvjD1pXlQ+KiGT6Kya H0+PU59ShRK+GmhSsoJwJdLFzGUy7UOBI72VNpCHwy6Q81f7s1d+73LGNLOWMJdHt4cE F9sECu6DHFcQa3xDxcOXrLDzVnBY0Y1ybIm6jkCMApjqLFL8KciN/JixpQSj2ePuF3TF uS1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gk64hYmDDzx7I1kXYmzgn8G8sS/A1+pzGNK0kxNhdRI=; b=5hrbAwA4PJAW+Y/+2fMvQ5jLSUV2mR8/kNhJxQF/m0hH9sHSLfxW4M7LcJYnpSwXhY wh/MDPY/+hX1kNHQIuHmy2e/rNfsS62vH0aq2ds/j+PGma0ZJOSMD+dVwq8i3WqkWx5s XRBmXx8y65rbFTF8vl53x4dfpv7uoZ8bYxyP2ymopmZt8MulJckBtJz/RrWg+2IAsWhd DY8Sz6+EhXxyUUj2f4N9x27+kvf94S9hcN9C0pLU7F+tPTSpNnBejfh+OZWYhEm1IhuF oj/Km8oj3sme1pGj6PX7zPhAGFnGZQdxBYTC16e6Y46cyIZd+Z35WD9rbrDXUuecTfQp XxzA== X-Gm-Message-State: AOAM531vxnBykjqMyoARPl42TjscrtQk0HvStc4gT42BnTE5ij2IlJ25 K38VJBd+gwYympPKMDeeEDKSxaN/RT1X8A== X-Google-Smtp-Source: ABdhPJxLlqgD0zBWgI7r17kd4d3adD6rgnSQxFOvN48P9M+9LdFwY0kCWTtJGblr8NFyfFUw3H7gOQ== X-Received: by 2002:adf:fd0a:0:b0:1f0:25fd:4082 with SMTP id e10-20020adffd0a000000b001f025fd4082mr3516792wrr.501.1646242061326; Wed, 02 Mar 2022 09:27:41 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:40 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 13/15] apply tests: don't ignore "git ls-files" exit code, drop sub-shell Date: Wed, 2 Mar 2022 18:27:22 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Fix code added in 969c877506c (git apply --directory broken for new files, 2008-10-12) so that it doesn't invoke "git ls-files" on the left-hand-side of a pipe, instead let's use an intermediate file. Since we're doing that we can also drop the sub-shell that was here to group the two. There are a lot of these sorts of patterns in the test suite, and there's no particular reason to fix this one other than in a preceding commit all similar patterns except this one were fixed in "t/t4128-apply-root.sh", so let's fix this one straggler as well. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t4128-apply-root.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t4128-apply-root.sh b/t/t4128-apply-root.sh index ba89a2f2d73..f6db5a79dd9 100755 --- a/t/t4128-apply-root.sh +++ b/t/t4128-apply-root.sh @@ -96,7 +96,8 @@ test_expect_success 'apply --directory (delete file)' ' echo content >some/sub/dir/delfile && git add some/sub/dir/delfile && git apply --directory=some/sub/dir/ --index patch && - ! (git ls-files | grep delfile) + git ls-files >out && + ! grep delfile out ' cat > patch << 'EOF' From patchwork Wed Mar 2 17:27:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 138D1C433EF for ; Wed, 2 Mar 2022 17:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243705AbiCBR2w (ORCPT ); Wed, 2 Mar 2022 12:28:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243948AbiCBR2c (ORCPT ); Wed, 2 Mar 2022 12:28:32 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7095D19296 for ; Wed, 2 Mar 2022 09:27:44 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id d3so3933455wrf.1 for ; Wed, 02 Mar 2022 09:27:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yx3evGD/q3dgk3YDgp0Rul5ulb3tmOHQeafKXYN6nNE=; b=P0vf4gDBuNDmZ1sHF1wIr1hyY5dD0SmmNhncUC9n3XlNTFDJsWn3ZDz3kFkx6jFjMJ vymfSDsavLlUCygqr8dk3f9CJLd6KwHQaBNpQi1iu7us1t8VA86kRcvpk5rESXjfs597 LNNy7sg8oTdxmcI4Kk6KQTeGbaqNVow6kWDEy5c3SMiPU2RCD9aCaMfdMV3Qd4Vi5bRU rOZg3UfuwMVu3TScNbTDA0WaPdWZL+UfBtJXVS460x/5zNCj1xIC0j38+JfGrmXHCA8u dVgjE4d9c/1cXlvdMf8xpTEx0piYh/3bnz5Rmtuw8CoLktyjr07qPZS0hPiFT9XGakK1 p7RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yx3evGD/q3dgk3YDgp0Rul5ulb3tmOHQeafKXYN6nNE=; b=DimqNPKyoRIuDm6Fq5C51WqhbgO2+fEONIXC36j+zVlUnInOkUqRxokww2jrQe3ewx gLqTmX+FaDKYIUDbavoY+eGzPTG81CEPGbjTvjimIaumrHjHVpwoQeF5RJ6hwgRGMUVw hMkklnVHT4yAvBktnLN1avEZiEi3ANBP9zVPzmFAlVlULlfbBKtwfXYJ6q+8fU9ZBM+B LLbskJVQexJ/qEawxhtU5eTWyb48uTZx70EYSZw0303WJfoGV5lkB1w9rmsOZdFjiq7Z evIJa/OnXYu8SnPF7YVbq0d4kd5tcx8+9DDseDkRtwBNElSgM+k0m+F4trMtbzSH//sl mQbQ== X-Gm-Message-State: AOAM532TXwy5yfoMfHhsrvDpewJ9clC9xti6Vrst/ChlhOLwkEQTTzH7 SDEPw6IFGHKAmTMUDxeLyMpfUPLGQuF6yg== X-Google-Smtp-Source: ABdhPJyUci1Xkt9qt9lHudfUWP3b65+yoBgKaBzKiAKNNG6wTqEJaqYVKAocpb6x1XjfH5nFWWg8gA== X-Received: by 2002:adf:c047:0:b0:1f0:1192:669a with SMTP id c7-20020adfc047000000b001f01192669amr6498841wrf.627.1646242062150; Wed, 02 Mar 2022 09:27:42 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:41 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 14/15] checkout tests: don't ignore "git " exit code Date: Wed, 2 Mar 2022 18:27:23 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a fragile pattern introduced in 696acf45f96 (checkout: implement "-" abbreviation, add docs and tests, 2009-01-17) to check the exit code of both "git symbolic-ref" and "git rev-parse". Without this change this test will become flaky e.g. under SANITIZE=leak if some (but not all) memory leaks revealed by these commands are fixed. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t2012-checkout-last.sh | 51 +++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh index 42601d5a310..1f6c4ed0428 100755 --- a/t/t2012-checkout-last.sh +++ b/t/t2012-checkout-last.sh @@ -21,14 +21,20 @@ test_expect_success 'first branch switch' ' git checkout other ' +test_cmp_symbolic_HEAD_ref () { + echo refs/heads/"$1" >expect && + git symbolic-ref HEAD >actual && + test_cmp expect actual +} + test_expect_success '"checkout -" switches back' ' git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main" + test_cmp_symbolic_HEAD_ref main ' test_expect_success '"checkout -" switches forth' ' git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/other" + test_cmp_symbolic_HEAD_ref other ' test_expect_success 'detach HEAD' ' @@ -37,12 +43,16 @@ test_expect_success 'detach HEAD' ' test_expect_success '"checkout -" attaches again' ' git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/other" + test_cmp_symbolic_HEAD_ref other ' test_expect_success '"checkout -" detaches again' ' git checkout - && - test "z$(git rev-parse HEAD)" = "z$(git rev-parse other)" && + + git rev-parse other >expect && + git rev-parse HEAD >actual && + test_cmp expect actual && + test_must_fail git symbolic-ref HEAD ' @@ -63,31 +73,31 @@ more_switches () { test_expect_success 'switch to the last' ' more_switches && git checkout @{-1} && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch2" + test_cmp_symbolic_HEAD_ref branch2 ' test_expect_success 'switch to second from the last' ' more_switches && git checkout @{-2} && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch3" + test_cmp_symbolic_HEAD_ref branch3 ' test_expect_success 'switch to third from the last' ' more_switches && git checkout @{-3} && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch4" + test_cmp_symbolic_HEAD_ref branch4 ' test_expect_success 'switch to fourth from the last' ' more_switches && git checkout @{-4} && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch5" + test_cmp_symbolic_HEAD_ref branch5 ' test_expect_success 'switch to twelfth from the last' ' more_switches && git checkout @{-12} && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/branch13" + test_cmp_symbolic_HEAD_ref branch13 ' test_expect_success 'merge base test setup' ' @@ -98,19 +108,28 @@ test_expect_success 'merge base test setup' ' test_expect_success 'another...main' ' git checkout another && git checkout another...main && - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)" + + git rev-parse --verify main^ >expect && + git rev-parse --verify HEAD >actual && + test_cmp expect actual ' test_expect_success '...main' ' git checkout another && git checkout ...main && - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)" + + git rev-parse --verify main^ >expect && + git rev-parse --verify HEAD >actual && + test_cmp expect actual ' test_expect_success 'main...' ' git checkout another && git checkout main... && - test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify main^)" + + git rev-parse --verify main^ >expect && + git rev-parse --verify HEAD >actual && + test_cmp expect actual ' test_expect_success '"checkout -" works after a rebase A' ' @@ -118,7 +137,7 @@ test_expect_success '"checkout -" works after a rebase A' ' git checkout other && git rebase main && git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main" + test_cmp_symbolic_HEAD_ref main ' test_expect_success '"checkout -" works after a rebase A B' ' @@ -127,7 +146,7 @@ test_expect_success '"checkout -" works after a rebase A B' ' git checkout other && git rebase main moodle && git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main" + test_cmp_symbolic_HEAD_ref main ' test_expect_success '"checkout -" works after a rebase -i A' ' @@ -135,7 +154,7 @@ test_expect_success '"checkout -" works after a rebase -i A' ' git checkout other && git rebase -i main && git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main" + test_cmp_symbolic_HEAD_ref main ' test_expect_success '"checkout -" works after a rebase -i A B' ' @@ -144,7 +163,7 @@ test_expect_success '"checkout -" works after a rebase -i A B' ' git checkout other && git rebase main foodle && git checkout - && - test "z$(git symbolic-ref HEAD)" = "zrefs/heads/main" + test_cmp_symbolic_HEAD_ref main ' test_done From patchwork Wed Mar 2 17:27:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 12766365 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A187C433F5 for ; Wed, 2 Mar 2022 17:28:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243866AbiCBR2x (ORCPT ); Wed, 2 Mar 2022 12:28:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243947AbiCBR2c (ORCPT ); Wed, 2 Mar 2022 12:28:32 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C0B1AF2B for ; Wed, 2 Mar 2022 09:27:45 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id u1so3874538wrg.11 for ; Wed, 02 Mar 2022 09:27:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d1p5+p1u0AcH72vQeXXs+MqrUu9P2J0RxH4azzN4H7U=; b=Act4WTJqutRQ5k+l29MOBNeogzvnq7JKy83o1sFqFl1FXzci+BsUXEc/iMh5tOPSLR 5uxkwRXZPIH+cMEraVojwxKHaDX4vagTwCcZAAFbICb7+A5XO25tXQxQ3Ai3boqbKxAh QB99TpeoLqDBvT3M+kQL8qBmzBShsamGDF6k9vK0Mqo1NuM0tVtw3z9geTmzyza36tT5 RkT6BDJTzXenSgtzP9h8U7H59nXnDXIiDaLvFkDdO7LM87QaaOmsXFdkxr5zX6C0R+Dh B/0MAfSXtNXN7+SjbHAVmdr/TwjAKJomcoLUT783bh8SimmbwQG2XoBzwWjOqVKRftvI c3WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d1p5+p1u0AcH72vQeXXs+MqrUu9P2J0RxH4azzN4H7U=; b=ZON3nWaOYPKcqDvlpTQGov7ZUZJoMbwXjJGjoSXvuPlVsvdmZQEJUEzVDILgoTcSdf D5qDoFFnKWYC0nol0ch4cABVt57TID7jxOSjUHICHyk14RDgeEgLsRwBkaX5UEclsiEy sidhtysfxjxnrNzJX1KFFLorjxjwVuDxL9LOiwMfXiyD9uXl1XHQfZ/KsLetQbyDG3Lx n8qRrZj5EFGeB2nvKk9SCbNoEXisfvJdCcIhj4fXh/HiuYc0nR8CZZ61/ORbbzMvasap pxHoJanaf0JfVdIioY46HSLF9budGeCuCCeaIBR28kihqxpm76eQCW1Ty3IHxkO+6dxM zemQ== X-Gm-Message-State: AOAM533OBiXoc18g3ffQNqpsb7BE6QH9BmPn6Mm3fWZAMNB4osfk3SFO 8IbMLWaD+xbp3ZNRvNLLaDYxsioz2Onm4A== X-Google-Smtp-Source: ABdhPJyJ2YgxB7yz7yfR7mC+tJRwQMmi39wklKjaeEfNwj9ek8T8N4XZxL0otFsz1RQ0yyW63/pFFQ== X-Received: by 2002:a5d:4a8f:0:b0:1f0:4af2:4e29 with SMTP id o15-20020a5d4a8f000000b001f04af24e29mr236865wrq.519.1646242063415; Wed, 02 Mar 2022 09:27:43 -0800 (PST) Received: from vm.nix.is (vm.nix.is. [2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id r20-20020adfa154000000b001f0326a23e1sm2537377wrr.88.2022.03.02.09.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 09:27:42 -0800 (PST) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Shubham Mishra , Christian Couder , Taylor Blau , =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Subject: [PATCH 15/15] rev-list simplify tests: don't ignore "git" exit code Date: Wed, 2 Mar 2022 18:27:24 +0100 Message-Id: X-Mailer: git-send-email 2.35.1.1226.g8b497615d32 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Change a fragile test pattern introduced in 65347030590 (Topo-sort before --simplify-merges, 2008-08-03) to check the exit code of both "git name-rev" and "git log". This test as a whole would fail under SANITIZE=leak, but we'd pass several "failing" tests due to hiding these exit codes before we'd spot git dying with abort(). Now we'll instead spot all of the failures. Signed-off-by: Ævar Arnfjörð Bjarmason --- t/t6012-rev-list-simplify.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh index 63fcccec32e..de1e87f1621 100755 --- a/t/t6012-rev-list-simplify.sh +++ b/t/t6012-rev-list-simplify.sh @@ -12,7 +12,9 @@ note () { } unnote () { - git name-rev --tags --annotate-stdin | sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g" + test_when_finished "rm -f tmp" && + git name-rev --tags --annotate-stdin >tmp && + sed -e "s|$OID_REGEX (tags/\([^)]*\)) |\1 |g" actual && + git log --pretty="$FMT" --parents $param >out && + unnote >actual check expect && - git log --pretty="$FMT" --full-history E -- lost | - unnote >actual && + git log --pretty="$FMT" --full-history E -- lost >out && + unnote >actual check