Have perf/vg_perf handling EXTRA_REGTEST_OPTS
Similarly to tests/vg_regtest, allow to run all perf tests with extra options.
(note: it was preferred to use the same env var name).
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12777 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/perf/vg_perf.in b/perf/vg_perf.in
index 9be023e..2c34dc9 100644
--- a/perf/vg_perf.in
+++ b/perf/vg_perf.in
@@ -43,6 +43,11 @@
#
# The prerequisite command, if present, must return 0 otherwise the test is
# skipped.
+# 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
+# .vgperf file. Note: the env var is the same as vg_regtest.
#----------------------------------------------------------------------------
use warnings;
@@ -69,6 +74,7 @@
Any tools named in --tools must be present in all directories specified
with --vg. (This is not checked.)
+ Use EXTRA_REGTEST_OPTS to supply extra args for all tests
END
;
@@ -285,6 +291,11 @@
}
}
+ # 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 : "";
+
foreach my $vgdir (@vgdirs) {
# Benchmark name
printf("%-8s ", $name);
@@ -323,7 +334,7 @@
my $vgsetup = "";
my $vgcmd = "$vgdir/coregrind/valgrind "
- . "--command-line-only=yes --tool=$tool -q "
+ . "--command-line-only=yes --tool=$tool $extraopts -q "
. "--memcheck:leak-check=no "
. "--trace-children=yes "
. "$vgopts ";
@@ -427,10 +438,22 @@
#----------------------------------------------------------------------------
# main()
#----------------------------------------------------------------------------
+sub warn_about_EXTRA_REGTEST_OPTS()
+{
+ print "WARNING: \$EXTRA_REGTEST_OPTS is set. You probably don't want\n";
+ print "to run the perf 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) {
@@ -453,6 +476,10 @@
}
summarise_results();
+if ($ENV{"EXTRA_REGTEST_OPTS"}) {
+ warn_about_EXTRA_REGTEST_OPTS();
+}
+
##--------------------------------------------------------------------##
##--- end ---##
##--------------------------------------------------------------------##