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=* )
227
218
esac
228
219
done
229
220
230
- if test -n " $valgrind_only " || test -n " $valgrind_only_stride "
221
+ if test -n " $valgrind_only "
231
222
then
232
223
test -z " $valgrind " && valgrind=memcheck
233
224
test -z " $verbose " && verbose_only=" $valgrind_only "
@@ -377,9 +368,7 @@ maybe_teardown_verbose () {
377
368
last_verbose=t
378
369
maybe_setup_verbose () {
379
370
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; }
371
+ if match_pattern_list $test_count $verbose_only
383
372
then
384
373
exec 4>&2 3>&1
385
374
# Emit a delimiting blank line when going from
@@ -403,17 +392,13 @@ maybe_teardown_valgrind () {
403
392
404
393
maybe_setup_valgrind () {
405
394
test -z " $GIT_VALGRIND " && return
406
- if test -z " $valgrind_only " && test -z " $valgrind_only_stride "
395
+ if test -z " $valgrind_only "
407
396
then
408
397
GIT_VALGRIND_ENABLED=t
409
398
return
410
399
fi
411
400
GIT_VALGRIND_ENABLED=
412
401
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
402
then
418
403
GIT_VALGRIND_ENABLED=t
419
404
fi
@@ -568,9 +553,6 @@ test_done () {
568
553
esac
569
554
}
570
555
571
-
572
- # Set up a directory that we can put in PATH which redirects all git
573
- # calls to 'valgrind git ...'.
574
556
if test -n " $valgrind "
575
557
then
576
558
make_symlink () {
@@ -618,42 +600,33 @@ then
618
600
make_symlink " $symlink_target " " $GIT_VALGRIND /bin/$base " || exit
619
601
}
620
602
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
603
+ # override all git executables in TEST_DIRECTORY/..
604
+ GIT_VALGRIND=$TEST_DIRECTORY /valgrind
605
+ mkdir -p " $GIT_VALGRIND " /bin
606
+ for file in $GIT_BUILD_DIR /git* $GIT_BUILD_DIR /test-*
607
+ do
608
+ make_valgrind_symlink $file
609
+ done
610
+ # special-case the mergetools loadables
611
+ make_symlink " $GIT_BUILD_DIR " /mergetools " $GIT_VALGRIND /bin/mergetools"
612
+ OLDIFS=$IFS
613
+ IFS=:
614
+ for path in $PATH
615
+ do
616
+ ls " $path " /git-* 2> /dev/null |
617
+ while read file
638
618
do
639
- ls " $path " /git-* 2> /dev/null |
640
- while read file
641
- do
642
- make_valgrind_symlink " $file "
643
- done
619
+ make_valgrind_symlink " $file "
644
620
done
645
- IFS= $OLDIFS
646
- fi
621
+ done
622
+ IFS= $OLDIFS
647
623
PATH=$GIT_VALGRIND /bin:$PATH
648
624
GIT_EXEC_PATH=$GIT_VALGRIND /bin
649
625
export GIT_VALGRIND
650
626
GIT_VALGRIND_MODE=" $valgrind "
651
627
export GIT_VALGRIND_MODE
652
628
GIT_VALGRIND_ENABLED=t
653
- if test -n " $valgrind_only " || test -n " $valgrind_only_stride "
654
- then
655
- GIT_VALGRIND_ENABLED=
656
- fi
629
+ test -n " $valgrind_only " && GIT_VALGRIND_ENABLED=
657
630
export GIT_VALGRIND_ENABLED
658
631
elif test -n " $GIT_TEST_INSTALLED "
659
632
then
@@ -739,41 +712,6 @@ then
739
712
else
740
713
mkdir -p " $TRASH_DIRECTORY "
741
714
fi
742
-
743
- # Gross hack to spawn N sub-instances of the tests in parallel, and
744
- # summarize the results. Note that if this is enabled, the script
745
- # terminates at the end of this 'if' block.
746
- if test -n " $valgrind_parallel "
747
- then
748
- for i in $( test_seq 1 $valgrind_parallel )
749
- do
750
- root=" $TRASH_DIRECTORY /vgparallel-$i "
751
- mkdir " $root "
752
- TEST_OUTPUT_DIRECTORY=" $root " \
753
- ${SHELL_PATH} " $0 " \
754
- --root=" $root " --statusprefix=" [$i ] " \
755
- --valgrind=" $valgrind " \
756
- --valgrind-only-stride=" $valgrind_parallel " \
757
- --valgrind-only-offset=" $i " &
758
- pids=" $pids $! "
759
- done
760
- trap " kill $pids " INT TERM HUP
761
- wait $pids
762
- trap - INT TERM HUP
763
- for i in $( test_seq 1 $valgrind_parallel )
764
- do
765
- root=" $TRASH_DIRECTORY /vgparallel-$i "
766
- eval " $( cat " $root /test-results/$( basename " $0 " .sh) " -* .counts |
767
- sed ' s/^\([a-z][a-z]*\) \([0-9][0-9]*\)/inner_\1=\2/' ) "
768
- test_count=$( expr $test_count + $inner_total )
769
- test_success=$( expr $test_success + $inner_success )
770
- test_fixed=$( expr $test_fixed + $inner_fixed )
771
- test_broken=$( expr $test_broken + $inner_broken )
772
- test_failure=$( expr $test_failure + $inner_failed )
773
- done
774
- test_done
775
- fi
776
-
777
715
# Use -P to resolve symlinks in our working directory so that the cwd
778
716
# in subprocesses like git equals our $PWD (for pathname comparisons).
779
717
cd -P " $TRASH_DIRECTORY " || exit 1
0 commit comments