Changeset 214372 in webkit


Ignore:
Timestamp:
Mar 24, 2017 1:51:22 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Add JSON results for API tests
https://bugs.webkit.org/show_bug.cgi?id=170021

Patch by Srinivasan Vijayaraghavan <svijayaraghavan@apple.com> on 2017-03-24
Reviewed by Alexey Proskuryakov.

  • Scripts/run-api-tests:

(runTestsBySuite): Appends failures and timeouts to JSON data.
(writeJsonDataIfApplicable): Writes JSON data to a file.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r214367 r214372  
     12017-03-24  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
     2
     3        Add JSON results for API tests
     4        https://bugs.webkit.org/show_bug.cgi?id=170021
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * Scripts/run-api-tests:
     9        (runTestsBySuite): Appends failures and timeouts to JSON data.
     10        (writeJsonDataIfApplicable): Writes JSON data to a file.
     11
    1122017-03-24  Lucas Forschler  <lforschler@apple.com>
    213
  • trunk/Tools/Scripts/run-api-tests

    r213654 r214372  
    2828
    2929use File::Basename;
     30use File::Spec;
    3031use FindBin;
    3132use Getopt::Long qw(:config pass_through);
    3233use IPC::Open3;
     34use JSON::PP;
    3335use lib $FindBin::Bin;
    3436use sigtrap qw(die normal-signals);
     
    4446sub archCommandLineArgumentsForRestrictedEnvironmentVariables();
    4547sub testToolPaths();
     48sub writeJSONDataIfApplicable();
    4649
    4750# Defined in VCSUtils.
     
    6366my $wtfOnly = 0;
    6467my %testToToolMap;
     68my %jsonData = ();
     69my $jsonFileName;
    6570
    6671
     
    7277  -d|--dump-tests       Dump the names of testcases without running them
    7378  --[no-]build          Build (or do not build) unit tests prior to running (default: $buildDefault)
     79  --json-output=        Create a file at the specified path, listing test failures and timeouts in JSON format.
    7480  --root=               Path to the pre-built root containing TestWebKitAPI
    7581  --show-leaks          Show leaks in the output
     
    98104    'show-leaks' => \$showLeaks,
    99105    'no-timeout' => \$disableTimeout,
     106    'json-output=s' => \$jsonFileName,
    100107    'dump|d' => \$dumpTests,
    101108    'build!' => \$build,
     
    112119
    113120setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
     121
     122if (defined($jsonFileName)) {
     123    $jsonFileName = File::Spec->rel2abs($jsonFileName);
     124}
    114125
    115126buildTestTool() if $build && !defined($root);
     
    176187        }
    177188    }
     189
     190    if (defined($jsonFileName)) {
     191        $jsonData{'failures'} = \@testsFailed;
     192        $jsonData{'timeouts'} = \@testsTimedOut;
     193    }
     194
     195    writeJSONDataIfApplicable();
    178196
    179197    return @testsFailed > 0 || @testsTimedOut > 0;
     
    414432    return ("$pathWTF$suffix.exe", "$pathWebCore$suffix.exe", "$pathWebKit$suffix.exe");
    415433}
     434
     435sub writeJSONDataIfApplicable()
     436{
     437    if (defined($jsonFileName)) {
     438        open(my $fileHandler, ">", $jsonFileName) or die;
     439        print $fileHandler "${\encode_json(\%jsonData)}\n";
     440        close($fileHandler);
     441    }
     442}
Note: See TracChangeset for help on using the changeset viewer.