bisect tests: test for v2.30.0 "bisect run" regressions

Add three failing tests which succeed on v2.29.0, but due to the topic
merged at [1] (specifically [2]) have been failing since then. We'll
address those regressions in subsequent commits.

There was also a "regression" where:

	git bisect run ./missing-script.sh

Would count a non-existing script as "good", as the shell would exit
with 127. That edge case is a bit too insane to preserve, so let's not
add it to these regression tests.

There was another regression that 'git bisect' consumed some options
that was meant to passed down to program run with 'git bisect run'.
Since that regression is breaking user's expectation, it has been fixed
earlier without this patch queued.

1. 0a4cb1f1f2 (Merge branch 'mr/bisect-in-c-4', 2021-09-23)
2. d1bbbe45df (bisect--helper: reimplement `bisect_run` shell
   function in C, 2021-09-13)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2022-11-10 23:36:36 +07:00 committed by Taylor Blau
parent 2445d34fb9
commit 982fecf7c1

View file

@ -252,6 +252,85 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
grep $HASH4 my_bisect_log.txt
'
test_bisect_run_args () {
test_when_finished "rm -f run.sh actual" &&
>actual &&
cat >expect.args &&
cat <&6 >expect.out &&
cat <&7 >expect.err &&
write_script run.sh <<-\EOF &&
while test $# != 0
do
echo "<$1>" &&
shift
done >actual.args
EOF
test_when_finished "git bisect reset" &&
git bisect start &&
git bisect good $HASH1 &&
git bisect bad $HASH4 &&
git bisect run ./run.sh $@ >actual.out.raw 2>actual.err &&
# Prune just the log output
sed -n \
-e '/^Author:/d' \
-e '/^Date:/d' \
-e '/^$/d' \
-e '/^commit /d' \
-e '/^ /d' \
-e 'p' \
<actual.out.raw >actual.out &&
test_cmp expect.out actual.out &&
test_cmp expect.err actual.err &&
test_cmp expect.args actual.args
}
test_expect_failure 'git bisect run: args, stdout and stderr with no arguments' "
test_bisect_run_args <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
EOF_ARGS
running ./run.sh
$HASH4 is the first bad commit
bisect run success
EOF_OUT
EOF_ERR
"
test_expect_failure 'git bisect run: args, stdout and stderr: "--" argument' "
test_bisect_run_args -- <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
<-->
EOF_ARGS
running ./run.sh --
$HASH4 is the first bad commit
bisect run success
EOF_OUT
EOF_ERR
"
test_expect_failure 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' "
test_bisect_run_args --log foo --no-log bar <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
<--log>
<foo>
<--no-log>
<bar>
EOF_ARGS
running ./run.sh --log foo --no-log bar
$HASH4 is the first bad commit
bisect run success
EOF_OUT
EOF_ERR
"
test_expect_failure 'git bisect run: args, stdout and stderr: "--bisect-start" argument' "
test_bisect_run_args --bisect-start <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
<--bisect-start>
EOF_ARGS
running ./run.sh --bisect-start
$HASH4 is the first bad commit
bisect run success
EOF_OUT
EOF_ERR
"
# We want to automatically find the commit that
# added "Another" into hello.
test_expect_success '"git bisect run" simple case' '