+2005-08-23 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by mjs.
+
+ * Scripts/run-webkit-tests:
+ Made --leaks option more readable by printing to a file.
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=4590
+
2005-08-22 Eric Seidel <eseidel@apple.com>
Fix by Tobias Lidskog <tobiaslidskog@mac.com>
}
if ($checkLeaks) {
- print "Checking for leaks in $toolname:\n";
- system "leaks", $toolPID;
+ print "\n";
+ printLeaks($toolname, $toolPID);
if ($pixelTests) {
- print "Checking for leaks in ImageDiff:\n";
- system "leaks", $imageDiffToolPID;
+ printLeaks("ImageDiff", $imageDiffToolPID);
}
}
system "open", $testResults;
}
+sub printLeaks
+{
+ my $toolName = shift;
+ my $toolPID = shift;
+ my $leaksFilePath = "";
+
+ print "\nChecking for leaks in $toolName...\n";
+ my $leaksOutput = `leaks $toolPID`;
+ $leaksOutput =~ m/Process $toolPID: (\d+) leaks for (\d+) total leaked bytes./;
+ if ($1) {
+ $leaksFilePath = "$testResultsDirectory/$toolName-leaks.txt";
+ print "$1 leaks ($2 bytes) were found in $toolName, full results: $leaksFilePath\n";
+ if (open LEAKS, ">", $leaksFilePath) {
+ print LEAKS $leaksOutput;
+ close LEAKS;
+ } else {
+ print "ERROR: Failed to write leaks to file: $leaksFilePath";
+ }
+ }
+
+ $leaksFilePath;
+}
+
sub getFilesize
{
my $filename = shift;