Changeset 263569 in webkit
- Timestamp:
- Jun 26, 2020, 10:18:41 AM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r263563 r263569 1 2020-06-26 Jonathan Bedard <jbedard@apple.com> 2 3 run-javascriptcore-tests: Support Apple Silicon running x86 processes 4 https://bugs.webkit.org/show_bug.cgi?id=213487 5 <rdar://problem/64606667> 6 7 Reviewed by Saam Barati. 8 9 * Scripts/run-javascriptcore-tests: 10 (configurationForUpload): Add --architecture flag. 11 (runTest): Run test suite with specific architecture. 12 (runJSCStressTests): Pass architecture to run-jsc-stress-tests. 13 * Scripts/run-jsc-stress-tests: Add --force-architecture flag. 14 * Scripts/webkitdirs.pm: 15 (determineNativeArchitecture): Add function to determine machine's native architecture. 16 (determineArchitecture): Leverage the nativeArchitecture instead of hard-coding simulator 17 architectures. 18 (architecturesForProducts): Determine the architectures supported by a given build. 19 (nativeArchitecture): Return nativeArchitecture. 20 1 21 2020-06-26 Sihui Liu <sihui_liu@apple.com> 2 22 -
trunk/Tools/Scripts/run-javascriptcore-tests
r263431 r263569 105 105 my $remoteHost = 0; 106 106 my $model = 0; 107 my $archs = undef; 107 108 my $version; 108 109 my $versionName; … … 232 233 Usage: $programName [options] [options to pass to build system] 233 234 --help Show this help message 235 --architecture Attempt to override the native architecture of a machine. 234 236 --root= Path to pre-built root containing jsc 235 237 --[no-]ftl-jit Turn the FTL JIT on or off … … 328 330 'remote=s' => \$remoteHost, 329 331 'model=s' => \$model, 332 'architecture=s' => \$archs, 330 333 'version=s' => \$version, 331 334 'version-name=s' => \$versionName, … … 351 354 ); 352 355 353 354 356 my $specificTestsSpecified = 0; 355 357 if ($runTestMasm == DO_RUN … … 450 452 my $result = { 451 453 platform => $platform, 452 architecture => architecture(),454 architecture => $archs, 453 455 is_simulator => $simulator, 454 456 style => lc(configuration()), … … 484 486 485 487 setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root)); 488 my $archsInBuild = architecturesForProducts(); 489 if (defined $archs) { 490 die "$archs not supported by the provided binary, which supports '$archsInBuild'" if index($archsInBuild, $archs) == -1; 491 } else { 492 # Fallback is x86_64, which we replace with the native architecture if the native architecture is in the provided build 493 $archs = "x86_64"; 494 $archs = nativeArchitecture() if index($archsInBuild, nativeArchitecture()) != -1; 495 } 496 497 # For running tests, arm64e should map to arm64 498 $archs = "arm64" if $archs eq "arm64e"; 499 if ($archs ne nativeArchitecture() && (nativeArchitecture() ne "arm64" || !isAppleMacWebKit())) { 500 die "Cannot run tests with $archs on this machine"; 501 } 502 486 503 configurationForUpload() if (defined($report)); 487 504 … … 552 569 my @command = (testPath($productDir, $testName)); 553 570 unshift @command, ("xcrun", "-sdk", xcodeSDK(), "sim") if willUseIOSSimulatorSDK(); 571 unshift @command, ("/usr/bin/arch", "-$archs") if $archs ne nativeArchitecture(); 554 572 unshift @command, wrapperPrefixIfNeeded() if isGtk() or isWPE(); 555 573 … … 713 731 my @jscStressDriverCmd = ( 714 732 "/usr/bin/env", "ruby", "Tools/Scripts/run-jsc-stress-tests", 715 "-j", jscPath($productDir), "-o", $jscStressResultsDir); 733 "-j", jscPath($productDir), "-o", $jscStressResultsDir, "--arch", $archs); 734 735 if (nativeArchitecture() != $archs) { 736 push(@jscStressDriverCmd, "--force-architecture"); 737 push(@jscStressDriverCmd, $archs); 738 } 716 739 717 740 push(@jscStressDriverCmd, @testList); -
trunk/Tools/Scripts/run-jsc-stress-tests
r263290 r263569 115 115 $remoteHosts = [] 116 116 $architecture = nil 117 $forceArchitecture = nil 117 118 $hostOS = nil 118 119 $model = nil … … 140 141 puts "--tarball [fileName] Creates a tarball of the final bundle. Use name if supplied for tar file." 141 142 puts "--arch Specify architecture instead of determining from JavaScriptCore build." 143 puts "--force-architecture Override the architecture to run tests with." 142 144 puts " e.g. x86, x86_64, arm." 143 145 puts "--os Specify os instead of determining from JavaScriptCore build." … … 181 183 ['--force-vm-copy', GetoptLong::NO_ARGUMENT], 182 184 ['--arch', GetoptLong::REQUIRED_ARGUMENT], 185 ['--force-architecture', GetoptLong::REQUIRED_ARGUMENT], 183 186 ['--os', GetoptLong::REQUIRED_ARGUMENT], 184 187 ['--shell-runner', GetoptLong::NO_ARGUMENT], … … 248 251 when '--arch' 249 252 $architecture = arg 253 when '--force-architecture' 254 $architecture = arg unless $architecture 255 $forceArchitecture = arg 250 256 when '--os' 251 257 $hostOS = arg … … 558 564 end 559 565 566 def vmCommand 567 if ($forceArchitecture) 568 ["/usr/bin/arch", "-" + $forceArchitecture, pathToVM.to_s] 569 else 570 [pathToVM.to_s] 571 end 572 end 573 560 574 def pathToHelpers 561 575 pathToBundleResourceFromBenchmarkDirectory(".helpers") … … 644 658 645 659 def runWithOutputHandler(kind, outputHandler, *options) 646 addRunCommand(kind, [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)660 addRunCommand(kind, vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler) 647 661 end 648 662 649 663 def runWithOutputHandlerWithoutBaseOption(kind, outputHandler, *options) 650 addRunCommand(kind, [pathToVM.to_s]+ $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler)664 addRunCommand(kind, vmCommand + $testSpecificRequiredOptions + options + [$benchmark.to_s], outputHandler, simpleErrorHandler) 651 665 end 652 666 … … 974 988 975 989 def runExceptionFuzz 976 subCommand = escapeAll( [pathToVM.to_s,"--useDollarVM=true", "--useExceptionFuzz=true", $benchmark.to_s])990 subCommand = escapeAll(vmCommand + ["--useDollarVM=true", "--useExceptionFuzz=true", $benchmark.to_s]) 977 991 addRunCommand("exception-fuzz", ["perl", (pathToHelpers + "js-exception-fuzz").to_s, subCommand], silentOutputHandler, simpleErrorHandler) 978 992 end 979 993 980 994 def runExecutableAllocationFuzz(name, *options) 981 subCommand = escapeAll( [pathToVM.to_s,"--useDollarVM=true", $benchmark.to_s] + options)995 subCommand = escapeAll(vmCommand + ["--useDollarVM=true", $benchmark.to_s] + options) 982 996 addRunCommand("executable-allocation-fuzz-" + name, ["perl", (pathToHelpers + "js-executable-allocation-fuzz").to_s, subCommand], silentOutputHandler, simpleErrorHandler) 983 997 end … … 1028 1042 prepareExtraRelativeFiles(includeFiles.map { |f| "../" + f }, $collection) 1029 1043 1030 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions1044 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions 1031 1045 args << "--exception=" + exception if failsWithException 1032 1046 args << "--test262-async" if isAsync … … 1070 1084 1071 1085 def runES6(mode) 1072 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + [$benchmark.to_s]1086 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + [$benchmark.to_s] 1073 1087 case mode 1074 1088 when :normal … … 1268 1282 prepareExtraRelativeFiles(extraFiles.map { |f| "../" + f }, $collection) 1269 1283 1270 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions1284 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions 1271 1285 args += FTL_OPTIONS if $isFTLPlatform 1272 1286 args += EAGER_OPTIONS … … 1309 1323 prepareExtraAbsoluteFiles(LAYOUTTESTS_PATH, ["resources/standalone-pre.js", "resources/standalone-post.js"]) 1310 1324 1311 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + options +1325 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + 1312 1326 [(Pathname.new("resources") + "standalone-pre.js").to_s, 1313 1327 $benchmark.to_s, … … 1449 1463 prepareExtraRelativeFiles(before.map{|v| (Pathname("..") + v).to_s}, $collection) 1450 1464 prepareExtraRelativeFiles(after.map{|v| (Pathname("..") + v).to_s}, $collection) 1451 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + options + before.map{|v| v.to_s} + [$benchmark.to_s] + after.map{|v| v.to_s}1465 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + before.map{|v| v.to_s} + [$benchmark.to_s] + after.map{|v| v.to_s} 1452 1466 addRunCommand("complex", args, noisyOutputHandler, simpleErrorHandler, *additionalEnv) 1453 1467 end … … 1460 1474 end 1461 1475 prepareExtraRelativeFiles(extraFiles.map{|v| (Pathname("..") + v).to_s}, $collection) 1462 args = [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + options + extraFiles.map{|v| v.to_s} + [$benchmark.to_s]1476 args = vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + extraFiles.map{|v| v.to_s} + [$benchmark.to_s] 1463 1477 case mode 1464 1478 when :normal … … 1530 1544 1531 1545 def runNoisyTestImpl(kind, options, additionalEnv) 1532 addRunCommand(kind, [pathToVM.to_s]+ BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], noisyOutputHandler, noisyErrorHandler, *additionalEnv)1546 addRunCommand(kind, vmCommand + BASE_OPTIONS + $testSpecificRequiredOptions + options + [$benchmark.to_s], noisyOutputHandler, noisyErrorHandler, *additionalEnv) 1533 1547 end 1534 1548 -
trunk/Tools/Scripts/webkitdirs.pm
r263310 r263569 129 129 130 130 my $architecture; 131 my $nativeArchitecture; 131 132 my $asanIsEnabled; 132 133 my $forceOptimizationLevel; … … 351 352 } 352 353 354 sub determineNativeArchitecture 355 { 356 return if defined $nativeArchitecture; 357 $nativeArchitecture = `uname -m`; 358 chomp $nativeArchitecture; 359 $nativeArchitecture = "x86_64" if (not defined $nativeArchitecture); 360 361 # FIXME: Remove this when <rdar://problem/64208532> is resolved 362 if (isAppleCocoaWebKit() && $nativeArchitecture ne "x86_64") { 363 $nativeArchitecture = "arm64"; 364 } 365 die "'arm64e' is an invalid native architecture" if $nativeArchitecture eq "arm64e"; 366 } 367 353 368 sub determineArchitecture 354 369 { 355 370 return if defined $architecture; 356 # make sure $architecture is defined in all cases357 $architecture = "";358 371 359 372 determineBaseProductDir(); 360 373 determineXcodeSDK(); 374 determineNativeArchitecture(); 375 $architecture = $nativeArchitecture; 361 376 362 377 if (isAppleCocoaWebKit()) { … … 368 383 chomp $architecture; 369 384 } else { 370 if (not defined $xcodeSDK or $xcodeSDK =~ /^(\/$|macosx)/) { 371 my $supports64Bit = `sysctl -n hw.optional.x86_64`; 372 chomp $supports64Bit; 373 $architecture = 'x86_64' if $supports64Bit; 374 } elsif ($xcodeSDK =~ /^iphonesimulator/) { 375 $architecture = 'x86_64'; 376 } elsif ($xcodeSDK =~ /^iphoneos/) { 385 if ($xcodeSDK =~ /^iphoneos/) { 377 386 $architecture = 'arm64'; 378 387 } elsif ($xcodeSDK =~ /^watchsimulator/) { … … 380 389 } elsif ($xcodeSDK =~ /^watchos/) { 381 390 $architecture = 'arm64_32 arm64e armv7k'; 382 } elsif ($xcodeSDK =~ /^appletvsimulator/) {383 $architecture = 'x86_64';384 391 } elsif ($xcodeSDK =~ /^appletvos/) { 385 392 $architecture = 'arm64'; … … 401 408 } 402 409 close $cmake_sysinfo; 403 }404 }405 406 if (!isAnyWindows()) {407 if (!$architecture) {408 # Fall back to output of `uname -m', if it is present.409 $architecture = `uname -m`;410 chomp $architecture;411 410 } 412 411 } … … 841 840 } 842 841 842 sub architecturesForProducts 843 { 844 # Most ports don't have emulation, assume that the user gave us an accurate architecture 845 if (!isAppleCocoaWebKit()) { 846 return determineArchitecture(); 847 } 848 my $webkitBinary = File::Spec->catdir(executableProductDir(), "JavaScriptCore.framework", "JavaScriptCore"); 849 my $architectures = `/usr/bin/lipo -archs $webkitBinary`; 850 chomp($architectures); 851 return $architectures; 852 } 853 843 854 sub configuration() 844 855 { … … 1039 1050 determinePassedArchitecture(); 1040 1051 return $passedArchitecture; 1052 } 1053 1054 sub nativeArchitecture() 1055 { 1056 determineNativeArchitecture(); 1057 return $nativeArchitecture; 1041 1058 } 1042 1059
Note:
See TracChangeset
for help on using the changeset viewer.