mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
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:
parent
ad164eceb3
commit
ed0b6b18f6
@ -561,8 +561,7 @@ sub runclientoutput {
|
|||||||
# Memory allocation test and failure torture testing.
|
# Memory allocation test and failure torture testing.
|
||||||
#
|
#
|
||||||
sub torture {
|
sub torture {
|
||||||
my $testcmd = shift;
|
my ($testcmd, $testnum, $gdbline) = @_;
|
||||||
my $gdbline = shift;
|
|
||||||
|
|
||||||
# remove memdump first to be sure we get a new nice and clean one
|
# remove memdump first to be sure we get a new nice and clean one
|
||||||
unlink($memdump);
|
unlink($memdump);
|
||||||
@ -610,6 +609,20 @@ sub torture {
|
|||||||
# remove memdump first to be sure we get a new nice and clean one
|
# remove memdump first to be sure we get a new nice and clean one
|
||||||
unlink($memdump);
|
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);
|
logmsg "*** Function number $limit is now set to fail ***\n" if($gdbthis);
|
||||||
|
|
||||||
my $ret = 0;
|
my $ret = 0;
|
||||||
@ -617,7 +630,7 @@ sub torture {
|
|||||||
runclient($gdbline);
|
runclient($gdbline);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$ret = runclient($testcmd);
|
$ret = runclient($cmd);
|
||||||
}
|
}
|
||||||
#logmsg "$_ Returned " . ($ret >> 8) . "\n";
|
#logmsg "$_ Returned " . ($ret >> 8) . "\n";
|
||||||
|
|
||||||
@ -631,6 +644,20 @@ sub torture {
|
|||||||
$fail = 2;
|
$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
|
# verify that it returns a proper error code, doesn't leak memory
|
||||||
# and doesn't core dump
|
# and doesn't core dump
|
||||||
if(($ret & 255) || ($ret >> 8) >= 128) {
|
if(($ret & 255) || ($ret >> 8) >= 128) {
|
||||||
@ -3173,7 +3200,7 @@ sub fixarray {
|
|||||||
my @in = @_;
|
my @in = @_;
|
||||||
|
|
||||||
for(@in) {
|
for(@in) {
|
||||||
subVariables \$_;
|
subVariables(\$_);
|
||||||
}
|
}
|
||||||
return @in;
|
return @in;
|
||||||
}
|
}
|
||||||
@ -3638,7 +3665,7 @@ sub singletest {
|
|||||||
if(@setenv) {
|
if(@setenv) {
|
||||||
foreach my $s (@setenv) {
|
foreach my $s (@setenv) {
|
||||||
chomp $s;
|
chomp $s;
|
||||||
subVariables \$s;
|
subVariables(\$s);
|
||||||
if($s =~ /([^=]*)=(.*)/) {
|
if($s =~ /([^=]*)=(.*)/) {
|
||||||
my ($var, $content) = ($1, $2);
|
my ($var, $content) = ($1, $2);
|
||||||
# remember current setting, to restore it once test runs
|
# remember current setting, to restore it once test runs
|
||||||
@ -4003,7 +4030,8 @@ sub singletest {
|
|||||||
# run the command line we built
|
# run the command line we built
|
||||||
if ($torture) {
|
if ($torture) {
|
||||||
$cmdres = torture($CMDLINE,
|
$cmdres = torture($CMDLINE,
|
||||||
"$gdb --directory libtest $DBGCURL -x $LOGDIR/gdbcmd");
|
$testnum,
|
||||||
|
"$gdb --directory libtest $DBGCURL -x $LOGDIR/gdbcmd");
|
||||||
}
|
}
|
||||||
elsif($gdbthis) {
|
elsif($gdbthis) {
|
||||||
my $GDBW = ($gdbxwin) ? "-w" : "";
|
my $GDBW = ($gdbxwin) ? "-w" : "";
|
||||||
@ -5310,8 +5338,6 @@ while(@ARGV) {
|
|||||||
if($xtra =~ s/(\d+)$//) {
|
if($xtra =~ s/(\d+)$//) {
|
||||||
$tortalloc = $1;
|
$tortalloc = $1;
|
||||||
}
|
}
|
||||||
# we undef valgrind to make this fly in comparison
|
|
||||||
undef $valgrind;
|
|
||||||
}
|
}
|
||||||
elsif($ARGV[0] eq "-a") {
|
elsif($ARGV[0] eq "-a") {
|
||||||
# continue anyway, even if a test fail
|
# continue anyway, even if a test fail
|
||||||
|
Loading…
Reference in New Issue
Block a user