Modified: trunk/Tools/ChangeLog (214371 => 214372)
--- trunk/Tools/ChangeLog 2017-03-24 20:46:59 UTC (rev 214371)
+++ trunk/Tools/ChangeLog 2017-03-24 20:51:22 UTC (rev 214372)
@@ -1,3 +1,14 @@
+2017-03-24 Srinivasan Vijayaraghavan <[email protected]>
+
+ Add JSON results for API tests
+ https://bugs.webkit.org/show_bug.cgi?id=170021
+
+ Reviewed by Alexey Proskuryakov.
+
+ * Scripts/run-api-tests:
+ (runTestsBySuite): Appends failures and timeouts to JSON data.
+ (writeJsonDataIfApplicable): Writes JSON data to a file.
+
2017-03-24 Lucas Forschler <[email protected]>
update committer_auth.py to be python 2.7 compliant
Modified: trunk/Tools/Scripts/run-api-tests (214371 => 214372)
--- trunk/Tools/Scripts/run-api-tests 2017-03-24 20:46:59 UTC (rev 214371)
+++ trunk/Tools/Scripts/run-api-tests 2017-03-24 20:51:22 UTC (rev 214372)
@@ -27,9 +27,11 @@
use warnings;
use File::Basename;
+use File::Spec;
use FindBin;
use Getopt::Long qw(:config pass_through);
use IPC::Open3;
+use JSON::PP;
use lib $FindBin::Bin;
use sigtrap qw(die normal-signals);
use webkitdirs;
@@ -43,6 +45,7 @@
sub prepareEnvironmentForRunningTestTool();
sub archCommandLineArgumentsForRestrictedEnvironmentVariables();
sub testToolPaths();
+sub writeJSONDataIfApplicable();
# Defined in VCSUtils.
sub possiblyColored($$);
@@ -62,6 +65,8 @@
my @testsTimedOut;
my $wtfOnly = 0;
my %testToToolMap;
+my %jsonData = ();
+my $jsonFileName;
my $programName = basename($0);
@@ -71,6 +76,7 @@
-v|--verbose Verbose output
-d|--dump-tests Dump the names of testcases without running them
--[no-]build Build (or do not build) unit tests prior to running (default: $buildDefault)
+ --json-output= Create a file at the specified path, listing test failures and timeouts in JSON format.
--root= Path to the pre-built root containing TestWebKitAPI
--show-leaks Show leaks in the output
--no-timeout Disable test timeouts
@@ -97,6 +103,7 @@
'verbose|v' => \$verbose,
'show-leaks' => \$showLeaks,
'no-timeout' => \$disableTimeout,
+ 'json-output=s' => \$jsonFileName,
'dump|d' => \$dumpTests,
'build!' => \$build,
'root=s' => \$root,
@@ -112,6 +119,10 @@
setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
+if (defined($jsonFileName)) {
+ $jsonFileName = File::Spec->rel2abs($jsonFileName);
+}
+
buildTestTool() if $build && !defined($root);
setPathForRunningWebKitApp(\%ENV);
@@ -176,6 +187,13 @@
}
}
+ if (defined($jsonFileName)) {
+ $jsonData{'failures'} = \@testsFailed;
+ $jsonData{'timeouts'} = \@testsTimedOut;
+ }
+
+ writeJSONDataIfApplicable();
+
return @testsFailed > 0 || @testsTimedOut > 0;
}
@@ -413,3 +431,12 @@
}
return ("$pathWTF$suffix.exe", "$pathWebCore$suffix.exe", "$pathWebKit$suffix.exe");
}
+
+sub writeJSONDataIfApplicable()
+{
+ if (defined($jsonFileName)) {
+ open(my $fileHandler, ">", $jsonFileName) or die;
+ print $fileHandler "${\encode_json(\%jsonData)}\n";
+ close($fileHandler);
+ }
+}