Skip to content

Commit

Permalink
test verrou with none and callgrind tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lathuili committed Feb 7, 2025
1 parent ec61b61 commit 52ee13e
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 8 deletions.
8 changes: 2 additions & 6 deletions travis.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,15 @@ check-install:

check:
@echo "*** BUILD TESTS ***"
cd ../valgrind+verrou && make -C tests check
cd ../valgrind+verrou && make -C verrou check

@echo "*** VALGRIND TESTS ***"
cd ../valgrind+verrou && perl tests/vg_regtest verrou
make -C ../valgrind+verrou/verrou/unitTest/ valgrind-test

check-error:
cd ../valgrind+verrou/verrou/tests && tail -n+1 *.stdout.diff *.stdout.out *.stderr.diff *.stderr.out
@false

unit-test:
@echo "*** UNIT TESTS ***"
cd ../valgrind+verrou/verrou/unitTest && make
cd ../valgrind+verrou/verrou/unitTestw && make

post-regtest-checks:
@echo "*** POST_REGTEST_CHECKS ***"
Expand Down
17 changes: 15 additions & 2 deletions unitTest/makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SUBREPLIST=checkRounding checkStatRounding checkUCB-vecto check-libM ddTest check-verrou-dd-task ddStdOut ddLibm verrouDDPython

.PHONY: valgrind-test
.PHONY: valgrind-test none-test callgrind-test verrou-test

all:
for i in $(SUBREPLIST) ; do \
Expand All @@ -9,11 +9,24 @@ all:


#to be able to do valgrind test from this directory
valgrind-test:
valgrind-test: verrou-test none-test callgrind-test #helgrind-test

verrou-test:
make -C ../../tests check
make -C ../../verrou check
cd ../..; perl ./tests/vg_regtest verrou/tests

none-test:
make -C ../../tests check
cd ../..; perl ./tests/vg_regtest none/tests --force-tool=verrou --stderr-ignore

callgrind-test:
make -C ../../tests check
cd ../..; perl ./tests/vg_regtest callgrind/tests --force-tool=verrou --stderr-ignore --toolopt-ignore --cleanup-ignore --post-ignore

helgrind-test:
make -C ../../tests check
cd ../..; perl ./tests/vg_regtest helgrind/tests --force-tool=verrou --stderr-ignore --toolopt-ignore

clean:
for i in $(SUBREPLIST) ; do \
Expand Down
116 changes: 116 additions & 0 deletions valgrind.vgregtest.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
diff --git a/tests/vg_regtest.in b/tests/vg_regtest.in
index 3471322b0..ef7ef166f 100755
--- a/tests/vg_regtest.in
+++ b/tests/vg_regtest.in
@@ -163,7 +163,12 @@ my $stderrB_filter_args;# arguments passed to stderr_filterB
my $stdinB; # Input file for progB
my $prereq; # prerequisite test to satisfy before running test
my $post; # check command after running test
+my $post_ignore; # ignore previous variable
my $cleanup; # cleanup command to run
+my $cleanup_ignore; # ignore previous variable
+my $force_tool; # replace the tool detection
+my $stderr_ignore; # ignore stderr
+my $toolopt_ignore; # ignore vgopt
my @env = (); # environment variable to set prior calling $prog
my @envB = (); # environment variable to set prior calling $progB

@@ -252,6 +257,16 @@ sub process_command_line()
$keepunfiltered = 1;
} elsif ($arg =~ /^--loop-till-fail$/) {
$looptillfail = 1;
+ } elsif ($arg =~ /^--force-tool=(.*)$/) {
+ $force_tool = $1;
+ } elsif ($arg =~ /^--stderr-ignore$/){
+ $stderr_ignore = 1;
+ } elsif ($arg =~ /^--post-ignore$/){
+ $post_ignore = 1;
+ } elsif ($arg =~ /^--cleanup-ignore$/){
+ $cleanup_ignore = 1;
+ } elsif ($arg =~ /^--toolopt-ignore$/) {
+ $toolopt_ignore = 1;
} else {
die $usage;
}
@@ -407,6 +422,9 @@ sub filtered_rename($$$)
# from a directory name like "/foo/cachesim/tests/" determine the tool name
sub determine_tool()
{
+ if( defined($force_tool)){
+ return $force_tool
+ }
my $dir = `pwd`;
$dir =~ /.*\/([^\/]+)\/tests.*/; # foo/tool_name/tests/foo
return $1;
@@ -532,7 +550,12 @@ sub do_one_test($$)

# Pass the appropriate --tool option for the directory (can be overridden
# by an "args:" line, though).
- my $tool=determine_tool();
+ my $tool = determine_tool();
+ my $tool_opts = "$extraopts $vgopts " ;
+ if ( defined $toolopt_ignore ) {
+ $tool_opts=" ";
+ }
+
if (defined $outer_valgrind ) {
# in an outer-inner setup, only set VALGRIND_LIB_INNER
mysystem(*VGTESTLOG,
@@ -543,7 +566,7 @@ sub do_one_test($$)
. "$run_outer_args "
. "$valgrind --command-line-only=yes --memcheck:leak-check=no "
. "--sim-hints=no-inner-prefix "
- . "--tool=$tool $extraopts $vgopts "
+ . "--tool=$tool $tool_opts "
. "$prog $args > $name.stdout.out 2> $name.stderr.out");
} else {
# Set both VALGRIND_LIB and VALGRIND_LIB_INNER in case this Valgrind
@@ -551,7 +574,7 @@ sub do_one_test($$)
mysystem(*VGTESTLOG,
"$envvars VALGRIND_LIB=$valgrind_lib VALGRIND_LIB_INNER=$valgrind_lib "
. "$valgrind --command-line-only=yes --memcheck:leak-check=no "
- . "--tool=$tool $extraopts $vgopts "
+ . "--tool=$tool $tool_opts "
. "$prog $args > $name.stdout.out 2> $name.stderr.out");
}

@@ -578,6 +601,7 @@ sub do_one_test($$)
my $diffrc = do_diffs($fullname, $name, "stdout", *VGTESTLOG, \@stdout_exps);
if (defined $diffrc) { $rc = $diffrc; }

+ if (! $stderr_ignore){
# Filter stderr
$stderr_filter_args = $name if (! defined $stderr_filter_args);
mysystem(*VGTESTLOG,
@@ -588,7 +612,7 @@ sub do_one_test($$)
(0 != scalar @stderr_exps) or die "Could not find `$name.stderr.exp*'\n";
$diffrc = do_diffs($fullname, $name, "stderr", *VGTESTLOG, \@stderr_exps);
if (defined $diffrc) { $rc = $diffrc; }
-
+ }
if (defined $progB) {
# wait for the child to be finished
# tried things such as:
@@ -639,6 +663,7 @@ sub do_one_test($$)
}

# Maybe do post-test check
+ if( !defined $post_ignore){
if (defined $post) {
my $postrc = mysystem(*VGTESTLOG, "$post > $name.post.out");
# Transcribe stdout
@@ -657,11 +682,13 @@ sub do_one_test($$)
do_diffs($fullname, $name, "post", *VGTESTLOG, \@post_exps);
}
}
-
+ }
+ if( !defined $cleanup_ignore){
if (defined $cleanup) {
(mysystem(*VGTESTLOG, "$cleanup") == 0) or
print("(cleanup operation failed: $cleanup)\n");
}
+ }

close(VGTESTLOG);
$num_tests_done++;

0 comments on commit 52ee13e

Please sign in to comment.