Modified: trunk/Tools/Scripts/run-_javascript_core-tests (263568 => 263569)
--- trunk/Tools/Scripts/run-_javascript_core-tests 2020-06-26 17:16:24 UTC (rev 263568)
+++ trunk/Tools/Scripts/run-_javascript_core-tests 2020-06-26 17:18:41 UTC (rev 263569)
@@ -104,6 +104,7 @@
my $createTarball = 0;
my $remoteHost = 0;
my $model = 0;
+my $archs = undef;
my $version;
my $versionName;
my $sdk;
@@ -231,6 +232,7 @@
my $usage = <<EOF;
Usage: $programName [options] [options to pass to build system]
--help Show this help message
+ --architecture Attempt to override the native architecture of a machine.
--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)
@@ -327,6 +329,7 @@
'tarball!' => \$createTarball,
'remote=s' => \$remoteHost,
'model=s' => \$model,
+ 'architecture=s' => \$archs,
'version=s' => \$version,
'version-name=s' => \$versionName,
'sdk=s' => \$sdk,
@@ -350,7 +353,6 @@
'buildbot-worker=s' => \$buildbotWorker,
);
-
my $specificTestsSpecified = 0;
if ($runTestMasm == DO_RUN
|| $runTestAir == DO_RUN
@@ -449,7 +451,7 @@
my $result = {
platform => $platform,
- architecture => architecture(),
+ architecture => $archs,
is_simulator => $simulator,
style => lc(configuration()),
version => "$version->{major}.$version->{minor}.$version->{subminor}",
@@ -483,6 +485,21 @@
}
setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
+my $archsInBuild = architecturesForProducts();
+if (defined $archs) {
+ die "$archs not supported by the provided binary, which supports '$archsInBuild'" if index($archsInBuild, $archs) == -1;
+} else {
+ # Fallback is x86_64, which we replace with the native architecture if the native architecture is in the provided build
+ $archs = "x86_64";
+ $archs = nativeArchitecture() if index($archsInBuild, nativeArchitecture()) != -1;
+}
+
+# For running tests, arm64e should map to arm64
+$archs = "arm64" if $archs eq "arm64e";
+if ($archs ne nativeArchitecture() && (nativeArchitecture() ne "arm64" || !isAppleMacWebKit())) {
+ die "Cannot run tests with $archs on this machine";
+}
+
configurationForUpload() if (defined($report));
if (defined($jsonFileName)) {
@@ -551,6 +568,7 @@
chdir($productDir) or die "Failed to switch directory to '$productDir'\n";
my @command = (testPath($productDir, $testName));
unshift @command, ("xcrun", "-sdk", xcodeSDK(), "sim") if willUseIOSSimulatorSDK();
+ unshift @command, ("/usr/bin/arch", "-$archs") if $archs ne nativeArchitecture();
unshift @command, wrapperPrefixIfNeeded() if isGtk() or isWPE();
if ($envVars ne "") {
@@ -712,8 +730,13 @@
$ENV{LANG}="en_US.UTF-8";
my @jscStressDriverCmd = (
"/usr/bin/env", "ruby", "Tools/Scripts/run-jsc-stress-tests",
- "-j", jscPath($productDir), "-o", $jscStressResultsDir);
+ "-j", jscPath($productDir), "-o", $jscStressResultsDir, "--arch", $archs);
+ if (nativeArchitecture() != $archs) {
+ push(@jscStressDriverCmd, "--force-architecture");
+ push(@jscStressDriverCmd, $archs);
+ }
+
push(@jscStressDriverCmd, @testList);
if (isWindows() && !isCygwin()) {
Modified: trunk/Tools/Scripts/run-jsc-stress-tests (263568 => 263569)
--- trunk/Tools/Scripts/run-jsc-stress-tests 2020-06-26 17:16:24 UTC (rev 263568)
+++ trunk/Tools/Scripts/run-jsc-stress-tests 2020-06-26 17:18:41 UTC (rev 263569)
@@ -114,6 +114,7 @@
$testWriter = "default"
$remoteHosts = []
$architecture = nil
+$forceArchitecture = nil
$hostOS = nil
$model = nil
$filter = nil
@@ -139,6 +140,7 @@
puts "--run-bundle Runs a bundle previously created by run-jsc-stress-tests."
puts "--tarball [fileName] Creates a tarball of the final bundle. Use name if supplied for tar file."
puts "--arch Specify architecture instead of determining from _javascript_Core build."
+ puts "--force-architecture Override the architecture to run tests with."
puts " e.g. x86, x86_64, arm."
puts "--os Specify os instead of determining from _javascript_Core build."
puts " e.g. darwin, linux & windows."
@@ -180,6 +182,7 @@
['--tarball', GetoptLong::OPTIONAL_ARGUMENT],
['--force-vm-copy', GetoptLong::NO_ARGUMENT],
['--arch', GetoptLong::REQUIRED_ARGUMENT],
+ ['--force-architecture', GetoptLong::REQUIRED_ARGUMENT],
['--os', GetoptLong::REQUIRED_ARGUMENT],
['--shell-runner', GetoptLong::NO_ARGUMENT],
['--make-runner', GetoptLong::NO_ARGUMENT],
@@ -247,6 +250,9 @@
$filter = Regexp.new(arg)
when '--arch'
$architecture = arg
+ when '--force-architecture'
+ $architecture = arg unless $architecture
+ $forceArchitecture = arg
when '--os'
$hostOS = arg
when '--model'
@@ -557,6 +563,14 @@
pathToBundleResourceFromBenchmarkDirectory($jscPath)
end
+def vmCommand
+ if ($forceArchitecture)
+ ["/usr/bin/arch", "-" + $forceArchitecture, pathToVM.to_s]
+ else
+ [pathToVM.to_s]
+ end
+end
+
def pathToHelpers
pathToBundleResourceFromBenchmarkDirectory(".helpers")
end
@@ -643,11 +657,11 @@
end
def runWithOutputHandler(kind, outputHandler, *options)
- addRunCommand(kind, [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)
+ addRunCommand(kind, vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)
end
def runWithOutputHandlerWithoutBaseOption(kind, outputHandler, *options)
- addRunCommand(kind, [pathToVM.to_s] + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)
+ addRunCommand(kind, vmCommand + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)
end
def run(kind, *options)
@@ -973,12 +987,12 @@
end
def runExceptionFuzz
- subCommand = escapeAll([pathToVM.to_s, "--useDollarVM=true", "--useExceptionFuzz=true", $benchmark.to_s])
+ subCommand = escapeAll(vmCommand + ["--useDollarVM=true", "--useExceptionFuzz=true", $benchmark.to_s])
addRunCommand("exception-fuzz", ["perl", (pathToHelpers + "js-exception-fuzz").to_s, subCommand], silentOutputHandler, simpleErrorHandler)
end
def runExecutableAllocationFuzz(name, *options)
- subCommand = escapeAll([pathToVM.to_s, "--useDollarVM=true", $benchmark.to_s] + options)
+ subCommand = escapeAll(vmCommand + ["--useDollarVM=true", $benchmark.to_s] + options)
addRunCommand("executable-allocation-fuzz-" + name, ["perl", (pathToHelpers + "js-executable-allocation-fuzz").to_s, subCommand], silentOutputHandler, simpleErrorHandler)
end
@@ -1027,7 +1041,7 @@
prepareExtraRelativeFiles(includeFiles.map { |f| "../" + f }, $collection)
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions
args << "--exception=" + exception if failsWithException
args << "--test262-async" if isAsync
args += includeFiles
@@ -1069,7 +1083,7 @@
end
def runES6(mode)
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + [$benchmark.to_s]
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + [$benchmark.to_s]
case mode
when :normal
errorHandler = simpleErrorHandler
@@ -1267,7 +1281,7 @@
prepareExtraAbsoluteFiles(CHAKRATESTS_PATH, ["jsc-lib.js"])
prepareExtraRelativeFiles(extraFiles.map { |f| "../" + f }, $collection)
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions
args += FTL_OPTIONS if $isFTLPlatform
args += EAGER_OPTIONS
args << "--exception=" + exception if failsWithException
@@ -1308,7 +1322,7 @@
prepareExtraRelativeFiles(["../#{testName}-expected.txt"], $benchmarkDirectory)
prepareExtraAbsoluteFiles(LAYOUTTESTS_PATH, ["resources/standalone-pre.js", "resources/standalone-post.js"])
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options +
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options +
[(Pathname.new("resources") + "standalone-pre.js").to_s,
$benchmark.to_s,
(Pathname.new("resources") + "standalone-post.js").to_s]
@@ -1448,7 +1462,7 @@
def runComplexTest(before, after, additionalEnv, *options)
prepareExtraRelativeFiles(before.map{|v| (Pathname("..") + v).to_s}, $collection)
prepareExtraRelativeFiles(after.map{|v| (Pathname("..") + v).to_s}, $collection)
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options + before.map{|v| v.to_s} + [$benchmark.to_s] + after.map{|v| v.to_s}
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + before.map{|v| v.to_s} + [$benchmark.to_s] + after.map{|v| v.to_s}
addRunCommand("complex", args, noisyOutputHandler, simpleErrorHandler, *additionalEnv)
end
@@ -1459,7 +1473,7 @@
kind = "mozilla"
end
prepareExtraRelativeFiles(extraFiles.map{|v| (Pathname("..") + v).to_s}, $collection)
- args = [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options + extraFiles.map{|v| v.to_s} + [$benchmark.to_s]
+ args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + extraFiles.map{|v| v.to_s} + [$benchmark.to_s]
case mode
when :normal
errorHandler = mozillaErrorHandler
@@ -1529,7 +1543,7 @@
end
def runNoisyTestImpl(kind, options, additionalEnv)
- addRunCommand(kind, [pathToVM.to_s] + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], noisyOutputHandler, noisyErrorHandler, *additionalEnv)
+ addRunCommand(kind, vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], noisyOutputHandler, noisyErrorHandler, *additionalEnv)
end
def runNoisyTest(kind, *options)
Modified: trunk/Tools/Scripts/webkitdirs.pm (263568 => 263569)
--- trunk/Tools/Scripts/webkitdirs.pm 2020-06-26 17:16:24 UTC (rev 263568)
+++ trunk/Tools/Scripts/webkitdirs.pm 2020-06-26 17:18:41 UTC (rev 263569)
@@ -128,6 +128,7 @@
our @EXPORT_OK;
my $architecture;
+my $nativeArchitecture;
my $asanIsEnabled;
my $forceOptimizationLevel;
my $coverageIsEnabled;
@@ -350,14 +351,28 @@
}
}
+sub determineNativeArchitecture
+{
+ return if defined $nativeArchitecture;
+ $nativeArchitecture = `uname -m`;
+ chomp $nativeArchitecture;
+ $nativeArchitecture = "x86_64" if (not defined $nativeArchitecture);
+
+ # FIXME: Remove this when <rdar://problem/64208532> is resolved
+ if (isAppleCocoaWebKit() && $nativeArchitecture ne "x86_64") {
+ $nativeArchitecture = "arm64";
+ }
+ die "'arm64e' is an invalid native architecture" if $nativeArchitecture eq "arm64e";
+}
+
sub determineArchitecture
{
return if defined $architecture;
- # make sure $architecture is defined in all cases
- $architecture = "";
determineBaseProductDir();
determineXcodeSDK();
+ determineNativeArchitecture();
+ $architecture = $nativeArchitecture;
if (isAppleCocoaWebKit()) {
if (open ARCHITECTURE, "$baseProductDir/Architecture") {
@@ -367,20 +382,12 @@
if ($architecture) {
chomp $architecture;
} else {
- if (not defined $xcodeSDK or $xcodeSDK =~ /^(\/$|macosx)/) {
- my $supports64Bit = `sysctl -n hw.optional.x86_64`;
- chomp $supports64Bit;
- $architecture = 'x86_64' if $supports64Bit;
- } elsif ($xcodeSDK =~ /^iphonesimulator/) {
- $architecture = 'x86_64';
- } elsif ($xcodeSDK =~ /^iphoneos/) {
+ if ($xcodeSDK =~ /^iphoneos/) {
$architecture = 'arm64';
} elsif ($xcodeSDK =~ /^watchsimulator/) {
$architecture = 'i386';
} elsif ($xcodeSDK =~ /^watchos/) {
$architecture = 'arm64_32 arm64e armv7k';
- } elsif ($xcodeSDK =~ /^appletvsimulator/) {
- $architecture = 'x86_64';
} elsif ($xcodeSDK =~ /^appletvos/) {
$architecture = 'arm64';
}
@@ -403,14 +410,6 @@
}
}
- if (!isAnyWindows()) {
- if (!$architecture) {
- # Fall back to output of `uname -m', if it is present.
- $architecture = `uname -m`;
- chomp $architecture;
- }
- }
-
$architecture = 'x86_64' if $architecture =~ /amd64/i;
$architecture = 'arm64' if $architecture =~ /aarch64/i;
}
@@ -840,6 +839,18 @@
return executableProductDir();
}
+sub architecturesForProducts
+{
+ # Most ports don't have emulation, assume that the user gave us an accurate architecture
+ if (!isAppleCocoaWebKit()) {
+ return determineArchitecture();
+ }
+ my $webkitBinary = File::Spec->catdir(executableProductDir(), "_javascript_Core.framework", "_javascript_Core");
+ my $architectures = `/usr/bin/lipo -archs $webkitBinary`;
+ chomp($architectures);
+ return $architectures;
+}
+
sub configuration()
{
determineConfiguration();
@@ -1040,6 +1051,12 @@
return $passedArchitecture;
}
+sub nativeArchitecture()
+{
+ determineNativeArchitecture();
+ return $nativeArchitecture;
+}
+
sub architecture()
{
determineArchitecture();