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. 0a4cb1f1f2f (Merge branch 'mr/bisect-in-c-4', 2021-09-23) 2. d1bbbe45df8 (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>

Ævar Arnfjörð Bjarmason committed Nov 10, 2022 at 23:36 UTC 982fecf7c195d47c50cd397db303d262d2af88f6
1 file changed +79
t/t6030-bisect-porcelain.sh
+79
@@ -252,6 +252,85 @@ test_expect_success 'bisect skip: with commit both bad and skipped' '
252 grep $HASH4 my_bisect_log.txt
253 '
254
255 +test_bisect_run_args () {
256 + test_when_finished "rm -f run.sh actual" &&
257 + >actual &&
258 + cat >expect.args &&
259 + cat <&6 >expect.out &&
260 + cat <&7 >expect.err &&
261 + write_script run.sh <<-\EOF &&
262 + while test $# != 0
263 + do
264 + echo "<$1>" &&
265 + shift
266 + done >actual.args
267 + EOF
268 +
269 + test_when_finished "git bisect reset" &&
270 + git bisect start &&
271 + git bisect good $HASH1 &&
272 + git bisect bad $HASH4 &&
273 + git bisect run ./run.sh $@ >actual.out.raw 2>actual.err &&
274 + # Prune just the log output
275 + sed -n \
276 + -e '/^Author:/d' \
277 + -e '/^Date:/d' \
278 + -e '/^$/d' \
279 + -e '/^commit /d' \
280 + -e '/^ /d' \
281 + -e 'p' \
282 + <actual.out.raw >actual.out &&
283 + test_cmp expect.out actual.out &&
284 + test_cmp expect.err actual.err &&
285 + test_cmp expect.args actual.args
286 +}
287 +
288 +test_expect_failure 'git bisect run: args, stdout and stderr with no arguments' "
289 + test_bisect_run_args <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
290 + EOF_ARGS
291 + running ./run.sh
292 + $HASH4 is the first bad commit
293 + bisect run success
294 + EOF_OUT
295 + EOF_ERR
296 +"
297 +
298 +test_expect_failure 'git bisect run: args, stdout and stderr: "--" argument' "
299 + test_bisect_run_args -- <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
300 + <-->
301 + EOF_ARGS
302 + running ./run.sh --
303 + $HASH4 is the first bad commit
304 + bisect run success
305 + EOF_OUT
306 + EOF_ERR
307 +"
308 +
309 +test_expect_failure 'git bisect run: args, stdout and stderr: "--log foo --no-log bar" arguments' "
310 + test_bisect_run_args --log foo --no-log bar <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
311 + <--log>
312 + <foo>
313 + <--no-log>
314 + <bar>
315 + EOF_ARGS
316 + running ./run.sh --log foo --no-log bar
317 + $HASH4 is the first bad commit
318 + bisect run success
319 + EOF_OUT
320 + EOF_ERR
321 +"
322 +
323 +test_expect_failure 'git bisect run: args, stdout and stderr: "--bisect-start" argument' "
324 + test_bisect_run_args --bisect-start <<-'EOF_ARGS' 6<<-EOF_OUT 7<<-'EOF_ERR'
325 + <--bisect-start>
326 + EOF_ARGS
327 + running ./run.sh --bisect-start
328 + $HASH4 is the first bad commit
329 + bisect run success
330 + EOF_OUT
331 + EOF_ERR
332 +"
333 +
334 # We want to automatically find the commit that
335 # added "Another" into hello.
336 test_expect_success '"git bisect run" simple case' '