-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix windows CI #14106
Fix windows CI #14106
Conversation
3670c73
to
83db8e1
Compare
This change to val relpath = some(testscript.topath.relpath.norm).map {
case s if cygwin => s"$$(cygpath -aw $s)"
case s => s
}.get The backslash is avoided by passing val relpath = some(testscript.topath.relpath.norm).map {
case s if cygwin => s"$$(cygpath -am $s)"
case s => s
}.get If the test is run in a cygwin environment, it fails like this: $ bash -c compiler/target/scala-3.1.1-RC1/test-classes/scripting/classpathReport.sc
env: unknown option -- S
Try '/usr/bin/env --help' for more information. It passes in my I just realized, we don't need to use |
cb5a3f5
to
04a43f6
Compare
What is an example of the path construction problem? In this case, where the path is consumed by cygpath -dm "C:\Program Files" converts to an equivalent path without spaces: C:/PROGRA~1 |
Sorry, I deleted my comment as I realized I was wrong, however, |
Ok, good to know. |
So I see that the current problem is that we should fix somehow passing arguments.
If I am correct we will get arguments as solid string, so I feel like we should try to split the string into multiple args by white spaces rather than to add this additional case, because we will never enter that |
This strips I'm not sure it is sufficient as-is, however, so you're probably right. |
But then we won't have env variables set up. We should split the |
Ok, this should work (I will start testing it to verify): -cp*|-classpath*) # partial fix for #10761
# separate hashbang-combined args "-classpath 'lib/*'"
addScala "-classpath"
addScala "${1#* *}${PSEP}"
shift
;; In addition, we can't use /usr/bin/env in the shebang line. This should work, I';; verify #!dist/target/pack/bin/scala -classpath 'lib/*' |
It works partially, but for script like this:
It won't process the |
That would prevent scala from passing arguments (e.g., filenames) with embedded whitespace. So I'm proposing this: if an argument matches The version handles -classpath*)
if [ "$1" != "${1##* }" ]; then
# hashbang-combined args "-classpath 'lib/*'"
A=$1 ; shift # consume $1 before adding its substrings back
set -- $A "$@" # split $1 on whitespace and put it back
else
addScala "$1"
shift
fi
;; |
People cheat this with wrapper workaround, in our case it would be:
|
This works too |
wow, I accidentally hit [CLOSE WITH COMMENT] and there's no chance to cancel ! |
Here's a proposal: in |
This what I was thinking about too. The only question is whether
|
04a43f6
to
e32d15d
Compare
If you have an idea how to fix the shebang issue with splitting the args please commit to this branch as here we have windows CI test set up. I will try to do that too but I am not very proficient with bash |
EDIT: I haven't seen your proposal. I think that if it works it is close enough to be accepted, cause it is hard to propose something more clever in this situation. I will check if CI passes |
e32d15d
to
d0d7022
Compare
This version handles -classpath*)
if [ "$1" != "${1##* }" ]; then
# hashbang-combined args "-classpath 'lib/*'"
A=$1 ; shift # consume $1 before adding its substrings back
set -- $A "$@" # split $1 on whitespace and put it back
else
addScala "$1"
shift
fi
;; However, I'm now grappling with another issue (although it might be unrelated).
The problem is that the script only sees [info] Test run finished: 1 failed, 0 ignored, 2 total, 5.332s
[error] Failed: Total 2, Failed 1, Errors 0, Passed 1
[error] Failed tests:
[error] dotty.tools.scripting.ClasspathTests
[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 7 s, completed Dec 14, 2021, 8:25:29 AM
sbt:scala3> I assume the problem is in MainGenericRunner, or possibly further down the pipe. All classpaths after the first might be discarded (at one time, there was a warning, but it might still be (silently) discarding things). The proper fix would be to append the additional classpath each time. Otherwise, a script is never able to affect its classpath. which part is confusing? The bash script? |
This example code will insert several arguments at the head of
If So these two lines:
have the following effect:
Afterwards, the split arguments will be parsed in order, as intended. |
Since
to make sure that everything will work OK. Make sure to include the change to |
I'm investigating. It sounds good, although this problem with ClasspathTests is not yet fixed. |
To disable tests one cpuld remove |
I am creating a new PR, so I'll be able to trigger the additional tests. [test_windows_full] The new PR is #14113 |
Ok, I'm closing this one then |
* refactor common code from scripting tests; invalid tests fail by default * dump stdout/stderr if BashScriptsTests.verifyScalaOpts fails * fix for failing cygwin tests for #14106 * normalize scala and scalac paths; set proper SHELLOPTS in cygwin bashCommandline env * improved detection of scalacPath and scalaPath; additional logging * print warnings; remove unused code * strip ansi colors from bash command line output, to fix windows tests * dist/pack before sbt test in test_windows_full and test_non_bootstrapped * squeeze redundancy from env-var-setting tests, add more log messages * further reduced redundancy; additional log messages * remove trailing java from JAVA_HOME value; shorten comand lines with relpath * Update BashScriptsTests.scala remove duplicate * Update BashScriptsTests.scala Fix not-updating property Co-authored-by: Andrzej Ratajczak <[email protected]>
* refactor common code from scripting tests; invalid tests fail by default * dump stdout/stderr if BashScriptsTests.verifyScalaOpts fails * fix for failing cygwin tests for scala#14106 * normalize scala and scalac paths; set proper SHELLOPTS in cygwin bashCommandline env * improved detection of scalacPath and scalaPath; additional logging * print warnings; remove unused code * strip ansi colors from bash command line output, to fix windows tests * dist/pack before sbt test in test_windows_full and test_non_bootstrapped * squeeze redundancy from env-var-setting tests, add more log messages * further reduced redundancy; additional log messages * remove trailing java from JAVA_HOME value; shorten comand lines with relpath * Update BashScriptsTests.scala remove duplicate * Update BashScriptsTests.scala Fix not-updating property Co-authored-by: Andrzej Ratajczak <[email protected]>
[test_windows_full]