runtests: use valgrind for torture as well

NOTE: it makes them terribly slow. I recommend only using valgrind for
specific torture tests or using lots of patience.
This commit is contained in:
Daniel Stenberg 2017-10-10 22:52:17 +02:00
parent ad164eceb3
commit ed0b6b18f6
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -561,8 +561,7 @@ sub runclientoutput {
# Memory allocation test and failure torture testing.
#
sub torture {
my $testcmd = shift;
my $gdbline = shift;
my ($testcmd, $testnum, $gdbline) = @_;
# remove memdump first to be sure we get a new nice and clean one
unlink($memdump);
@ -610,6 +609,20 @@ sub torture {
# remove memdump first to be sure we get a new nice and clean one
unlink($memdump);
my $cmd = $testcmd;
if($valgrind && !$gdbthis) {
my @valgrindoption = getpart("verify", "valgrind");
if((!@valgrindoption) || ($valgrindoption[0] !~ /disable/)) {
my $valgrindcmd = "$valgrind ";
$valgrindcmd .= "$valgrind_tool " if($valgrind_tool);
$valgrindcmd .= "--quiet --leak-check=yes ";
$valgrindcmd .= "--suppressions=$srcdir/valgrind.supp ";
# $valgrindcmd .= "--gen-suppressions=all ";
$valgrindcmd .= "--num-callers=16 ";
$valgrindcmd .= "${valgrind_logfile}=$LOGDIR/valgrind$testnum";
$cmd = "$valgrindcmd $testcmd";
}
}
logmsg "*** Function number $limit is now set to fail ***\n" if($gdbthis);
my $ret = 0;
@ -617,7 +630,7 @@ sub torture {
runclient($gdbline);
}
else {
$ret = runclient($testcmd);
$ret = runclient($cmd);
}
#logmsg "$_ Returned " . ($ret >> 8) . "\n";
@ -631,6 +644,20 @@ sub torture {
$fail = 2;
}
if($valgrind) {
my @e = valgrindparse("$LOGDIR/valgrind$testnum");
if(@e && $e[0]) {
if($automakestyle) {
logmsg "FAIL: torture $testnum - valgrind\n";
}
else {
logmsg " valgrind ERROR ";
logmsg @e;
}
$fail = 1;
}
}
# verify that it returns a proper error code, doesn't leak memory
# and doesn't core dump
if(($ret & 255) || ($ret >> 8) >= 128) {
@ -3173,7 +3200,7 @@ sub fixarray {
my @in = @_;
for(@in) {
subVariables \$_;
subVariables(\$_);
}
return @in;
}
@ -3638,7 +3665,7 @@ sub singletest {
if(@setenv) {
foreach my $s (@setenv) {
chomp $s;
subVariables \$s;
subVariables(\$s);
if($s =~ /([^=]*)=(.*)/) {
my ($var, $content) = ($1, $2);
# remember current setting, to restore it once test runs
@ -4003,7 +4030,8 @@ sub singletest {
# run the command line we built
if ($torture) {
$cmdres = torture($CMDLINE,
"$gdb --directory libtest $DBGCURL -x $LOGDIR/gdbcmd");
$testnum,
"$gdb --directory libtest $DBGCURL -x $LOGDIR/gdbcmd");
}
elsif($gdbthis) {
my $GDBW = ($gdbxwin) ? "-w" : "";
@ -5310,8 +5338,6 @@ while(@ARGV) {
if($xtra =~ s/(\d+)$//) {
$tortalloc = $1;
}
# we undef valgrind to make this fly in comparison
undef $valgrind;
}
elsif($ARGV[0] eq "-a") {
# continue anyway, even if a test fail