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

Run unit tests with truffle-compiler #8467

Merged
merged 50 commits into from
Dec 18, 2023

Conversation

Akirathan
Copy link
Member

@Akirathan Akirathan commented Dec 5, 2023

Fixes #8374

Pull Request Description

runtime/test and language-server/test runs with truffle-compiler module. This should speed up these tests. Moreover, it fixes the withDebug command.

Important Notes

  • Add runtime-fat-jar sbt project.
    • A meta project that just contains the logic for assembling runtime.jar fat jar.
    • Increases readability.
    • No need to copy any classes from other runtime-* projects into runtime-with-instruments/target directory.
  • Add runtime-test-instruments project.
    • This project is an explicit JPMS module, i.e., it has module-info.java.
    • Its sole purpose is to provide truffle instruments that are used in runtime/test.
    • It uses reflection to access classes from runtime.
  • Merge runtime-with-instruments and runtime-with-polyglot into runtime/Test. Those projects contained only tests.
  • Add a caching mechanism so that classes from other runtime-* projects are not copied every time into runtime-fat-jar/target.
  • runtime/test are run with patched org.enso.runtime module such that all the instruments (and test classes) are included in the module. Moreover, the --patch-module is required to avoid reassembling runtime.jar fat jar before every test.
  • Various sbt refactorings.
    • Add JPMSPlugin sbt auto plugin that makes handling of the JPMS modules related stuff easier.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@Akirathan Akirathan self-assigned this Dec 5, 2023
build.sbt Outdated Show resolved Hide resolved
@Akirathan Akirathan added the CI: No changelog needed Do not require a changelog entry for this PR. label Dec 8, 2023
@Akirathan
Copy link
Member Author

So far, runtime/test and runtime-with-instruments/test work, and they both run with truffle-compiler. Moreover, they do not assemble any fat jars, which should have a positive impact on build times.

Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than using reflection: invert the dependencies.


exports org.enso.interpreter.test.instruments;

provides com.oracle.truffle.api.instrumentation.provider.TruffleInstrumentProvider with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separate module & module info for test only instruments is a good idea.

@Akirathan Akirathan force-pushed the wip/akirathan/8374-compiler-to-tests branch from eb78eb2 to 3d097ee Compare December 18, 2023 10:17
@Akirathan Akirathan marked this pull request as ready for review December 18, 2023 10:45
@Akirathan Akirathan requested a review from 4e6 as a code owner December 18, 2023 10:45
Copy link
Member

@JaroslavTulach JaroslavTulach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's get this in!

@Akirathan Akirathan merged commit 21d164e into develop Dec 18, 2023
29 of 30 checks passed
@Akirathan Akirathan deleted the wip/akirathan/8374-compiler-to-tests branch December 18, 2023 17:22
mergify bot pushed a commit that referenced this pull request Dec 19, 2023
Followup to #8467

Fixes the issue when `runtime/test` command fails to compile without fat jar classes:
```
sbt:enso> runtime/test
[warn] JPMSPlugin: Directory /home/dbushev/projects/luna/enso/engine/runtime-fat-jar/target/scala-2.13/classes does not exist.
[warn] JPMSPlugin: Directory /home/dbushev/projects/luna/enso/engine/runtime-fat-jar/target/scala-2.13/classes does not exist.
[info] compiling 106 Scala sources and 60 Java sources to /home/dbushev/projects/luna/enso/engine/runtime/target/scala-2.13/test-classes ...
[warn] Unexpected javac output: error: module not found: org.enso.runtime
[warn] 1 error.
[warn] frgaal exited with exit code 1
[error] (runtime / Test / compileIncremental) javac returned non-zero exit code
```
mergify bot pushed a commit that referenced this pull request Dec 21, 2023
Make sure that the correct test logging provider is loaded in `project-manager/Test`, so that only WARN and ERROR log messages are displayed. Also, make sure that the test log provider parses the correct configuration file - Rename all the `application.conf` files in the test resources to `application-test.conf`.

The problem was introduced in #8467
@Akirathan Akirathan mentioned this pull request Dec 21, 2023
1 task
mergify bot pushed a commit that referenced this pull request Dec 22, 2023
After #8467, Engine benchmarks are broken, they cannot compile - https://github.com/enso-org/enso/actions/runs/7268987483/job/19805862815#logs

This PR fixes the benchmark build

# Important Notes
Apart from fixing the build of `engine/bench`:
- Don't assemble any fat jars in `runtime/bench`.
- Use our `TestLogProvider` in the benches instead of NOOP provider.
- So that we can at least see warnings and errors in benchmarks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run unit tests with truffle-compiler
3 participants