Title: [272056] trunk/Tools
Revision
272056
Author
[email protected]
Date
2021-01-29 02:46:36 -0800 (Fri, 29 Jan 2021)

Log Message

[JSC] Implement --artifact-exec-wrapper
https://bugs.webkit.org/show_bug.cgi?id=220924

Patch by Angelos Oikonomopoulos <[email protected]> on 2021-01-29
Reviewed by Carlos Alberto Lopez Perez.

Add an option to specify a wrapper for executing the built
artifacts for JSC (i.e. jsc, testmasm, ...). This is useful when
crossbuilding, to be able to specify the ELF interpreter and
LD_LIBRARY_PATH for the built executables (and only those; the
scripts may well execute native binaries that shouldn't be
wrapped). It's not needed when running the tests on the remotes
(as generate-bundle will take care of all that), but helps
e.g. when running 32-bit ARM binaries on a 64-bit host and not
using the system compiler/libraries.

This patch also simplifies the bytecode cache helper by switching
the argument order and changes a couple of uses of pathToVM to
vmCommand for consistency. It should be noted that
--artifact-exec-wrapper is not compatible with
--force-architecture. That shouldn't be a problem as (a) the use
cases of the two flags don't seem to overlap and (b) the exec
wrapper can subsume the functionality of --force-architecture.

* Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh:
* Scripts/run-_javascript_core-tests:
(runTest):
(runJSCStressTests):
* Scripts/run-jsc-stress-tests:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (272055 => 272056)


--- trunk/Tools/ChangeLog	2021-01-29 10:36:36 UTC (rev 272055)
+++ trunk/Tools/ChangeLog	2021-01-29 10:46:36 UTC (rev 272056)
@@ -1,3 +1,34 @@
+2021-01-29  Angelos Oikonomopoulos  <[email protected]>
+
+        [JSC] Implement --artifact-exec-wrapper
+        https://bugs.webkit.org/show_bug.cgi?id=220924
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        Add an option to specify a wrapper for executing the built
+        artifacts for JSC (i.e. jsc, testmasm, ...). This is useful when
+        crossbuilding, to be able to specify the ELF interpreter and
+        LD_LIBRARY_PATH for the built executables (and only those; the
+        scripts may well execute native binaries that shouldn't be
+        wrapped). It's not needed when running the tests on the remotes
+        (as generate-bundle will take care of all that), but helps
+        e.g. when running 32-bit ARM binaries on a 64-bit host and not
+        using the system compiler/libraries.
+
+        This patch also simplifies the bytecode cache helper by switching
+        the argument order and changes a couple of uses of pathToVM to
+        vmCommand for consistency. It should be noted that
+        --artifact-exec-wrapper is not compatible with
+        --force-architecture. That shouldn't be a problem as (a) the use
+        cases of the two flags don't seem to overlap and (b) the exec
+        wrapper can subsume the functionality of --force-architecture.
+
+        * Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh:
+        * Scripts/run-_javascript_core-tests:
+        (runTest):
+        (runJSCStressTests):
+        * Scripts/run-jsc-stress-tests:
+
 2021-01-29  Youenn Fablet  <[email protected]>
 
         [MacOS] Enable WebKitTestRunner audio and video capture in GPUProcess

Modified: trunk/Tools/Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh (272055 => 272056)


--- trunk/Tools/Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh	2021-01-29 10:36:36 UTC (rev 272055)
+++ trunk/Tools/Scripts/jsc-stress-test-helpers/bytecode-cache-test-helper.sh	2021-01-29 10:46:36 UTC (rev 272056)
@@ -33,13 +33,10 @@
     fi
 }
 
-pathToVM=$1
-shift
-inputFile=$1
-shift
 fileTemplate=$1
 shift
-extraOptions="$@"
+rest="$@"
+
 diskCachePath=$(mktemp -d -t "$fileTemplate")
 
 _trap_exit() { rm -rf "$diskCachePath"; }
@@ -46,9 +43,9 @@
 trap _trap_exit EXIT
 
 export JSC_diskCachePath=$diskCachePath
-mysys "$pathToVM" "$inputFile" "$extraOptions"
+mysys "$@"
 
 if [ -z "$JSC_forceDiskCache" ]; then
     export JSC_forceDiskCache=true
 fi
-mysys "$pathToVM" "$inputFile" "$extraOptions"
+mysys "$@"

Modified: trunk/Tools/Scripts/run-_javascript_core-tests (272055 => 272056)


--- trunk/Tools/Scripts/run-_javascript_core-tests	2021-01-29 10:36:36 UTC (rev 272055)
+++ trunk/Tools/Scripts/run-_javascript_core-tests	2021-01-29 10:46:36 UTC (rev 272056)
@@ -107,6 +107,7 @@
 my $model = 0;
 my $archs = undef;
 my $ldd = undef;
+my $artifact_exec_wrapper = undef;
 my $version;
 my $versionName;
 my $sdk;
@@ -236,6 +237,7 @@
   --help                        Show this help message
   --architecture                Attempt to override the native architecture of a machine.
   --ldd                         Use alternate ldd
+  --artifact-exec-wrapper       Wrapper for executing a build artifact
   --root=                       Path to pre-built root containing jsc
   --[no-]ftl-jit                Turn the FTL JIT on or off
   --[no-]build                  Check (or don't check) to see if the jsc build is up-to-date (default: $buildJSCDefault)
@@ -334,6 +336,7 @@
     'model=s' => \$model,
     'architecture=s' => \$archs,
     'ldd=s' => \$ldd,
+    'artifact-exec-wrapper=s' => \$artifact_exec_wrapper,
     'version=s' => \$version,
     'version-name=s' => \$versionName,
     'sdk=s' => \$sdk,
@@ -594,6 +597,11 @@
     chdirWebKit();
     chdir($productDir) or die "Failed to switch directory to '$productDir'\n";
     my @command = (testPath($productDir, $testName));
+    if (defined($artifact_exec_wrapper)) {
+        # This needs to go first, as one use case is to override the
+        # ELF interpreter.
+        unshift @command, $artifact_exec_wrapper;
+    }
     unshift @command, ("xcrun", "-sdk", xcodeSDK(), "sim") if willUseIOSSimulatorSDK();
     unshift @command, ("/usr/bin/arch", "-$archs") if $archs ne nativeArchitecture($nativeTarget, $nativePort);
     unshift @command, wrapperPrefixIfNeeded() if isGtk() or isWPE();
@@ -768,6 +776,10 @@
         push(@jscStressDriverCmd, "--ldd");
         push(@jscStressDriverCmd, $ldd);
     }
+    if (defined($artifact_exec_wrapper)) {
+        push(@jscStressDriverCmd, "--artifact-exec-wrapper");
+        push(@jscStressDriverCmd, $artifact_exec_wrapper);
+    }
     push(@jscStressDriverCmd, @testList);
 
     if (isWindows() && !isCygwin()) {

Modified: trunk/Tools/Scripts/run-jsc-stress-tests (272055 => 272056)


--- trunk/Tools/Scripts/run-jsc-stress-tests	2021-01-29 10:36:36 UTC (rev 272055)
+++ trunk/Tools/Scripts/run-jsc-stress-tests	2021-01-29 10:46:36 UTC (rev 272056)
@@ -133,6 +133,7 @@
 $forceCollectContinuously = false
 $reportExecutionTime = false
 $ldd = nil
+$artifact_exec_wrapper = nil
 
 def usage
     puts "run-jsc-stress-tests -j <shell path> <collections path> [<collections path> ...]"
@@ -153,6 +154,7 @@
     puts "--force-architecture        Override the architecture to run tests with."
     puts "                            e.g. x86, x86_64, arm."
     puts "--ldd                       Use alternate ldd"
+    puts "--artifact-exec-wrapper     Wrapper for executing a build artifact"
     puts "--os                        Specify os instead of determining from _javascript_Core build."
     puts "                            e.g. darwin, linux & windows."
     puts "--shell-runner              Uses the shell-based test runner instead of the default make-based runner."
@@ -195,6 +197,7 @@
                ['--arch', GetoptLong::REQUIRED_ARGUMENT],
                ['--force-architecture', GetoptLong::REQUIRED_ARGUMENT],
                ['--ldd', GetoptLong::REQUIRED_ARGUMENT],
+               ['--artifact-exec-wrapper', GetoptLong::REQUIRED_ARGUMENT],
                ['--os', GetoptLong::REQUIRED_ARGUMENT],
                ['--shell-runner', GetoptLong::NO_ARGUMENT],
                ['--make-runner', GetoptLong::NO_ARGUMENT],
@@ -270,6 +273,8 @@
         $forceArchitecture = arg
     when '--ldd'
         $ldd = arg
+    when '--artifact-exec-wrapper'
+        $artifact_exec_wrapper = arg
     when '--os'
         $hostOS = arg
     when '--model'
@@ -582,11 +587,14 @@
 end
 
 def vmCommand
+    cmd = [pathToVM.to_s]
+    if not $artifact_exec_wrapper.nil?
+        cmd.unshift($artifact_exec_wrapper)
+    end
     if ($forceArchitecture)
-        ["/usr/bin/arch", "-" + $forceArchitecture,  pathToVM.to_s]
-    else
-        [pathToVM.to_s]
+        cmd = ["/usr/bin/arch", "-" + $forceArchitecture] + cmd
     end
+    return cmd
 end
 
 def pathToHelpers
@@ -758,7 +766,7 @@
     end
 
     options = BASE_OPTIONS + $testSpecificRequiredOptions + FTL_OPTIONS + optionalTestSpecificOptions
-    addRunCommand("bytecode-cache", ["sh", (pathToHelpers + "bytecode-cache-test-helper.sh").to_s, pathToVM.to_s, $benchmark.to_s, fileTemplate.to_s] + options, silentOutputHandler, simpleErrorHandler, *additionalEnv)
+    addRunCommand("bytecode-cache", ["sh", (pathToHelpers + "bytecode-cache-test-helper.sh").to_s, fileTemplate.to_s, *vmCommand, $benchmark.to_s] + options, silentOutputHandler, simpleErrorHandler, *additionalEnv)
 end
 
 def runBytecodeCache(*optionalTestSpecificOptions)
@@ -1003,7 +1011,7 @@
 
     profilerOutput = uniqueFilename(".json")
     if $canRunDisplayProfilerOutput
-        addRunCommand("profiler", ["ruby", (pathToHelpers + "profiler-test-helper").to_s, (SCRIPTS_PATH + "display-profiler-output").to_s, profilerOutput.to_s, pathToVM.to_s, "--useConcurrentJIT=false", "-p", profilerOutput.to_s, $benchmark.to_s], silentOutputHandler, simpleErrorHandler)
+        addRunCommand("profiler", ["ruby", (pathToHelpers + "profiler-test-helper").to_s, (SCRIPTS_PATH + "display-profiler-output").to_s, profilerOutput.to_s, *vmCommand, "--useConcurrentJIT=false", "-p", profilerOutput.to_s, $benchmark.to_s], silentOutputHandler, simpleErrorHandler)
     else
         puts "Running simple version of #{$collectionName}/#{$benchmark} because some required Ruby features are unavailable."
         run("profiler-simple", "--useConcurrentJIT=false", "-p", profilerOutput.to_s)
@@ -1216,7 +1224,7 @@
     wasmFiles.each {
         | file |
         basename = file.basename.to_s
-        addRunCommand("(" + basename + ")-" + kind, [pathToVM.to_s] + $testSpecificRequiredOptions + options + [$benchmark.to_s, "--", basename], silentOutputHandler, simpleErrorHandler)
+        addRunCommand("(" + basename + ")-" + kind, vmCommand + $testSpecificRequiredOptions + options + [$benchmark.to_s, "--", basename], silentOutputHandler, simpleErrorHandler)
     }
 end
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to