205
205
--valgrind-only=* )
206
206
valgrind_only=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
207
207
shift ;;
208
- --valgrind-parallel=* )
209
- valgrind_parallel=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
210
- shift ;;
211
- --valgrind-only-stride=* )
212
- valgrind_only_stride=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
213
- shift ;;
214
- --valgrind-only-offset=* )
215
- valgrind_only_offset=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
216
- shift ;;
217
208
--tee)
218
209
shift ;; # was handled already
219
210
--root=* )
220
211
root=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
221
212
shift ;;
222
- --statusprefix=* )
223
- statusprefix=$( expr " z$1 " : ' z[^=]*=\(.*\)' )
224
- shift ;;
225
213
* )
226
214
echo " error: unknown test option '$1 '" >&2 ; exit 1 ;;
227
215
esac
228
216
done
229
217
230
- if test -n " $valgrind_only " || test -n " $valgrind_only_stride "
218
+ if test -n " $valgrind_only "
231
219
then
232
220
test -z " $valgrind " && valgrind=memcheck
233
221
test -z " $verbose " && verbose_only=" $valgrind_only "
@@ -329,25 +317,25 @@ trap 'die' EXIT
329
317
330
318
test_ok_ () {
331
319
test_success=$(( $test_success + 1 ))
332
- say_color " " " ${statusprefix} ok $test_count - $@ "
320
+ say_color " " " ok $test_count - $@ "
333
321
}
334
322
335
323
test_failure_ () {
336
324
test_failure=$(( $test_failure + 1 ))
337
- say_color error " ${statusprefix} not ok $test_count - $1 "
325
+ say_color error " not ok $test_count - $1 "
338
326
shift
339
327
echo " $@ " | sed -e ' s/^/# /'
340
328
test " $immediate " = " " || { GIT_EXIT_OK=t; exit 1; }
341
329
}
342
330
343
331
test_known_broken_ok_ () {
344
332
test_fixed=$(( $test_fixed + 1 ))
345
- say_color error " ${statusprefix} ok $test_count - $@ # TODO known breakage vanished"
333
+ say_color error " ok $test_count - $@ # TODO known breakage vanished"
346
334
}
347
335
348
336
test_known_broken_failure_ () {
349
337
test_broken=$(( $test_broken + 1 ))
350
- say_color warn " ${statusprefix} not ok $test_count - $@ # TODO known breakage"
338
+ say_color warn " not ok $test_count - $@ # TODO known breakage"
351
339
}
352
340
353
341
test_debug () {
@@ -377,9 +365,7 @@ maybe_teardown_verbose () {
377
365
last_verbose=t
378
366
maybe_setup_verbose () {
379
367
test -z " $verbose_only " && return
380
- if match_pattern_list $test_count $verbose_only ||
381
- { test -n " $valgrind_only_stride " &&
382
- expr $test_count " %" $valgrind_only_stride - $valgrind_only_offset = 0 > /dev/null; }
368
+ if match_pattern_list $test_count $verbose_only
383
369
then
384
370
exec 4>&2 3>&1
385
371
# Emit a delimiting blank line when going from
@@ -403,17 +389,13 @@ maybe_teardown_valgrind () {
403
389
404
390
maybe_setup_valgrind () {
405
391
test -z " $GIT_VALGRIND " && return
406
- if test -z " $valgrind_only " && test -z " $valgrind_only_stride "
392
+ if test -z " $valgrind_only "
407
393
then
408
394
GIT_VALGRIND_ENABLED=t
409
395
return
410
396
fi
411
397
GIT_VALGRIND_ENABLED=
412
398
if match_pattern_list $test_count $valgrind_only
413
- then
414
- GIT_VALGRIND_ENABLED=t
415
- elif test -n " $valgrind_only_stride " &&
416
- expr $test_count " %" $valgrind_only_stride - $valgrind_only_offset = 0 > /dev/null
417
399
then
418
400
GIT_VALGRIND_ENABLED=t
419
401
fi
@@ -477,8 +459,8 @@ test_skip () {
477
459
of_prereq=" of $test_prereq "
478
460
fi
479
461
480
- say_color skip >&3 " ${statusprefix} skipping test: $@ "
481
- say_color skip " ${statusprefix} ok $test_count # skip $1 (missing $missing_prereq ${of_prereq} )"
462
+ say_color skip >&3 " skipping test: $@ "
463
+ say_color skip " ok $test_count # skip $1 (missing $missing_prereq ${of_prereq} )"
482
464
: true
483
465
;;
484
466
* )
@@ -516,11 +498,11 @@ test_done () {
516
498
517
499
if test " $test_fixed " ! = 0
518
500
then
519
- say_color error " ${statusprefix} # $test_fixed known breakage(s) vanished; please update test(s)"
501
+ say_color error " # $test_fixed known breakage(s) vanished; please update test(s)"
520
502
fi
521
503
if test " $test_broken " ! = 0
522
504
then
523
- say_color warn " ${statusprefix} # still have $test_broken known breakage(s)"
505
+ say_color warn " # still have $test_broken known breakage(s)"
524
506
fi
525
507
if test " $test_broken " ! = 0 || test " $test_fixed " ! = 0
526
508
then
@@ -543,9 +525,9 @@ test_done () {
543
525
then
544
526
if test $test_remaining -gt 0
545
527
then
546
- say_color pass " ${statusprefix} # passed all $msg "
528
+ say_color pass " # passed all $msg "
547
529
fi
548
- say " ${statusprefix} 1..$test_count$skip_all "
530
+ say " 1..$test_count$skip_all "
549
531
fi
550
532
551
533
test -d " $remove_trash " &&
@@ -559,18 +541,15 @@ test_done () {
559
541
* )
560
542
if test $test_external_has_tap -eq 0
561
543
then
562
- say_color error " ${statusprefix} # failed $test_failure among $msg "
563
- say " ${statusprefix} 1..$test_count "
544
+ say_color error " # failed $test_failure among $msg "
545
+ say " 1..$test_count "
564
546
fi
565
547
566
548
exit 1 ;;
567
549
568
550
esac
569
551
}
570
552
571
-
572
- # Set up a directory that we can put in PATH which redirects all git
573
- # calls to 'valgrind git ...'.
574
553
if test -n " $valgrind "
575
554
then
576
555
make_symlink () {
@@ -618,42 +597,33 @@ then
618
597
make_symlink " $symlink_target " " $GIT_VALGRIND /bin/$base " || exit
619
598
}
620
599
621
- # In the case of --valgrind-parallel, we only need to do the
622
- # wrapping once, in the main script. The worker children all
623
- # have $valgrind_only_stride set, so we can skip based on that.
624
- if test -z " $valgrind_only_stride "
625
- then
626
- # override all git executables in TEST_DIRECTORY/..
627
- GIT_VALGRIND=$TEST_DIRECTORY /valgrind
628
- mkdir -p " $GIT_VALGRIND " /bin
629
- for file in $GIT_BUILD_DIR /git* $GIT_BUILD_DIR /test-*
630
- do
631
- make_valgrind_symlink $file
632
- done
633
- # special-case the mergetools loadables
634
- make_symlink " $GIT_BUILD_DIR " /mergetools " $GIT_VALGRIND /bin/mergetools"
635
- OLDIFS=$IFS
636
- IFS=:
637
- for path in $PATH
600
+ # override all git executables in TEST_DIRECTORY/..
601
+ GIT_VALGRIND=$TEST_DIRECTORY /valgrind
602
+ mkdir -p " $GIT_VALGRIND " /bin
603
+ for file in $GIT_BUILD_DIR /git* $GIT_BUILD_DIR /test-*
604
+ do
605
+ make_valgrind_symlink $file
606
+ done
607
+ # special-case the mergetools loadables
608
+ make_symlink " $GIT_BUILD_DIR " /mergetools " $GIT_VALGRIND /bin/mergetools"
609
+ OLDIFS=$IFS
610
+ IFS=:
611
+ for path in $PATH
612
+ do
613
+ ls " $path " /git-* 2> /dev/null |
614
+ while read file
638
615
do
639
- ls " $path " /git-* 2> /dev/null |
640
- while read file
641
- do
642
- make_valgrind_symlink " $file "
643
- done
616
+ make_valgrind_symlink " $file "
644
617
done
645
- IFS= $OLDIFS
646
- fi
618
+ done
619
+ IFS= $OLDIFS
647
620
PATH=$GIT_VALGRIND /bin:$PATH
648
621
GIT_EXEC_PATH=$GIT_VALGRIND /bin
649
622
export GIT_VALGRIND
650
623
GIT_VALGRIND_MODE=" $valgrind "
651
624
export GIT_VALGRIND_MODE
652
625
GIT_VALGRIND_ENABLED=t
653
- if test -n " $valgrind_only " || test -n " $valgrind_only_stride "
654
- then
655
- GIT_VALGRIND_ENABLED=
656
- fi
626
+ test -n " $valgrind_only " && GIT_VALGRIND_ENABLED=
657
627
export GIT_VALGRIND_ENABLED
658
628
elif test -n " $GIT_TEST_INSTALLED "
659
629
then
@@ -730,41 +700,6 @@ then
730
700
else
731
701
mkdir -p " $TRASH_DIRECTORY "
732
702
fi
733
-
734
- # Gross hack to spawn N sub-instances of the tests in parallel, and
735
- # summarize the results. Note that if this is enabled, the script
736
- # terminates at the end of this 'if' block.
737
- if test -n " $valgrind_parallel "
738
- then
739
- for i in $( test_seq 1 $valgrind_parallel )
740
- do
741
- root=" $TRASH_DIRECTORY /vgparallel-$i "
742
- mkdir " $root "
743
- TEST_OUTPUT_DIRECTORY=" $root " \
744
- ${SHELL_PATH} " $0 " \
745
- --root=" $root " --statusprefix=" [$i ] " \
746
- --valgrind=" $valgrind " \
747
- --valgrind-only-stride=" $valgrind_parallel " \
748
- --valgrind-only-offset=" $i " &
749
- pids=" $pids $! "
750
- done
751
- trap " kill $pids " INT TERM HUP
752
- wait $pids
753
- trap - INT TERM HUP
754
- for i in $( test_seq 1 $valgrind_parallel )
755
- do
756
- root=" $TRASH_DIRECTORY /vgparallel-$i "
757
- eval " $( cat " $root /test-results/$( basename " $0 " .sh) " -* .counts |
758
- sed ' s/^\([a-z][a-z]*\) \([0-9][0-9]*\)/inner_\1=\2/' ) "
759
- test_count=$( expr $test_count + $inner_total )
760
- test_success=$( expr $test_success + $inner_success )
761
- test_fixed=$( expr $test_fixed + $inner_fixed )
762
- test_broken=$( expr $test_broken + $inner_broken )
763
- test_failure=$( expr $test_failure + $inner_failed )
764
- done
765
- test_done
766
- fi
767
-
768
703
# Use -P to resolve symlinks in our working directory so that the cwd
769
704
# in subprocesses like git equals our $PWD (for pathname comparisons).
770
705
cd -P " $TRASH_DIRECTORY " || exit 1
0 commit comments