Commit 4f0b6eb1 authored by ddkilzer@apple.com's avatar ddkilzer@apple.com

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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104342 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6bbd79ff
2012-01-06 David Kilzer <ddkilzer@apple.com>
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 <dpranke@chromium.org>
webkitpy: clean up test/uri conversion routines
#!/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 webkitdirs;
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 @@ if ($showHelp) {
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 @@ sub isSupportedPlatform()
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 @@ sub runTest($$$)
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 @@ sub populateTests()
}
close($childIn);
@tests = <$childOut>;
@toolOutput = <$childOut>;
close($childOut);
close($childErr);
close(DEVNULL) unless ($verbose);
......@@ -251,22 +257,20 @@ sub populateTests()
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()
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment