|
Lines 26-31
Tools/Scripts/run-jsc-stress-tests_sec1
|
| 26 |
require 'fileutils' |
26 |
require 'fileutils' |
| 27 |
require 'getoptlong' |
27 |
require 'getoptlong' |
| 28 |
require 'pathname' |
28 |
require 'pathname' |
|
|
29 |
require 'uri' |
| 29 |
require 'yaml' |
30 |
require 'yaml' |
| 30 |
|
31 |
|
| 31 |
THIS_SCRIPT_PATH = Pathname.new(__FILE__).realpath |
32 |
THIS_SCRIPT_PATH = Pathname.new(__FILE__).realpath |
|
Lines 93-98
$bundle = nil
Tools/Scripts/run-jsc-stress-tests_sec2
|
| 93 |
$tarball = false |
94 |
$tarball = false |
| 94 |
$copyVM = false |
95 |
$copyVM = false |
| 95 |
$testRunnerType = :make |
96 |
$testRunnerType = :make |
|
|
97 |
$remoteUser = nil |
| 98 |
$remoteHost = nil |
| 99 |
$remotePort = nil |
| 100 |
$remoteDirectory = nil |
| 96 |
|
101 |
|
| 97 |
def usage |
102 |
def usage |
| 98 |
puts "run-jsc-stress-tests -j <shell path> <collections path> [<collections path> ...]" |
103 |
puts "run-jsc-stress-tests -j <shell path> <collections path> [<collections path> ...]" |
|
Lines 105-110
def usage
Tools/Scripts/run-jsc-stress-tests_sec3
|
| 105 |
puts "--tarball Creates a tarball of the final bundle." |
110 |
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." |
111 |
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." |
112 |
puts " In general the shell runner is slower than the make runner." |
|
|
113 |
puts "--remote Specify a remote host on which to run tests." |
| 108 |
puts "--help (-h) Print this message." |
114 |
puts "--help (-h) Print this message." |
| 109 |
exit 1 |
115 |
exit 1 |
| 110 |
end |
116 |
end |
|
Lines 117-122
GetoptLong.new(['--help', '-h', GetoptLo
Tools/Scripts/run-jsc-stress-tests_sec4
|
| 117 |
['--tarball', GetoptLong::NO_ARGUMENT], |
123 |
['--tarball', GetoptLong::NO_ARGUMENT], |
| 118 |
['--force-vm-copy', GetoptLong::NO_ARGUMENT], |
124 |
['--force-vm-copy', GetoptLong::NO_ARGUMENT], |
| 119 |
['--shell-runner', GetoptLong::NO_ARGUMENT], |
125 |
['--shell-runner', GetoptLong::NO_ARGUMENT], |
|
|
126 |
['--remote', GetoptLong::REQUIRED_ARGUMENT], |
| 120 |
['--verbose', '-v', GetoptLong::NO_ARGUMENT]).each { |
127 |
['--verbose', '-v', GetoptLong::NO_ARGUMENT]).each { |
| 121 |
| opt, arg | |
128 |
| opt, arg | |
| 122 |
case opt |
129 |
case opt |
|
Lines 139-144
GetoptLong.new(['--help', '-h', GetoptLo
Tools/Scripts/run-jsc-stress-tests_sec5
|
| 139 |
$copyVM = true |
146 |
$copyVM = true |
| 140 |
when '--shell-runner' |
147 |
when '--shell-runner' |
| 141 |
$testRunnerType = :shell |
148 |
$testRunnerType = :shell |
|
|
149 |
when '--remote' |
| 150 |
$copyVM = true |
| 151 |
$testRunnerType = :shell |
| 152 |
$tarball = true |
| 153 |
$remote = true |
| 154 |
uri = URI("ftp://" + arg) |
| 155 |
$remoteUser, $remoteHost, $remotePort = uri.user, uri.host, uri.port |
| 142 |
end |
156 |
end |
| 143 |
} |
157 |
} |
| 144 |
|
158 |
|
|
Lines 161-175
EAGER_OPTIONS = ["--thresholdForJITAfter
Tools/Scripts/run-jsc-stress-tests_sec6
|
| 161 |
$runlist = [] |
175 |
$runlist = [] |
| 162 |
|
176 |
|
| 163 |
def frameworkFromJSCPath(jscPath) |
177 |
def frameworkFromJSCPath(jscPath) |
| 164 |
if jscPath.dirname.basename.to_s == "Resources" and jscPath.dirname.dirname.basename.to_s == "JavaScriptCore.framework" |
178 |
parentDirectory = jscPath.dirname |
| 165 |
jscPath.dirname.dirname |
179 |
if parentDirectory.basename.to_s == "Resources" and parentDirectory.dirname.basename.to_s == "JavaScriptCore.framework" |
| 166 |
elsif jscPath.dirname.dirname.basename.to_s == "WebKitBuild" |
180 |
parentDirectory.dirname |
| 167 |
parentDirName = jscPath.dirname.basename.to_s |
181 |
elsif parentDirectory.basename.to_s =~ /^Debug/ or parentDirectory.basename.to_s =~ /^Release/ |
| 168 |
if parentDirName == "Debug" or parentDirName == "Release" |
182 |
jscPath.dirname + "JavaScriptCore.framework" |
| 169 |
jscPath.dirname + "JavaScriptCore.framework" |
|
|
| 170 |
else |
| 171 |
raise "Unknown JSC path, cannot copy full framework: #{jscPath}" |
| 172 |
end |
| 173 |
else |
183 |
else |
| 174 |
$stderr.puts "Warning: cannot identify JSC framework, doing generic VM copy." |
184 |
$stderr.puts "Warning: cannot identify JSC framework, doing generic VM copy." |
| 175 |
nil |
185 |
nil |
|
Lines 885-890
def prepareBundle
Tools/Scripts/run-jsc-stress-tests_sec7
|
| 885 |
| collection | |
895 |
| collection | |
| 886 |
handleCollection(collection) |
896 |
handleCollection(collection) |
| 887 |
} |
897 |
} |
|
|
898 |
|
| 899 |
puts |
| 888 |
end |
900 |
end |
| 889 |
|
901 |
|
| 890 |
def cleanOldResults |
902 |
def cleanOldResults |
|
Lines 1050-1062
def runTestRunner
Tools/Scripts/run-jsc-stress-tests_sec8
|
| 1050 |
end |
1062 |
end |
| 1051 |
end |
1063 |
end |
| 1052 |
|
1064 |
|
| 1053 |
def runShellTestRunner |
1065 |
def sshRead(cmd) |
| 1054 |
Dir.chdir($runnerDir) { |
1066 |
raise unless $remote |
| 1055 |
mysys("sh", "runscript") |
1067 |
|
|
|
1068 |
result = "" |
| 1069 |
IO.popen("ssh -p #{$remotePort} #{$remoteUser}@#{$remoteHost} '#{cmd}'", "r") { |
| 1070 |
| inp | |
| 1071 |
inp.each_line { |
| 1072 |
| line | |
| 1073 |
result += line |
| 1074 |
} |
| 1056 |
} |
1075 |
} |
|
|
1076 |
raise "#{$?}" unless $?.success? |
| 1077 |
result |
| 1078 |
end |
| 1079 |
|
| 1080 |
def runShellTestRunner |
| 1081 |
if $remote |
| 1082 |
$remoteDirectory = JSON::parse(sshRead("cat ~/.bencher"))["tempPath"] |
| 1083 |
mysys("scp", "-P", $remotePort.to_s, ($outputDir.dirname + "payload.tar.gz").to_s, "#{$remoteUser}@#{$remoteHost}:#{$remoteDirectory}") |
| 1084 |
remoteScript = "" |
| 1085 |
remoteScript += "cd #{$remoteDirectory} && " |
| 1086 |
remoteScript += "rm -rf #{$outputDir.basename} && " |
| 1087 |
remoteScript += "tar xzf payload.tar.gz && " |
| 1088 |
remoteScript += "cd #{$outputDir.basename}/.runner && " |
| 1089 |
remoteScript += "DYLD_FRAMEWORK_PATH=$(cd ../#{$frameworkPath.dirname}; pwd) sh runscript" |
| 1090 |
system("ssh", "-p", $remotePort.to_s, "#{$remoteUser}@#{$remoteHost}", remoteScript) |
| 1091 |
else |
| 1092 |
Dir.chdir($runnerDir) { |
| 1093 |
mysys("sh", "runscript") |
| 1094 |
} |
| 1095 |
end |
| 1057 |
end |
1096 |
end |
| 1058 |
|
1097 |
|
| 1059 |
def runMakeTestRunner |
1098 |
def runMakeTestRunner |
|
|
1099 |
raise if $remote |
| 1060 |
Dir.chdir($runnerDir) { |
1100 |
Dir.chdir($runnerDir) { |
| 1061 |
# -1 for the Makefile, and -2 for '..' and '.' |
1101 |
# -1 for the Makefile, and -2 for '..' and '.' |
| 1062 |
numberOfTests = Dir.entries(".").count - 3 |
1102 |
numberOfTests = Dir.entries(".").count - 3 |
|
Lines 1126-1136
end
Tools/Scripts/run-jsc-stress-tests_sec9
|
| 1126 |
def detectFailures |
1166 |
def detectFailures |
| 1127 |
raise if $bundle |
1167 |
raise if $bundle |
| 1128 |
|
1168 |
|
| 1129 |
Dir.foreach($runnerDir) { |
1169 |
if $remote |
| 1130 |
| filename | |
1170 |
output = sshRead("cd #{$remoteDirectory}/#{$outputDir.basename}/.runner && (ls test_fail_* 2> /dev/null || true)") |
| 1131 |
next unless filename =~ /test_fail_/ |
1171 |
output.split(/\n/).each { |
| 1132 |
appendFailure($runlist[$~.post_match.to_i]) |
1172 |
| line | |
| 1133 |
} |
1173 |
next unless line =~ /test_fail_/ |
|
|
1174 |
appendFailure($runlist[$~.post_match.to_i]) |
| 1175 |
} |
| 1176 |
else |
| 1177 |
Dir.foreach($runnerDir) { |
| 1178 |
| filename | |
| 1179 |
next unless filename =~ /test_fail_/ |
| 1180 |
appendFailure($runlist[$~.post_match.to_i]) |
| 1181 |
} |
| 1182 |
end |
| 1134 |
end |
1183 |
end |
| 1135 |
|
1184 |
|
| 1136 |
def compressBundle |
1185 |
def compressBundle |
|
Lines 1154-1167
Dir.mkdir($outputDir) unless $outputDir.
Tools/Scripts/run-jsc-stress-tests_sec10
|
| 1154 |
$outputDir = $outputDir.realpath |
1203 |
$outputDir = $outputDir.realpath |
| 1155 |
$runnerDir = $outputDir + ".runner" |
1204 |
$runnerDir = $outputDir + ".runner" |
| 1156 |
|
1205 |
|
| 1157 |
prepareBundle unless $bundle |
1206 |
def runBundle |
|
|
1207 |
raise unless $bundle |
| 1158 |
|
1208 |
|
| 1159 |
puts |
1209 |
cleanRunnerDirectory |
|
|
1210 |
cleanOldResults |
| 1211 |
runTestRunner |
| 1212 |
cleanEmptyResultFiles |
| 1213 |
end |
| 1160 |
|
1214 |
|
| 1161 |
prepareTestRunner unless $bundle |
1215 |
def runNormal |
| 1162 |
cleanRunnerDirectory if $bundle |
1216 |
raise if $bundle or $tarball |
| 1163 |
cleanOldResults if $bundle |
1217 |
|
| 1164 |
runTestRunner |
1218 |
prepareBundle |
| 1165 |
cleanEmptyResultFiles |
1219 |
prepareTestRunner |
| 1166 |
detectFailures unless $bundle |
1220 |
runTestRunner |
| 1167 |
compressBundle if $tarball |
1221 |
cleanEmptyResultFiles |
|
|
1222 |
detectFailures |
| 1223 |
end |
| 1224 |
|
| 1225 |
def runTarball |
| 1226 |
raise unless $tarball |
| 1227 |
|
| 1228 |
prepareBundle |
| 1229 |
prepareTestRunner |
| 1230 |
compressBundle |
| 1231 |
end |
| 1232 |
|
| 1233 |
def runRemote |
| 1234 |
raise unless $remote |
| 1235 |
|
| 1236 |
prepareBundle |
| 1237 |
prepareTestRunner |
| 1238 |
compressBundle |
| 1239 |
runTestRunner |
| 1240 |
detectFailures |
| 1241 |
end |
| 1242 |
|
| 1243 |
if $bundle |
| 1244 |
runBundle |
| 1245 |
elsif $remote |
| 1246 |
runRemote |
| 1247 |
elsif $tarball |
| 1248 |
runTarball |
| 1249 |
else |
| 1250 |
runNormal |
| 1251 |
end |