Skip to content
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

fail verifyScalacArgs if dist/target/pack/bin/scalac not found - fix for #12962 #13029

Merged
merged 3 commits into from
Sep 23, 2021
Merged

fail verifyScalacArgs if dist/target/pack/bin/scalac not found - fix for #12962 #13029

merged 3 commits into from
Sep 23, 2021

Conversation

philwalk
Copy link
Contributor

@philwalk philwalk commented Jul 7, 2021

The following failure was simulated by deleting dist/target/pack/bin/scala* after dist/pack:

[info] Test dotty.tools.scripting.BashScriptsTests.verifyScalaArgs started
[error] Test dotty.tools.scripting.BashScriptsTests.verifyScalaArgs failed: java.lang.AssertionError: assertion failed, took 0.0 sec
[error]     at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
[error]     at dotty.tools.scripting.BashScriptsTests.verifyScalaArgs(BashScriptsTests.scala:67)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:566)
[error]     ...
[info] Test dotty.tools.scripting.BashScriptsTests.verifyScalacArgs started
[error] Test dotty.tools.scripting.BashScriptsTests.verifyScalacArgs failed: java.lang.AssertionError: assertion failed, took 0.0 sec
[error]     at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
[error]     at dotty.tools.scripting.BashScriptsTests.verifyScalacArgs(BashScriptsTests.scala:47)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:566)
[error]     ...
[info] Test run finished: 2 failed, 0 ignored, 2 total, 0.163s
[error] Failed: Total 2, Failed 2, Errors 0, Passed 0
[error] Failed tests:
[error]         dotty.tools.scripting.BashScriptsTests
[error] (scala3-compiler / Test / testOnly) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 1 s, completed Jul 7, 2021, 9:38:10 AM

@bishabosha
Copy link
Member

@philwalk it looks like your assertion is failing CI in this case

@philwalk
Copy link
Contributor Author

philwalk commented Jul 8, 2021

@bishabosha -

it looks like your assertion is failing CI in this case

The consensus in the discussion at #12962 is that it should fail if dist/target/pack/bin/scalac is not found. If that's a valid requirement, then the CI process itself probably needs to be modified. Alternatively, I just need to know where to find bin/scalac at test time.

@philwalk
Copy link
Contributor Author

philwalk commented Aug 2, 2021

This commit has a refactored BashScriptTests.scala in order to address issues described in #12962

It's now possible to override default values of the BashScriptsTests script execution environment, to set:

  • the working directory where scala commands and scripts are executed
  • which bash to use
  • where JAVA_HOME is
  • where SCALA_HOME is
 # set TEST_BASH to specify which bash to use; otherwise, bash must be in the PATH
TEST_BASH=c:/cygwin64/bin/bash.exe

# set TEST_CWD to set the working directory for `bash -c <command>`
TEST_CWD=/mnt/c/dotty

# if JAVA_HOME is defined, it will be added to the front of the PATH for bash command lines
JAVA_HOME='/mnt/c/Program Files/Java/jdk-11.0.12'

#  set SCALA_HOME if `./dist/target/pack` is not present
SCALA_HOME='/mnt/c/dotty/dist/target/pack'

#  if defined, $JAVA_HOME/bin and $SCALA_HOME/bin  prefixed to the PATH for `bash -c <command>` processes
PATH="$JAVA_HOME/bin:$SCALA_HOME/bin:$PATH"

Note that SCALA_HOME is ignored in favor of dist/target/pack if present below the current working directory.

@anatoliykmetyuk anatoliykmetyuk merged commit 5f47bfd into scala:master Sep 23, 2021
@philwalk philwalk deleted the fail-if-scalac-not-found-fixes-12962 branch September 23, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants