From: weinig@apple.com Date: Mon, 3 Jan 2011 18:40:55 +0000 (+0000) Subject: Make run-api-tests less chatty. X-Git-Url: https://git.webkit.org/?p=WebKit-https.git;a=commitdiff_plain;h=c54315a3ccf82df063cbbda7c34bd8ce97827d51;hp=aad3f9575e0e2f6792ae3fe9476808ca67402220 Make run-api-tests less chatty. https://bugs.webkit.org/show_bug.cgi?id=51831 Reviewed by Anders Carlsson. - Make script quiet by default and add --verbose option (replacing --quiet). - When not verbose, pipe stdout and stderr to devnull. * Scripts/run-api-tests: git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74906 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 01bbb28759cb..1b46228c5db6 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,15 @@ +2011-01-03 Sam Weinig + + Reviewed by Anders Carlsson. + + Make run-api-tests less chatty. + https://bugs.webkit.org/show_bug.cgi?id=51831 + + - Make script quiet by default and add --verbose option (replacing --quiet). + - When not verbose, pipe stdout and stderr to devnull. + + * Scripts/run-api-tests: + 2011-01-03 Pratik Solanki Unreviewed. Adding myself to committers.py. diff --git a/Tools/Scripts/run-api-tests b/Tools/Scripts/run-api-tests index 29430a80d137..b8d388df6286 100755 --- a/Tools/Scripts/run-api-tests +++ b/Tools/Scripts/run-api-tests @@ -1,6 +1,6 @@ #!/usr/bin/perl -w -# Copyright (C) 2010 Apple Inc. All rights reserved. +# Copyright (C) 2010, 2011 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -46,20 +46,20 @@ sub populateTests(); sub buildTestTool(); my $showHelp = 0; -my $quiet = 0; +my $verbose = 0; my $dump = 0; my $programName = basename($0); my $usage = < \$showHelp, - 'quiet|q' => \$quiet, + 'verbose|v' => \$verbose, 'dump|d' => \$dump, ); @@ -132,11 +132,32 @@ sub runTest($$) $ENV{DYLD_FRAMEWORK_PATH} = $productDir; $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; my $apiTesterPath = "$productDir/TestWebKitAPI"; + + local *DEVNULL; + my ($childIn, $childOut, $childErr); + unless ($verbose) { + open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null"; + $childOut = ">&DEVNULL"; + $childErr = ">&DEVNULL"; + } else { + $childOut = ">&STDOUT"; + $childErr = ">&STDERR"; + } + + my $pid; if (architecture()) { - $result = system "arch", "-" . architecture(), $apiTesterPath, $test, @ARGV; + $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, $test, @ARGV) or die "Failed to run test: $test."; } else { - $result = system $apiTesterPath, $test, @ARGV; + $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, $test, @ARGV) or die "Failed to run test: $test."; } + + close($childIn); + close($childOut); + close($childErr); + close(DEVNULL) unless ($verbose); + + waitpid($pid, 0); + my $result = $?; } elsif (isAppleWinWebKit()) { my $apiTesterNameSuffix; if (configurationForVisualStudio() ne "Debug_All") { @@ -168,15 +189,27 @@ sub populateTests() $ENV{WEBKIT_UNSET_DYLD_FRAMEWORK_PATH} = "YES"; my $apiTesterPath = "$productDir/TestWebKitAPI"; - my ($pid, $childIn, $childOut); + local *DEVNULL; + my ($childIn, $childOut, $childErr); + unless ($verbose) { + open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null"; + $childErr = ">&DEVNULL"; + } else { + $childErr = ">&STDERR"; + } + + my $pid; if (architecture()) { - $pid = open3($childIn, $childOut, ">&STDERR", "arch", "-" . architecture(), $apiTesterPath, "--dump-tests") or die "Failed to build list of tests!"; + $pid = open3($childIn, $childOut, $childErr, "arch", "-" . architecture(), $apiTesterPath, "--dump-tests") or die "Failed to build list of tests!"; } else { - $pid = open3($childIn, $childOut, ">&STDERR", $apiTesterPath, "--dump-tests") or die "Failed to build list of tests!"; + $pid = open3($childIn, $childOut, $childErr, $apiTesterPath, "--dump-tests") or die "Failed to build list of tests!"; } + close($childIn); @tests = <$childOut>; close($childOut); + close($childErr); + close(DEVNULL) unless ($verbose); waitpid($pid, 0); my $result = $?; @@ -219,7 +252,7 @@ sub buildTestTool() local *DEVNULL; my ($childIn, $childOut, $childErr); - if ($quiet) { + unless ($verbose) { open(DEVNULL, ">", File::Spec->devnull()) or die "Failed to open /dev/null"; $childOut = ">&DEVNULL"; $childErr = ">&DEVNULL"; @@ -231,13 +264,14 @@ sub buildTestTool() my @args = argumentsForConfiguration(); my $buildProcess = open3($childIn, $childOut, $childErr, "Tools/Scripts/$buildTestTool", @args) or die "Failed to run " . $buildTestTool; + close($childIn); - waitpid $buildProcess, 0; - my $buildResult = $?; close($childOut); close($childErr); + close(DEVNULL) unless ($verbose); - close DEVNULL if ($quiet); + waitpid($buildProcess, 0); + my $buildResult = $?; if ($buildResult) { print STDERR "Compiling TestWebKitAPI failed!\n";