aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-01-09 11:26:57 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-01-09 11:26:57 +0000
commitba25cad6e2d218c40e33bc1165362378f84471ab (patch)
tree6428f6eda9404483c75ca38c0ecc50b34fc847d2 /tests
parentabb01123cbd58dda279230ab95f7e817ae0c5a57 (diff)
pass a file name to memanalyze to read from instead of using stdin
Diffstat (limited to 'tests')
-rwxr-xr-xtests/memanalyze.pl22
-rwxr-xr-xtests/runtests.pl2
2 files changed, 20 insertions, 4 deletions
diff --git a/tests/memanalyze.pl b/tests/memanalyze.pl
index 71fc1fde1..c354a5687 100755
--- a/tests/memanalyze.pl
+++ b/tests/memanalyze.pl
@@ -6,14 +6,17 @@
# MEM mprintf.c:1103 realloc(e5718, 64) = e6118
# MEM sendf.c:232 free(f6520)
-do {
+while(1) {
if($ARGV[0] eq "-v") {
$verbose=1;
+ shift @ARGV;
}
elsif($ARGV[0] eq "-t") {
$trace=1;
+ shift @ARGV;
}
-} while (shift @ARGV);
+ last;
+}
my $maxmem;
@@ -26,7 +29,19 @@ sub newtotal {
}
}
-while(<STDIN>) {
+my $file = $ARGV[0];
+
+if(! -f $file) {
+ print "Usage: memanalyze.pl [options] <dump file>\n",
+ "Options:\n",
+ " -v Verbose\n",
+ " -t Trace\n";
+ exit;
+}
+
+open(FILE, "<$file");
+
+while(<FILE>) {
chomp $_;
$line = $_;
@@ -219,6 +234,7 @@ while(<STDIN>) {
print "Not recognized prefix line: $line\n";
}
}
+close(FILE);
if($totalmem) {
print "Leak detected: memory still allocated: $totalmem bytes\n";
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 921cd28bf..0690d4f09 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -777,7 +777,7 @@ sub singletest {
print "\n** ALERT! memory debuggin without any output file?\n";
}
else {
- my @memdata=`$memanalyze < $memdump`;
+ my @memdata=`$memanalyze $memdump`;
my $leak=0;
for(@memdata) {
if($_ ne "") {