Changeset 104342 in webkit
- Timestamp:
- Jan 6, 2012 2:46:12 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r104340 r104342 1 2012-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 1 16 2012-01-05 Dirk Pranke <dpranke@chromium.org> 2 17 -
trunk/Tools/Scripts/run-api-tests
r103551 r104342 1 1 #!/usr/bin/perl -w 2 2 3 # Copyright (C) 2010, 2011 Apple Inc. All rights reserved.3 # Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved. 4 4 # 5 5 # Redistribution and use in source and binary forms, with or without … … 40 40 41 41 sub buildTestTool(); 42 sub dumpTestsBySuite(\ %);43 sub populateTests();42 sub dumpTestsBySuite(\@); 43 sub listAllTests(); 44 44 sub runTest($$$); 45 sub runTestsBySuite(\ %$);45 sub runTestsBySuite(\@$); 46 46 sub prepareEnvironmentForRunningTestTool(); 47 47 sub testToolPath(); … … 86 86 buildTestTool() if $build; 87 87 setPathForRunningWebKitApp(\%ENV); 88 my %testsToRun = populateTests();88 my @testsToRun = listAllTests(); 89 89 90 90 if ($dumpTests) { 91 dumpTestsBySuite( %testsToRun);91 dumpTestsBySuite(@testsToRun); 92 92 exit 0; 93 93 } 94 94 95 if (runTestsBySuite( %testsToRun, $verbose)) {95 if (runTestsBySuite(@testsToRun, $verbose)) { 96 96 exit 1; 97 97 } … … 102 102 } 103 103 104 sub dumpTestsBySuite(\ %)105 { 106 my ($tests BySuite) = @_;104 sub dumpTestsBySuite(\@) 105 { 106 my ($tests) = @_; 107 107 print "Dumping test cases\n"; 108 108 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"; 112 117 } 113 118 print "------------------\n"; 114 119 } 115 120 116 sub runTestsBySuite(\ %$)121 sub runTestsBySuite(\@$) 117 122 { 118 123 my ($tests, $verbose) = @_; 119 124 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; 128 134 } 129 135 … … 213 219 } 214 220 215 sub populateTests()216 { 217 my @t ests;221 sub listAllTests() 222 { 223 my @toolOutput; 218 224 my $timedOut; 219 225 … … 239 245 240 246 close($childIn); 241 @t ests= <$childOut>;247 @toolOutput = <$childOut>; 242 248 close($childOut); 243 249 close($childErr); … … 252 258 } 253 259 254 my %keyedTests = ();260 my @tests = (); 255 261 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." 261 266 } 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 } 270 274 271 275 sub buildTestTool()
Note: See TracChangeset
for help on using the changeset viewer.