Changeset 104342 in webkit


Ignore:
Timestamp:
Jan 6, 2012 2:46:12 PM (12 years ago)
Author:
ddkilzer@apple.com
Message:

run-api-tests: change internal representation of tests to array of "SuiteName.TestName" strings

Reviewed by Adam Roben.

Part of: <http://webkit.org/b/75065> run-api-tests should be able to run individual suites and tests

  • Scripts/run-api-tests:

(dumpTestsBySuite): Update to accept array of tests instead of
hash data structure.
(runTestsBySuite): Ditto.
(listAllTests): Rename from populateTests(). Update to return
an array of tests instad of the hash data structure.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r104340 r104342  
     12012-01-06  David Kilzer  <ddkilzer@apple.com>
     2
     3        run-api-tests: change internal representation of tests to array of "SuiteName.TestName" strings
     4
     5        Reviewed by Adam Roben.
     6
     7        Part of: <http://webkit.org/b/75065> run-api-tests should be able to run individual suites and tests
     8
     9        * Scripts/run-api-tests:
     10        (dumpTestsBySuite): Update to accept array of tests instead of
     11        hash data structure.
     12        (runTestsBySuite): Ditto.
     13        (listAllTests): Rename from populateTests().  Update to return
     14        an array of tests instad of the hash data structure.
     15
    1162012-01-05  Dirk Pranke  <dpranke@chromium.org>
    217
  • trunk/Tools/Scripts/run-api-tests

    r103551 r104342  
    11#!/usr/bin/perl -w
    22
    3 # Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
     3# Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
    44#
    55# Redistribution and use in source and binary forms, with or without
     
    4040
    4141sub buildTestTool();
    42 sub dumpTestsBySuite(\%);
    43 sub populateTests();
     42sub dumpTestsBySuite(\@);
     43sub listAllTests();
    4444sub runTest($$$);
    45 sub runTestsBySuite(\%$);
     45sub runTestsBySuite(\@$);
    4646sub prepareEnvironmentForRunningTestTool();
    4747sub testToolPath();
     
    8686buildTestTool() if $build;
    8787setPathForRunningWebKitApp(\%ENV);
    88 my %testsToRun = populateTests();
     88my @testsToRun = listAllTests();
    8989
    9090if ($dumpTests) {
    91     dumpTestsBySuite(%testsToRun);
     91    dumpTestsBySuite(@testsToRun);
    9292    exit 0;
    9393}
    9494
    95 if (runTestsBySuite(%testsToRun, $verbose)) {
     95if (runTestsBySuite(@testsToRun, $verbose)) {
    9696    exit 1;
    9797}
     
    102102}
    103103
    104 sub dumpTestsBySuite(\%)
    105 {
    106     my ($testsBySuite) = @_;
     104sub dumpTestsBySuite(\@)
     105{
     106    my ($tests) = @_;
    107107    print "Dumping test cases\n";
    108108    print "------------------\n";
    109     for my $suite (sort keys %$testsBySuite) {
    110         print $suite . ":\n";
    111         print map { "   " . $_ . "\n" } sort @{ $testsBySuite->{$suite} };
     109    my $lastSuite = "";
     110    for my $suiteAndTest (sort @$tests) {
     111        my ($suite, $test) = split(/\./, $suiteAndTest);
     112        if ($lastSuite ne $suite) {
     113            $lastSuite = $suite;
     114            print "$suite:\n";
     115        }
     116        print "   $test\n";
    112117    }
    113118    print "------------------\n";
    114119}
    115120
    116 sub runTestsBySuite(\%$)
     121sub runTestsBySuite(\@$)
    117122{
    118123    my ($tests, $verbose) = @_;
    119124    my $anyFailures = 0;
    120     for my $suite (sort keys %$tests) {
    121         print "Suite: $suite\n" unless $verbose;
    122         for my $test (sort @{$tests->{$suite}}) {
    123             my $failed = runTest($suite, $test, $verbose);
    124             if ($failed) {
    125                 $anyFailures = 1;
    126             }
    127         }
     125    my $lastSuite = "";
     126    for my $suiteAndTest (sort @$tests) {
     127        my ($suite, $test) = split(/\./, $suiteAndTest);
     128        if ($lastSuite ne $suite) {
     129            $lastSuite = $suite;
     130            print "Suite: $suite\n" unless $verbose;
     131        }
     132        my $failed = runTest($suite, $test, $verbose);
     133        $anyFailures ||= $failed;
    128134    }
    129135   
     
    213219}
    214220
    215 sub populateTests()
    216 {
    217     my @tests;
     221sub listAllTests()
     222{
     223    my @toolOutput;
    218224    my $timedOut;
    219225
     
    239245
    240246    close($childIn);
    241     @tests = <$childOut>;
     247    @toolOutput = <$childOut>;
    242248    close($childOut);
    243249    close($childErr);
     
    252258    }
    253259
    254     my %keyedTests = ();
     260    my @tests = ();
    255261    my $suite;
    256     for my $test (@tests) {
    257        $test =~ s/[\r\n]*$//;
    258        if ($test =~ m/\.$/) {
    259           $test =~ s/\.$//;
    260           $suite = $test;
     262    for my $line (@toolOutput) {
     263       $line =~ s/[\r\n]*$//;
     264       if ($line =~ m/\.$/) {
     265          $suite = $line; # "SuiteName."
    261266       } else {
    262           $test =~ s/^\s*//;
    263           push @{$keyedTests{$suite}}, $test;
    264         }
    265     }
    266  
    267     return %keyedTests;
    268 }
    269 
     267          $line =~ s/^\s*//; # "TestName"
     268          push @tests, $suite . $line; # "SuiteName.TestName"
     269        }
     270    }
     271
     272    return @tests;
     273}
    270274
    271275sub buildTestTool()
Note: See TracChangeset for help on using the changeset viewer.