RESOLVED FIXED 226385
[JSC] Fix run-jsc-stress-tests missing escape $
https://bugs.webkit.org/show_bug.cgi?id=226385
Summary [JSC] Fix run-jsc-stress-tests missing escape $
Zhifei Fang
Reported 2021-05-28 11:39:14 PDT
[JSC] Fix run-jsc-stress-tests missing escape $
Attachments
Patch (1.38 KB, patch)
2021-05-28 11:39 PDT, Zhifei Fang
no flags
Patch (1.58 KB, patch)
2021-05-28 12:49 PDT, Zhifei Fang
no flags
Patch (2.97 KB, patch)
2021-05-28 14:43 PDT, Zhifei Fang
no flags
Patch (1.54 KB, patch)
2021-05-28 14:47 PDT, Zhifei Fang
no flags
Patch (2.97 KB, patch)
2021-05-28 16:33 PDT, Zhifei Fang
no flags
Zhifei Fang
Comment 1 2021-05-28 11:39:42 PDT
Alexey Proskuryakov
Comment 2 2021-05-28 11:44:04 PDT
Comment on attachment 430033 [details] Patch rs=me
EWS
Comment 3 2021-05-28 12:40:34 PDT
Committed r278218 (238257@main): <https://commits.webkit.org/238257@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 430033 [details].
Radar WebKit Bug Importer
Comment 4 2021-05-28 12:41:16 PDT
Zhifei Fang
Comment 5 2021-05-28 12:49:54 PDT
Reopening to attach new patch.
Zhifei Fang
Comment 6 2021-05-28 12:49:55 PDT
Alexey Proskuryakov
Comment 7 2021-05-28 13:02:54 PDT
Comment on attachment 430044 [details] Patch rs=me
Zhifei Fang
Comment 8 2021-05-28 14:43:00 PDT
Zhifei Fang
Comment 9 2021-05-28 14:43:43 PDT
Test patch with MIPS JSC EWS
Zhifei Fang
Comment 10 2021-05-28 14:47:14 PDT
Alexey Proskuryakov
Comment 11 2021-05-28 15:07:49 PDT
Comment on attachment 430057 [details] Patch I'm just going to keep saying rs=me until it lands :)
Zhifei Fang
Comment 12 2021-05-28 16:33:32 PDT
Zhifei Fang
Comment 13 2021-05-28 16:34:07 PDT
uh, back to the complex solution. Test with EWS.
EWS
Comment 14 2021-05-28 21:34:19 PDT
Committed r278234 (238271@main): <https://commits.webkit.org/238271@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 430072 [details].
Darin Adler
Comment 15 2021-05-29 13:43:19 PDT
Comment on attachment 430072 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=430072&action=review > Tools/ChangeLog:3 > + [JSC] Escape $ only when run with SSH Why?
Angelos Oikonomopoulos
Comment 16 2021-05-31 03:48:10 PDT
So, AFAIU this happens when using `--remote-config-file` but not `--gnu-parallel-runner`, right? The symptom I see is: sh: line 0: cd: ../.vm: No such file or directory sh: line 0: cd: ../.vm/..: No such file or directory Which does not result into any errors for me (which I guess is why I didn't notice this when testing). Presumably, that's because I've been testing with $hostOS == "linux" so have been taking the path (in prepareBundle) that runs generate-bundle. As generate-bundle creates a shell wrapper that sets LD_LIBRARY_PATH, I guess the value of LD_LIBRARY_PATH doesn't matter on linux. That said, it would be great to know which configuration this failed on! IIUC, this could be fixed by switching to single quotes around the remoteScript (in runTestRunner). At the very least, this makes the symptom above go away for me. The patch would be: diff --git a/Tools/Scripts/run-jsc-stress-tests b/Tools/Scripts/run-jsc-stress-tests index e6141b5e7249..0c24c3d5f398 100755 --- a/Tools/Scripts/run-jsc-stress-tests +++ b/Tools/Scripts/run-jsc-stress-tests @@ -2197,14 +2197,9 @@ def copyBundleToRemote(remoteHost) mysys(["scp", "-o", "NoHostAuthenticationForLocalhost=yes", "-P", remoteHost.port.to_s, ($outputDir.dirname + $tarFileName).to_s, "#{remoteHost.user}@#{remoteHost.host}:#{remoteHost.remoteDirectory}"]) end -def exportBaseEnvironmentVariables(escape) - if escape - dyldFrameworkPath = "\\$(cd #{$testingFrameworkPath.dirname}; pwd)" - ldLibraryPath = "\\$(cd #{$testingFrameworkPath.dirname}/..; pwd)/#{$jscPath.dirname}" - else - dyldFrameworkPath = "\$(cd #{$testingFrameworkPath.dirname}; pwd)" - ldLibraryPath = "\$(cd #{$testingFrameworkPath.dirname}/..; pwd)/#{$jscPath.dirname}" - end +def exportBaseEnvironmentVariables + dyldFrameworkPath = "\$(cd #{$testingFrameworkPath.dirname}; pwd)" + ldLibraryPath = "\$(cd #{$testingFrameworkPath.dirname}/..; pwd)/#{$jscPath.dirname}" [ "export DYLD_FRAMEWORK_PATH=#{dyldFrameworkPath} && ", "export LD_LIBRARY_PATH=#{ldLibraryPath} &&", @@ -2220,14 +2215,14 @@ def runTestRunner(remoteIndex=0) remoteHost = $remoteHosts[remoteIndex] getRemoteDirectoryIfNeeded(remoteHost) copyBundleToRemote(remoteHost) - remoteScript = "\"" + remoteScript = "'" remoteScript += "cd #{remoteHost.remoteDirectory} && " remoteScript += "rm -rf #{$outputDir.basename} && " remoteScript += "tar xzf #{$tarFileName} && " remoteScript += "cd #{$outputDir.basename}/.runner && " - remoteScript += exportBaseEnvironmentVariables(true) + remoteScript += exportBaseEnvironmentVariables $envVars.each { |var| remoteScript += "export " << var << "\n" } - remoteScript += "#{testRunnerCommand(remoteIndex)}\"" + remoteScript += "#{testRunnerCommand(remoteIndex)}'" runAndMonitorTestRunnerCommand(["ssh", "-o", "NoHostAuthenticationForLocalhost=yes", "-p", remoteHost.port.to_s, "#{remoteHost.user}@#{remoteHost.host}", remoteScript]) else Dir.chdir($runnerDir) { @@ -2637,7 +2632,7 @@ def runGnuParallelRunner(remoteHosts, inputs, options={}) "--timeout", timeout.to_s, "-a", inputs, "if test -e #{$outputDir.basename}/.runner; then cd #{$outputDir.basename}/.runner; else echo #{PARALLEL_REMOTE_STATE_LOST_MARKER}; false; fi && " + - exportBaseEnvironmentVariables(false) + + exportBaseEnvironmentVariables + $envVars.collect { |var | "export #{var} &&"}.join("") + "sh " ]
Zhifei Fang
Comment 17 2021-06-01 02:40:18 PDT
(In reply to Darin Adler from comment #15) > Comment on attachment 430072 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=430072&action=review > > > Tools/ChangeLog:3 > > + [JSC] Escape $ only when run with SSH > > Why? We have to run path, with --remote-config-file, we will run the script with SSH, without escape &, that will be considered as a local script instead of part command string running remotely. We also have --gnu-parallel-runner, with this we should not escape $, since that will be part of the script that needed to be run locally.
Zhifei Fang
Comment 18 2021-06-01 02:41:24 PDT
(In reply to Angelos Oikonomopoulos from comment #16) > So, AFAIU this happens when using `--remote-config-file` but not > `--gnu-parallel-runner`, right? The symptom I see is: > > sh: line 0: cd: ../.vm: No such file or directory > sh: line 0: cd: ../.vm/..: No such file or directory > > Which does not result into any errors for me (which I guess is why I didn't > notice this when testing). Presumably, that's because I've been testing with > $hostOS == "linux" so have been taking the path (in prepareBundle) that runs > generate-bundle. As generate-bundle creates a shell wrapper that sets > LD_LIBRARY_PATH, I guess the value of LD_LIBRARY_PATH doesn't matter on > linux. > > That said, it would be great to know which configuration this failed on! > > IIUC, this could be fixed by switching to single quotes around the > remoteScript (in runTestRunner). At the very least, this makes the symptom > above go away for me. The patch would be: > > diff --git a/Tools/Scripts/run-jsc-stress-tests > b/Tools/Scripts/run-jsc-stress-tests > index e6141b5e7249..0c24c3d5f398 100755 > --- a/Tools/Scripts/run-jsc-stress-tests > +++ b/Tools/Scripts/run-jsc-stress-tests > @@ -2197,14 +2197,9 @@ def copyBundleToRemote(remoteHost) > mysys(["scp", "-o", "NoHostAuthenticationForLocalhost=yes", "-P", > remoteHost.port.to_s, ($outputDir.dirname + $tarFileName).to_s, > "#{remoteHost.user}@#{remoteHost.host}:#{remoteHost.remoteDirectory}"]) > end > > -def exportBaseEnvironmentVariables(escape) > - if escape > - dyldFrameworkPath = "\\$(cd #{$testingFrameworkPath.dirname}; pwd)" > - ldLibraryPath = "\\$(cd #{$testingFrameworkPath.dirname}/..; > pwd)/#{$jscPath.dirname}" > - else > - dyldFrameworkPath = "\$(cd #{$testingFrameworkPath.dirname}; pwd)" > - ldLibraryPath = "\$(cd #{$testingFrameworkPath.dirname}/..; > pwd)/#{$jscPath.dirname}" > - end > +def exportBaseEnvironmentVariables > + dyldFrameworkPath = "\$(cd #{$testingFrameworkPath.dirname}; pwd)" > + ldLibraryPath = "\$(cd #{$testingFrameworkPath.dirname}/..; > pwd)/#{$jscPath.dirname}" > [ > "export DYLD_FRAMEWORK_PATH=#{dyldFrameworkPath} && ", > "export LD_LIBRARY_PATH=#{ldLibraryPath} &&", > @@ -2220,14 +2215,14 @@ def runTestRunner(remoteIndex=0) > remoteHost = $remoteHosts[remoteIndex] > getRemoteDirectoryIfNeeded(remoteHost) > copyBundleToRemote(remoteHost) > - remoteScript = "\"" > + remoteScript = "'" > remoteScript += "cd #{remoteHost.remoteDirectory} && " > remoteScript += "rm -rf #{$outputDir.basename} && " > remoteScript += "tar xzf #{$tarFileName} && " > remoteScript += "cd #{$outputDir.basename}/.runner && " > - remoteScript += exportBaseEnvironmentVariables(true) > + remoteScript += exportBaseEnvironmentVariables > $envVars.each { |var| remoteScript += "export " << var << "\n" } > - remoteScript += "#{testRunnerCommand(remoteIndex)}\"" > + remoteScript += "#{testRunnerCommand(remoteIndex)}'" > runAndMonitorTestRunnerCommand(["ssh", "-o", > "NoHostAuthenticationForLocalhost=yes", "-p", remoteHost.port.to_s, > "#{remoteHost.user}@#{remoteHost.host}", remoteScript]) > else > Dir.chdir($runnerDir) { > @@ -2637,7 +2632,7 @@ def runGnuParallelRunner(remoteHosts, inputs, > options={}) > "--timeout", timeout.to_s, > "-a", inputs, > "if test -e #{$outputDir.basename}/.runner; then cd > #{$outputDir.basename}/.runner; else echo > #{PARALLEL_REMOTE_STATE_LOST_MARKER}; false; fi && " + > - exportBaseEnvironmentVariables(false) + > + exportBaseEnvironmentVariables + > $envVars.collect { |var | "export #{var} &&"}.join("") + > "sh " > ] Yeah, the issue here is export is using pwd, with the cd part failed, it won't export to the right path when run with remote device.
Note You need to log in before you can comment on or make changes to this bug.