From: Julian Seward Date: Fri, 26 May 2006 00:13:21 +0000 (+0000) Subject: Read extra args for all tests from $EXTRA_REGTEST_OPTS, which is X-Git-Tag: svn/VALGRIND_3_2_0~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d419c4762b123d4bc8aafc29f5fbed26d2ca5307;p=thirdparty%2Fvalgrind.git Read extra args for all tests from $EXTRA_REGTEST_OPTS, which is useful (eg) for running tests with --sanity-level= set. Print a big warning before and after the tests if it is set. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5931 --- diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in index 14da362f60..1732e91a75 100755 --- a/tests/vg_regtest.in +++ b/tests/vg_regtest.in @@ -67,6 +67,12 @@ # If results don't match, the output can be found in .std.out, # and the diff between expected and actual in .std.diff[0-9]*. # +# Sometimes it is useful to run all the tests at a high sanity check +# level or with arbitrary other flags. To make this simple, extra +# options, applied to all tests run, are read from $EXTRA_REGTEST_OPTS, +# and handed to valgrind prior to any other flags specified by the +# .vgtest file. +# # Notes on adding regression tests for a new tool are in # coregrind/docs/coregrind_tools.html. #---------------------------------------------------------------------------- @@ -272,6 +278,11 @@ sub do_one_test($$) my $name = $1; my $fullname = "$dir/$name"; + # Pull any extra options (for example, --sanity-level=4) + # from $EXTRA_REGTEST_OPTS. + my $maybe_extraopts = $ENV{"EXTRA_REGTEST_OPTS"}; + my $extraopts = $maybe_extraopts ? $maybe_extraopts : ""; + read_vgtest_file($vgtest); if (defined $prereq) { @@ -281,7 +292,7 @@ sub do_one_test($$) } } - printf("%-16s valgrind $vgopts $prog $args\n", "$name:"); + printf("%-16s valgrind $extraopts $vgopts $prog $args\n", "$name:"); # Pass the appropriate --tool option for the directory (can be overridden # by an "args:" line, though). Set both VALGRIND_LIB and @@ -290,7 +301,7 @@ sub do_one_test($$) my $tool=determine_tool(); mysystem("VALGRIND_LIB=$tests_dir/.in_place VALGRIND_LIB_INNER=$tests_dir/.in_place " . "$valgrind --command-line-only=yes --memcheck:leak-check=no " - . "--tool=$tool $vgopts " + . "--tool=$tool $extraopts $vgopts " . "$prog $args > $name.stdout.out 2> $name.stderr.out"); # Filter stdout @@ -408,10 +419,22 @@ sub summarise_results #---------------------------------------------------------------------------- # main(), sort of #---------------------------------------------------------------------------- +sub warn_about_EXTRA_REGTEST_OPTS() +{ + print "WARNING: \$EXTRA_REGTEST_OPTS is set. You probably don't want\n"; + print "to run the regression tests with it set, unless you are doing some\n"; + print "strange experiment, and/or you really know what you are doing.\n"; + print "\n"; +} # nuke VALGRIND_OPTS $ENV{"VALGRIND_OPTS"} = ""; +if ($ENV{"EXTRA_REGTEST_OPTS"}) { + print "\n"; + warn_about_EXTRA_REGTEST_OPTS(); +} + my @fs = process_command_line(); foreach my $f (@fs) { if (-d $f) { @@ -434,6 +457,10 @@ foreach my $f (@fs) { } summarise_results(); +if ($ENV{"EXTRA_REGTEST_OPTS"}) { + warn_about_EXTRA_REGTEST_OPTS(); +} + if (0 == $num_failures{"stdout"} && 0 == $num_failures{"stderr"} && 0 == $num_failures{"posttest"}) {