- Tools/ChangeLog +16 lines
Lines 1-3 Tools/ChangeLog_sec1
1
2013-12-03  Mark Hahnenberg  <mhahnenberg@apple.com>
2
3
        run-jsc-stress-tests can only run locally
4
        https://bugs.webkit.org/show_bug.cgi?id=124551
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * Scripts/jsc-stress-test-helpers/shell-runner.sh: Fixed a couple issues. One was if the script was
9
        killed before the lock directory was removed, future executions wouldn't make any progress. Also 
10
        added a couple more signals to handle gracefully at shutdown. 
11
        * Scripts/run-javascriptcore-tests: Pass through the --remote argument to run-jsc-stress-tests.
12
        * Scripts/run-jsc-stress-tests: Added support for the --remote flag. It accepts a hostname, user, and port.
13
        The script then generates the test bundle, tars it up, and copies it to the remote host via ssh where
14
        it then untars the bundle and executes the shell-based test runner. Also refactored some of the logic
15
        toward the end of the script to make it easier to tell which of the various modes do what.
16
1
2013-12-03  Filip Pizlo  <fpizlo@apple.com>
17
2013-12-03  Filip Pizlo  <fpizlo@apple.com>
2
18
3
        REGRESSION: repro scripts disappear when you rerun tests
19
        REGRESSION: repro scripts disappear when you rerun tests
- Tools/Scripts/run-javascriptcore-tests +7 lines
Lines 80-85 my $runJSCStress = !isAppleWinWebKit(); Tools/Scripts/run-javascriptcore-tests_sec1
80
my $enableFTL = 0;
80
my $enableFTL = 0;
81
81
82
my $createTarball = 0;
82
my $createTarball = 0;
83
my $remoteHost = 0;
83
84
84
my $programName = basename($0);
85
my $programName = basename($0);
85
my $buildJSCDefault = $buildJSC ? "will check" : "will not check";
86
my $buildJSCDefault = $buildJSC ? "will check" : "will not check";
Lines 97-102 Usage: $programName [options] [options t Tools/Scripts/run-javascriptcore-tests_sec2
97
  --[no-]testapi                Run (or don't run) testapi (default: $testapiDefault)
98
  --[no-]testapi                Run (or don't run) testapi (default: $testapiDefault)
98
  --[no-]jsc-stress             Run (or don't run) the JSC stress tests (default: $jscStressDefault)
99
  --[no-]jsc-stress             Run (or don't run) the JSC stress tests (default: $jscStressDefault)
99
  --tarball                     Create a tarball of the bundle produced by running the JSC stress tests.
100
  --tarball                     Create a tarball of the bundle produced by running the JSC stress tests.
101
  --remote=                     Run the JSC stress tests on the specified remote host. Implies --tarball.
100
EOF
102
EOF
101
103
102
GetOptions(
104
GetOptions(
Lines 108-113 GetOptions( Tools/Scripts/run-javascriptcore-tests_sec3
108
    'testapi!' => \$runTestAPI,
110
    'testapi!' => \$runTestAPI,
109
    'jsc-stress!' => \$runJSCStress,
111
    'jsc-stress!' => \$runJSCStress,
110
    'tarball!' => \$createTarball,
112
    'tarball!' => \$createTarball,
113
    'remote=s' => \$remoteHost,
111
    'help' => \$showHelp
114
    'help' => \$showHelp
112
);
115
);
113
116
Lines 246-251 if ($runJSCStress) { Tools/Scripts/run-javascriptcore-tests_sec4
246
    if ($createTarball) {
249
    if ($createTarball) {
247
        push(@jscStressDriverCmd, "--tarball");
250
        push(@jscStressDriverCmd, "--tarball");
248
    }
251
    }
252
    if ($remoteHost) {
253
        push(@jscStressDriverCmd, "--remote");
254
        push(@jscStressDriverCmd, $remoteHost);
255
    }
249
    if (defined($extraTests)) {
256
    if (defined($extraTests)) {
250
        push(@jscStressDriverCmd, $extraTests);
257
        push(@jscStressDriverCmd, $extraTests);
251
    }
258
    }
- Tools/Scripts/run-jsc-stress-tests -26 / +110 lines
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
- Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh -1 / +6 lines
Lines 36-42 testList=".all_tests.txt" Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh_sec1
36
tempFile=".temp.txt"
36
tempFile=".temp.txt"
37
lockDir=".lock_dir"
37
lockDir=".lock_dir"
38
38
39
trap "kill -9 0" SIGINT
39
trap "kill -9 0" SIGINT SIGHUP SIGTERM
40
40
41
echo 0 > ${indexFile}
41
echo 0 > ${indexFile}
42
ls test_script_* > ${testList}
42
ls test_script_* > ${testList}
Lines 49-54 function unlock_test_list() { Tools/Scripts/jsc-stress-test-helpers/shell-runner.sh_sec2
49
    rmdir ${lockDir}
49
    rmdir ${lockDir}
50
}
50
}
51
51
52
if [ -d ${lockDir} ]
53
then
54
    rmdir ${lockDir}
55
fi
56
52
total=`wc -l < "${testList}" | sed 's/ //g'`
57
total=`wc -l < "${testList}" | sed 's/ //g'`
53
for proc in `seq ${numProcs}`
58
for proc in `seq ${numProcs}`
54
do
59
do

Return to Bug 124551