Title: [294568] trunk/Tools/Scripts
Revision
294568
Author
ross.kirsl...@sony.com
Date
2022-05-20 13:08:02 -0700 (Fri, 20 May 2022)

Log Message

test262-runner should have basic Windows compatibility
https://bugs.webkit.org/show_bug.cgi?id=240698

Reviewed by Mark Lam.

test262-runner currently has a slew of incompabilities on Windows;
this patch rectifies enough of them to achieve basic usability.

In particular:
- When `use` of a module triggers a fork() call, a crash occurs on Windows. Avoid by calling Runner::main() from outside.
- This is a WebKit-specific file; use webkitdirs.pm without hesitation and determine jsc binary path using jscPath().
- Don't use `DYLD_FRAMEWORK_PATH=` prefix on Windows.
- Remove erroneous quotes from system call.
- Use File::Copy::copy instead of cp.
- abs_path() of a not-yet-created file is invalid on Windows. But it's also completely unnecessary, as $resultsDir is absolute.
- Manually flush progress meter on Windows (since \r without \n will never be flushed automatically).

Remaining limitation:
- If --child-processes value is too high, the runner will hang. Workaround is to provide a lower number.

* Tools/Scripts/test262-runner:
* Tools/Scripts/test262/Runner.pm:
(processCLI):
(main):
(getBuildPath):
(runTest):
(summarizeResults):
(printHTMLResults):

Canonical link: https://commits.webkit.org/250811@main

Modified Paths

Diff

Modified: trunk/Tools/Scripts/test262/Runner.pm (294567 => 294568)


--- trunk/Tools/Scripts/test262/Runner.pm	2022-05-20 20:06:32 UTC (rev 294567)
+++ trunk/Tools/Scripts/test262/Runner.pm	2022-05-20 20:08:02 UTC (rev 294568)
@@ -37,6 +37,7 @@
 use File::Spec::Functions qw(abs2rel);
 use File::Basename qw(dirname);
 use File::Path qw(mkpath);
+use File::Copy qw(copy);
 use Cwd qw(abs_path);
 use FindBin;
 use Env qw(DYLD_FRAMEWORK_PATH);
@@ -44,6 +45,7 @@
 use Time::HiRes qw(time);
 use IO::Handle;
 use IO::Select;
+use webkitdirs;
 
 my $Bin;
 BEGIN {
@@ -104,11 +106,6 @@
     return Load(do { local $/; <$IN> });
 }
 
-my $webkitdirIsAvailable;
-if (eval {require webkitdirs; 1;}) {
-    webkitdirs->import(qw(executableProductDir setConfiguration));
-    $webkitdirIsAvailable = 1;
-}
 my $podIsAvailable;
 if (eval {require Pod::Usage; 1;}) {
     Pod::Usage->import();
@@ -152,8 +149,6 @@
 
 my $startTime = time();
 
-main();
-
 sub processCLI {
     my $help = 0;
     my $release;
@@ -212,7 +207,7 @@
 
     if ($stats || $failingOnly) {
         # If not supplied, try to find the results file in expected directory
-        $resultsFile ||= abs_path("$resultsDir/results.yaml");
+        $resultsFile ||= "$resultsDir/results.yaml";
 
         if ($failingOnly && ! -e $resultsFile) {
             die "Error: cannot find results file to run failing tests," .
@@ -433,6 +428,7 @@
                 print $readyChild "$file\n";
                 if (!$noProgress) {
                     print "[$completedFiles/$numFiles]\r";
+                    STDOUT->flush() if (isWindows());
                 }
                 $activeChildren++;
             } elsif (!$activeChildren) {
@@ -563,13 +559,13 @@
         mkpath($resultsDir);
     }
 
-    $resultsFile = abs_path("$resultsDir/results.yaml");
+    $resultsFile = "$resultsDir/results.yaml";
 
     DumpFile($resultsFile, \@results);
     print "Saved all the results in $resultsFile\n";
 
     my $styleCss = abs_path("$Bin/report.css");
-    qx/cp $styleCss $resultsDir/;
+    copy($styleCss, $resultsDir);
     summarizeResults();
     printHTMLResults(\%failed, $totalRun, $failcount, $newfailcount, $skipfilecount);
 
@@ -633,21 +629,10 @@
 sub getBuildPath {
     my ($release) = @_;
 
-    my $jsc;
+    my $webkit_config = $release ? 'Release' : 'Debug';
+    setConfiguration($webkit_config);
 
-    if ($webkitdirIsAvailable) {
-        my $webkit_config = $release ? 'Release' : 'Debug';
-        setConfiguration($webkit_config);
-        my $jscDir = executableProductDir();
-
-        $jsc = $jscDir . '/jsc';
-        $jsc = $jscDir . '/_javascript_Core.framework/Helpers/jsc' if (! -e $jsc);
-        $jsc = $jscDir . '/bin/jsc' if (! -e $jsc);
-
-        # Sets the Env DYLD_FRAMEWORK_PATH, abs_path will remove any extra '/' character
-        $DYLD_FRAMEWORK_PATH = abs_path(dirname($jsc)) if (-e $jsc);
-    }
-
+    my $jsc = jscPath(jscProductDir());
     if (! $jsc || ! -e $jsc) {
         # If we cannot find jsc using webkitdirs, look in path
         $jsc = qx(which jsc);
@@ -658,6 +643,9 @@
         }
     }
 
+    # Sets the Env DYLD_FRAMEWORK_PATH, abs_path will remove any extra '/' character
+    $DYLD_FRAMEWORK_PATH = abs_path(dirname($jsc)) if (-e $jsc);
+
     return $jsc;
 }
 
@@ -825,10 +813,10 @@
     my $defaultHarness = '';
     $defaultHarness = $deffile if $scenario ne 'raw';
 
-    my $prefix = $DYLD_FRAMEWORK_PATH ? qq(DYLD_FRAMEWORK_PATH=$DYLD_FRAMEWORK_PATH) : "";
+    my $prefix = !isWindows() && $DYLD_FRAMEWORK_PATH ? qq(DYLD_FRAMEWORK_PATH=$DYLD_FRAMEWORK_PATH) : "";
     my $execTimeStart = time();
 
-    my $result = qx($prefix $JSC $args $defaultHarness $includesfile '$prefixFile$filename');
+    my $result = qx($prefix $JSC $args $defaultHarness $includesfile $prefixFile$filename);
     my $execTime = time() - $execTimeStart;
 
     chomp $result;
@@ -1010,9 +998,9 @@
     if (! -e $resultsDir) {
         mkpath($resultsDir);
     }
-    $summaryTxtFile = abs_path("$resultsDir/summary.txt");
-    $summaryFile = abs_path("$resultsDir/summary.yaml");
-    my $summaryHTMLFile = abs_path("$resultsDir/summary.html");
+    $summaryTxtFile = "$resultsDir/summary.txt";
+    $summaryFile = "$resultsDir/summary.yaml";
+    my $summaryHTMLFile = "$resultsDir/summary.html";
 
     my %byfeature;
     my %bypath;
@@ -1232,7 +1220,7 @@
         mkpath($resultsDir);
     }
 
-    my $indexHTML = abs_path("$resultsDir/index.html");
+    my $indexHTML = "$resultsDir/index.html";
     open(my $htmlfh, '>', $indexHTML) or die $!;
 
     print $htmlfh qq{<html><head>

Modified: trunk/Tools/Scripts/test262-runner (294567 => 294568)


--- trunk/Tools/Scripts/test262-runner	2022-05-20 20:06:32 UTC (rev 294567)
+++ trunk/Tools/Scripts/test262-runner	2022-05-20 20:08:02 UTC (rev 294568)
@@ -71,4 +71,4 @@
 
 use Runner;
 
-exit 0;
+Test262::Runner::main();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to