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' '