Changeset 160016 in webkit
- Timestamp:
- Dec 3, 2013 10:51:12 AM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r160006 r160016 1 2013-12-03 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 run-jsc-stress-tests only supports host environments that have make installed 4 https://bugs.webkit.org/show_bug.cgi?id=124550 5 6 Reviewed by Darin Adler. 7 8 This might not be the case for all hosts, so this patch implements an alternate "backend" 9 for run-jsc-stress-tests to use normal shell commands rather than Makefiles. To remain at 10 least somewhat competitive with the make-based test runner, the shell backend uses subshells 11 run in the background to allow tests to run in parallel. Since the concurrency primitives 12 in shell scripting are rather coarse, the overhead of this parallelism is higher than that 13 of the make-based runner. 14 15 * Scripts/jsc-stress-test-helpers/shell-runner.sh: Added. This is the runner that is copied into 16 the bundle and controls all of the parallel aspects of the shell-based test runner. 17 * Scripts/run-jsc-stress-tests: 18 1 19 2013-12-03 Tamas Gergely <tgergely.u-szeged@partner.samsung.com> 2 20 -
trunk/Tools/Scripts/run-jsc-stress-tests
r159990 r160016 69 69 70 70 def mysys(*cmd) 71 printCommandArray(*cmd) 71 printCommandArray(*cmd) if $verbosity >= 1 72 72 raise "Command failed: #{$?.inspect}" unless system(*cmd) 73 73 end … … 93 93 $tarball = false 94 94 $copyVM = false 95 $testRunnerType = :make 95 96 96 97 def usage … … 103 104 puts "--run-bundle Runs a bundle previously created by run-jsc-stress-tests." 104 105 puts "--tarball Creates a tarball of the final bundle." 106 puts "--shell-runner Uses the shell-based test runner instead of the default make-based runner." 107 puts " In general the shell runner is slower than the make runner." 105 108 puts "--help (-h) Print this message." 106 109 exit 1 … … 114 117 ['--tarball', GetoptLong::NO_ARGUMENT], 115 118 ['--force-vm-copy', GetoptLong::NO_ARGUMENT], 119 ['--shell-runner', GetoptLong::NO_ARGUMENT], 116 120 ['--verbose', '-v', GetoptLong::NO_ARGUMENT]).each { 117 121 | opt, arg | … … 134 138 when '--force-vm-copy' 135 139 $copyVM = true 140 when '--shell-runner' 141 $testRunnerType = :shell 136 142 end 137 143 } … … 382 388 383 389 def reproScriptCommand 384 # We have to find our way back to the . paralleldirectory since that's where all of the relative390 # We have to find our way back to the .runner directory since that's where all of the relative 385 391 # paths assume they start out from. 386 392 script = "CURRENT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\n" … … 390 396 script += "cd ..\n" 391 397 } 392 script += "cd . parallel\n"398 script += "cd .runner\n" 393 399 394 400 script += "export DYLD_FRAMEWORK_PATH=$(cd ../#{$frameworkPath.dirname}; pwd)\n" … … 917 923 end 918 924 919 def prepareParallelTestRunner 925 def prepareTestRunner 926 raise if $bundle 927 928 $runlist.each_with_index { 929 | plan, index | 930 plan.index = index 931 } 932 933 Dir.mkdir($runnerDir) unless $runnerDir.directory? 934 toDelete = [] 935 Dir.foreach($runnerDir) { 936 | filename | 937 if filename =~ /^test_/ 938 toDelete << filename 939 end 940 } 941 942 toDelete.each { 943 | filename | 944 File.unlink($runnerDir + filename) 945 } 946 947 $runlist.each { 948 | plan | 949 plan.writeRunScript($runnerDir + "test_script_#{plan.index}") 950 } 951 952 case $testRunnerType 953 when :make 954 prepareMakeTestRunner 955 when :shell 956 prepareShellTestRunner 957 else 958 raise "Unknown test runner type: #{$testRunnerType.to_s}" 959 end 960 end 961 962 def prepareShellTestRunner 963 FileUtils.cp SCRIPTS_PATH + "jsc-stress-test-helpers" + "shell-runner.sh", $runnerDir + "runscript" 964 end 965 966 def prepareMakeTestRunner 920 967 # The goals of our parallel test runner are scalability and simplicity. The 921 968 # simplicity part is particularly important. We don't want to have to have … … 923 970 # 924 971 # As such, we just pass off all of the hard work to 'make'. This creates a 925 # dummy directory ("$outputDir/. parallel") in which we create a dummy972 # dummy directory ("$outputDir/.runner") in which we create a dummy 926 973 # Makefile. The Makefile has an 'all' rule that depends on all of the tests. 927 974 # That is, for each test we know we will run, there is a rule in the … … 946 993 # 947 994 # In the end, this script collects all of the failures by searching for 948 # files in the . paralleldirectory whose name matches /^test_fail_/, where995 # files in the .runner directory whose name matches /^test_fail_/, where 949 996 # the thing after the 'fail_' is the test index. Those are the files that 950 997 # would be created by the test scripts if they detect failure. We're … … 952 999 # Even if two tests fail at the same time, since they're touching different 953 1000 # files we won't miss any failures. 954 955 1001 runIndices = [] 956 $runlist.each_with_index {957 | plan, index |958 runIndices << index959 plan.index = index960 }961 962 Dir.mkdir($parallelDir) unless $parallelDir.directory?963 toDelete = []964 Dir.foreach($parallelDir) {965 | filename |966 if filename =~ /^test_/967 toDelete << filename968 end969 }970 971 toDelete.each {972 | filename |973 File.unlink($parallelDir + filename)974 }975 976 1002 $runlist.each { 977 1003 | plan | 978 plan.writeRunScript($parallelDir + "test_script_#{plan.index}")979 } 980 981 File.open($ parallelDir + "Makefile", "w") {1004 runIndices << plan.index 1005 } 1006 1007 File.open($runnerDir + "Makefile", "w") { 982 1008 | outp | 983 1009 outp.puts("all: " + runIndices.map{|v| "test_done_#{v}"}.join(' ')) … … 1005 1031 puts 1006 1032 1007 def clean ParallelDirectory1033 def cleanRunnerDirectory 1008 1034 raise unless $bundle 1009 Dir.foreach($ parallelDir) {1035 Dir.foreach($runnerDir) { 1010 1036 | filename | 1011 1037 next unless filename =~ /^test_fail/ 1012 FileUtils.rm_f $parallelDir + filename 1013 } 1014 end 1015 1016 def runParallelTestRunner 1017 Dir.chdir($parallelDir) { 1038 FileUtils.rm_f $runnerDir + filename 1039 } 1040 end 1041 1042 def runTestRunner 1043 case $testRunnerType 1044 when :shell 1045 runShellTestRunner 1046 when :make 1047 runMakeTestRunner 1048 else 1049 raise "Unknown test runner type: #{$testRunnerType.to_s}" 1050 end 1051 end 1052 1053 def runShellTestRunner 1054 Dir.chdir($runnerDir) { 1055 mysys("sh", "runscript") 1056 } 1057 end 1058 1059 def runMakeTestRunner 1060 Dir.chdir($runnerDir) { 1018 1061 # -1 for the Makefile, and -2 for '..' and '.' 1019 1062 numberOfTests = Dir.entries(".").count - 3 … … 1084 1127 raise if $bundle 1085 1128 1086 Dir.foreach($ parallelDir) {1129 Dir.foreach($runnerDir) { 1087 1130 | filename | 1088 1131 next unless filename =~ /test_fail_/ … … 1106 1149 1107 1150 $outputDir = $outputDir.realpath 1108 $ parallelDir = $outputDir + ".parallel"1151 $runnerDir = $outputDir + ".runner" 1109 1152 1110 1153 prepareBundle unless $bundle 1111 prepareParallelTestRunner unless $bundle 1112 cleanParallelDirectory if $bundle 1154 1155 puts " " 1156 1157 prepareTestRunner unless $bundle 1158 cleanRunnerDirectory if $bundle 1113 1159 cleanOldResults if $bundle 1114 run ParallelTestRunner1160 runTestRunner 1115 1161 cleanEmptyResultFiles 1116 1162 detectFailures unless $bundle
Note: See TracChangeset
for help on using the changeset viewer.