Modified: trunk/Tools/ChangeLog (104341 => 104342)
--- trunk/Tools/ChangeLog 2012-01-06 22:27:45 UTC (rev 104341)
+++ trunk/Tools/ChangeLog 2012-01-06 22:46:12 UTC (rev 104342)
@@ -1,3 +1,18 @@
+2012-01-06 David Kilzer <[email protected]>
+
+ 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.
+
2012-01-05 Dirk Pranke <[email protected]>
webkitpy: clean up test/uri conversion routines
Modified: trunk/Tools/Scripts/run-api-tests (104341 => 104342)
--- trunk/Tools/Scripts/run-api-tests 2012-01-06 22:27:45 UTC (rev 104341)
+++ trunk/Tools/Scripts/run-api-tests 2012-01-06 22:46:12 UTC (rev 104342)
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
-# Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+# Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -39,10 +39,10 @@
use VCSUtils;
sub buildTestTool();
-sub dumpTestsBySuite(\%);
-sub populateTests();
+sub dumpTestsBySuite(\@);
+sub listAllTests();
sub runTest($$$);
-sub runTestsBySuite(\%$);
+sub runTestsBySuite(\@$);
sub prepareEnvironmentForRunningTestTool();
sub testToolPath();
@@ -85,14 +85,14 @@
setConfiguration();
buildTestTool() if $build;
setPathForRunningWebKitApp(\%ENV);
-my %testsToRun = populateTests();
+my @testsToRun = listAllTests();
if ($dumpTests) {
- dumpTestsBySuite(%testsToRun);
+ dumpTestsBySuite(@testsToRun);
exit 0;
}
-if (runTestsBySuite(%testsToRun, $verbose)) {
+if (runTestsBySuite(@testsToRun, $verbose)) {
exit 1;
}
@@ -101,30 +101,36 @@
return isAppleMacWebKit() || isAppleWinWebKit() || isChromium();
}
-sub dumpTestsBySuite(\%)
+sub dumpTestsBySuite(\@)
{
- my ($testsBySuite) = @_;
+ my ($tests) = @_;
print "Dumping test cases\n";
print "------------------\n";
- for my $suite (sort keys %$testsBySuite) {
- print $suite . ":\n";
- print map { " " . $_ . "\n" } sort @{ $testsBySuite->{$suite} };
+ my $lastSuite = "";
+ for my $suiteAndTest (sort @$tests) {
+ my ($suite, $test) = split(/\./, $suiteAndTest);
+ if ($lastSuite ne $suite) {
+ $lastSuite = $suite;
+ print "$suite:\n";
+ }
+ print " $test\n";
}
print "------------------\n";
}
-sub runTestsBySuite(\%$)
+sub runTestsBySuite(\@$)
{
my ($tests, $verbose) = @_;
my $anyFailures = 0;
- for my $suite (sort keys %$tests) {
- print "Suite: $suite\n" unless $verbose;
- for my $test (sort @{$tests->{$suite}}) {
- my $failed = runTest($suite, $test, $verbose);
- if ($failed) {
- $anyFailures = 1;
- }
+ my $lastSuite = "";
+ for my $suiteAndTest (sort @$tests) {
+ my ($suite, $test) = split(/\./, $suiteAndTest);
+ if ($lastSuite ne $suite) {
+ $lastSuite = $suite;
+ print "Suite: $suite\n" unless $verbose;
}
+ my $failed = runTest($suite, $test, $verbose);
+ $anyFailures ||= $failed;
}
if ($verbose) {
@@ -212,9 +218,9 @@
return $timedOut || $result;
}
-sub populateTests()
+sub listAllTests()
{
- my @tests;
+ my @toolOutput;
my $timedOut;
die "run-api-tests is not supported on this platform.\n" unless isSupportedPlatform();
@@ -238,7 +244,7 @@
}
close($childIn);
- @tests = <$childOut>;
+ @toolOutput = <$childOut>;
close($childOut);
close($childErr);
close(DEVNULL) unless ($verbose);
@@ -251,23 +257,21 @@
exit exitStatus($result);
}
- my %keyedTests = ();
+ my @tests = ();
my $suite;
- for my $test (@tests) {
- $test =~ s/[\r\n]*$//;
- if ($test =~ m/\.$/) {
- $test =~ s/\.$//;
- $suite = $test;
+ for my $line (@toolOutput) {
+ $line =~ s/[\r\n]*$//;
+ if ($line =~ m/\.$/) {
+ $suite = $line; # "SuiteName."
} else {
- $test =~ s/^\s*//;
- push @{$keyedTests{$suite}}, $test;
+ $line =~ s/^\s*//; # "TestName"
+ push @tests, $suite . $line; # "SuiteName.TestName"
}
}
-
- return %keyedTests;
+
+ return @tests;
}
-
sub buildTestTool()
{
my $originalCwd = getcwd();