Skip to content

Commit 0dba707

Browse files
Valerie R Youngwebkit-commit-queue
authored andcommitted
test262/Runner.pm: save summary to file
https://bugs.webkit.org/show_bug.cgi?id=185200 Patch by Valerie R Young <valerie@bocoup.com> on 2018-05-02 Reviewed by Michael Saboff. .: * .gitignore: Tools: * Scripts/test262/Runner.pm: (processCLI): (main): (summarizeResults): Canonical link: https://commits.webkit.org/200696@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 89dff13 commit 0dba707

4 files changed

Lines changed: 66 additions & 31 deletions

File tree

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ __cmake_systeminformation/
4949
# Ignore YouCompleteMe symlinks
5050
.ycm_extra_conf.py
5151

52-
# Ignore generated Test262 results file
53-
Tools/Scripts/test262/test262-results.yaml
54-
52+
# Ignore generated Test262 results files
53+
Tools/Scripts/test262/results.yaml
54+
Tools/Scripts/test262/results-summary.yaml
55+
Tools/Scripts/test262/results-summary.txt

ChangeLog

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
2018-05-02 Valerie R Young <valerie@bocoup.com>
2+
3+
test262/Runner.pm: save summary to file
4+
https://bugs.webkit.org/show_bug.cgi?id=185200
5+
6+
Reviewed by Michael Saboff.
7+
8+
* .gitignore:
9+
110
2018-05-01 Leo Balter <leonardo.balter@gmail.com>
211

312
Auto save the results for Test262

Tools/ChangeLog

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2018-05-02 Valerie R Young <valerie@bocoup.com>
2+
3+
test262/Runner.pm: save summary to file
4+
https://bugs.webkit.org/show_bug.cgi?id=185200
5+
6+
Reviewed by Michael Saboff.
7+
8+
* Scripts/test262/Runner.pm:
9+
(processCLI):
10+
(main):
11+
(summarizeResults):
12+
113
2018-05-02 Carlos Alberto Lopez Perez <clopez@igalia.com>
214

315
[GTK] Generate a JSC bundle on the 64 and 32 bit release bots and upload it to webkitgtk.org

Tools/Scripts/test262/Runner.pm

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ BEGIN {
5858
}
5959

6060
use YAML qw(Load LoadFile Dump DumpFile Bless);
61+
use JSON;
6162
use Parallel::ForkManager;
6263
use Getopt::Long qw(GetOptions);
6364
use Pod::Usage;
@@ -79,10 +80,13 @@ my $saveExpectations;
7980
my $failingOnly;
8081
my $latestImport;
8182
my $runningAllTests;
83+
my @results;
8284

8385
my $expectationsFile = abs_path("$Bin/expectations.yaml");
8486
my $configFile = abs_path("$Bin/config.yaml");
8587
my $resultsFile = abs_path("$Bin/results.yaml");
88+
my $summaryTxtFile = abs_path("$Bin/results-summary.txt");
89+
my $summaryFile = abs_path("$Bin/results-summary.yaml");
8690

8791
processCLI();
8892

@@ -137,7 +141,6 @@ sub processCLI {
137141
}
138142

139143
if ($stats) {
140-
print "Summarizing results...\n\n";
141144
summarizeResults();
142145
exit;
143146
}
@@ -256,10 +259,10 @@ sub main {
256259
close $deffh;
257260

258261
seek($resfh, 0, 0);
259-
my @res = LoadFile($resfh);
262+
@results = LoadFile($resfh);
260263
close $resfh;
261264

262-
@res = sort { "$a->{path} . $a->{mode}" cmp "$b->{path} . $b->{mode}" } @res;
265+
@results = sort { "$a->{path} . $a->{mode}" cmp "$b->{path} . $b->{mode}" } @results;
263266

264267
my %failed;
265268
my $failcount = 0;
@@ -268,7 +271,7 @@ sub main {
268271
my $skipfilecount = 0;
269272

270273
# Create expectation file and calculate results
271-
foreach my $test (@res) {
274+
foreach my $test (@results) {
272275

273276
my $expectedFailure = 0;
274277
if ($expect && $expect->{$test->{path}}) {
@@ -309,13 +312,12 @@ sub main {
309312
}
310313

311314
if ($runningAllTests) {
312-
DumpFile($resultsFile, \@res);
313-
print "Saved all the results in the $resultsFile.";
314-
print "Summarizing results...\n\n";
315+
DumpFile($resultsFile, \@results);
316+
print "Saved all the results in $resultsFile\n";
315317
summarizeResults();
316318
}
317319

318-
my $total = scalar @res - $skipfilecount;
320+
my $total = scalar @results - $skipfilecount;
319321
print "\n" . $total . " tests ran\n";
320322

321323
if ( !$expect ) {
@@ -655,12 +657,16 @@ sub getHarness {
655657
}
656658

657659
sub summarizeResults {
658-
my @rawresults = LoadFile($resultsFile) or die $!;
660+
print "Summarizing results...\n";
659661

662+
if (not @results) {
663+
my @rawresults = LoadFile($resultsFile) or die $!;
664+
@results = @{$rawresults[0]};
665+
}
660666
my %byfeature;
661667
my %bypath;
662668

663-
foreach my $test (@{$rawresults[0]}) {
669+
foreach my $test (@results) {
664670
my $result = $test->{result};
665671

666672
if ($test->{features}) {
@@ -703,43 +709,50 @@ sub summarizeResults {
703709

704710
}
705711

706-
print sprintf("%-6s %-6s %-6s %-6s %s\n", '% PASS', 'PASS', 'FAIL', 'SKIP', 'FOLDER');
707-
foreach my $key (sort keys %bypath) {
708-
my $c = 'bold';
709-
$c = 'clear' if $bypath{$key}->[1];
712+
open(my $sfh, '>', $summaryTxtFile) or die $!;
710713

714+
print $sfh sprintf("%-6s %-6s %-6s %-6s %s\n", '%PASS', 'PASS', 'FAIL', 'SKIP', 'FOLDER');
715+
foreach my $key (sort keys %bypath) {
711716
my $per = ($bypath{$key}->[0] / (
712717
$bypath{$key}->[0]
713718
+ $bypath{$key}->[1]
714719
+ $bypath{$key}->[2])) * 100;
715720

716721
$per = sprintf("%.0f", $per) . "%";
717722

718-
print colored([$c], sprintf("%-6s %-6d %-6d %-6d %s \n", $per,
719-
$bypath{$key}->[0],
720-
$bypath{$key}->[1],
721-
$bypath{$key}->[2], $key,));
723+
print $sfh sprintf("%-6s %-6d %-6d %-6d %s \n", $per,
724+
$bypath{$key}->[0],
725+
$bypath{$key}->[1],
726+
$bypath{$key}->[2], $key,);
722727
}
723728

724-
print "\n\n";
725-
print sprintf("%-6s %-6s %-6s %-6s %s\n", '% PASS', 'PASS', 'FAIL', 'SKIP', 'FEATURE');
729+
print $sfh "\n\n";
730+
print $sfh sprintf("%-6s %-6s %-6s %-6s %s\n", '%PASS', 'PASS', 'FAIL', 'SKIP', 'FEATURE');
726731

727732
foreach my $key (sort keys %byfeature) {
728-
my $c = 'bold';
729-
$c = 'clear' if $byfeature{$key}->[1];
730-
731733
my $per = ($byfeature{$key}->[0] / (
732734
$byfeature{$key}->[0]
733735
+ $byfeature{$key}->[1]
734736
+ $byfeature{$key}->[2])) * 100;
735737

736738
$per = sprintf("%.0f", $per) . "%";
737739

738-
print colored([$c], sprintf("%-6s %-6d %-6d %-6d %s\n", $per,
739-
$byfeature{$key}->[0],
740-
$byfeature{$key}->[1],
741-
$byfeature{$key}->[2], $key));
740+
print $sfh sprintf("%-6s %-6d %-6d %-6d %s\n", $per,
741+
$byfeature{$key}->[0],
742+
$byfeature{$key}->[1],
743+
$byfeature{$key}->[2], $key);
742744
}
745+
746+
close($sfh);
747+
748+
my %resultsyaml = (
749+
byFolder => \%bypath,
750+
byFeature => \%byfeature,
751+
);
752+
753+
DumpFile($summaryFile, \%resultsyaml);
754+
755+
print "See summarized results in $summaryTxtFile\n";
743756
}
744757

745758
__END__
@@ -828,7 +841,7 @@ Runs the test files listed in the last import (./JSTests/test262/latest-changes-
828841
829842
=item B<--stats>
830843
831-
Calculate conformance statistics from test262-results.yaml file.
844+
Calculate conformance statistics from JSTests/test262-results.yaml file. Saves results in JSTests/test262/results-summary.txt and JSTests/test262/results-summary.yaml.
832845
833846
=back
834847

0 commit comments

Comments
 (0)