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

EnsoCompilerTest to verify compatibility of parsers #3723

Merged
merged 5 commits into from
Sep 20, 2022

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Sep 20, 2022

Pull Request Description

Adding new compatibility test EnsoCompilerTest to verify the new Rust based parser can produce the same IR as the original AST based one. The simplest way to execute the test from an empty repository is:

enso$ sbt bootstrap
enso$ sbt "testOnly *EnsoCompilerTest"

There are GitHub Actions run on Linux as well as run on Windows that show EnsoCompilerTest is being executed by the CI (good, as that means .so was properly built and linked to the JVM running the test). The linux as well as windows runs also demonstrate that failures in the EnsoCompilerTest suite fail the CI.

Important Notes

Right now there are five test failures - waiting for @kazcw to make sure codeRepr() doesn't contain spaces. However, as this PR is more about the infrastructure, I am disabling the currently failing tests in 031169b

Checklist

Please include the following checklist in your PR:

  • [ x ] All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • [ x ] Unit tests have been written where possible.

[ci no changelog needed]

@JaroslavTulach JaroslavTulach added the CI: Ready to merge This PR is eligible for automatic merge label Sep 20, 2022
Copy link
Contributor

@4e6 4e6 left a comment

Choose a reason for hiding this comment

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

Looks good overall, just a couple of suggestions

@kazcw
Copy link
Contributor

kazcw commented Sep 20, 2022

The Rust changes look good. The sbt testOnly command is not working for me, I get:

java.lang.ClassNotFoundException: org.enso.interpreter.node.expression.builtin.bool.True                                                                       
  | => eat java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)                                                                                                                                                                                                                                               
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)                                                                                     
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)                                                                                                                                                                                                                                                    
        at java.base/java.lang.Class.forName0(Native Method)                                                                                                   
        at java.base/java.lang.Class.forName(Class.java:315)                                                                                                   
        at org.enso.interpreter.runtime.builtin.Builtins.lambda$readBuiltinTypesMetadata$4(Builtins.java:232)                                                  
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)                                                                 
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)                                                            
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)                                                                     
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)                                                              
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)                                                                
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)                                                                     
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)                                                                    
        at org.enso.interpreter.runtime.builtin.Builtins.readBuiltinTypesMetadata(Builtins.java:243)                                                           
        at org.enso.interpreter.runtime.builtin.Builtins.<init>(Builtins.java:105)                                                                             
        at org.enso.interpreter.runtime.Context.<init>(Context.java:107)                                                                                       
        at org.enso.interpreter.Language.createContext(Language.java:115)
        at org.enso.interpreter.Language.createContext(Language.java:44)                                                                                       
        at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.createEnvContext(LanguageAccessor.java:283)                                
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:557)                                                                                                                                                                                            
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:500)                             
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureInitialized(PolyglotLanguageContext.java:642)                         
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:969)                                       
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:97)                                
        at org.graalvm.sdk/org.graalvm.polyglot.Context.getBindings(Context.java:540)                                                                                                                                                                                                                                         
        at org.enso.polyglot.PolyglotContext.getTopScope(PolyglotContext.scala:37)                                                                             
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.findImportedLibraries$1(CompilerBasedDependencyExtractor.scala:28)               
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.$anonfun$findDependencies$2(CompilerBasedDependencyExtractor.scala:40)           
        at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:118)                                                           
        at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:105)                                                          
        at scala.collection.immutable.HashSet.flatMap(HashSet.scala:34)       
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.findDependencies(CompilerBasedDependencyExtractor.scala:40)                                                                                                                                                                                     
        at org.enso.libraryupload.LibraryUploader.$anonfun$updateManifest$1(LibraryUploader.scala:95)                                                          
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)                                                                             
        at scala.util.Try$.apply(Try.scala:210)
        at org.enso.libraryupload.LibraryUploader.updateManifest(LibraryUploader.scala:94)
        at org.enso.runner.ProjectUploader$.updateManifest(ProjectUploader.scala:76)
        at org.enso.runner.Main$.main(Main.scala:1010)
        at org.enso.runner.Main.main(Main.scala)
Exception in thread "main" org.graalvm.polyglot.PolyglotException: org.enso.compiler.exception.CompilerError: Compiler Internal Error: Invalid builtin type entry: org.enso.interpreter.node.expression.builtin.bool.True
        at org.enso.interpreter.runtime.builtin.Builtins.lambda$readBuiltinTypesMetadata$4(Builtins.java:240)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at org.enso.interpreter.runtime.builtin.Builtins.readBuiltinTypesMetadata(Builtins.java:243)
        at org.enso.interpreter.runtime.builtin.Builtins.<init>(Builtins.java:105)
        at org.enso.interpreter.runtime.Context.<init>(Context.java:107)
        at org.enso.interpreter.Language.createContext(Language.java:115)
        at org.enso.interpreter.Language.createContext(Language.java:44)
        at org.graalvm.truffle/com.oracle.truffle.api.LanguageAccessor$LanguageImpl.createEnvContext(LanguageAccessor.java:283)
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:557)
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureCreated(PolyglotLanguageContext.java:500)
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotLanguageContext.ensureInitialized(PolyglotLanguageContext.java:642)
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextImpl.getBindings(PolyglotContextImpl.java:969)
        at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotContextDispatch.getBindings(PolyglotContextDispatch.java:97)
        at org.graalvm.sdk/org.graalvm.polyglot.Context.getBindings(Context.java:540)
        at org.enso.polyglot.PolyglotContext.getTopScope(PolyglotContext.scala:37)
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.findImportedLibraries$1(CompilerBasedDependencyExtractor.scala:28)
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.$anonfun$findDependencies$2(CompilerBasedDependencyExtractor.scala:40)
        at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:118)
        at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:105)
        at scala.collection.immutable.HashSet.flatMap(HashSet.scala:34)
        at org.enso.languageserver.libraries.CompilerBasedDependencyExtractor.findDependencies(CompilerBasedDependencyExtractor.scala:40)
        at org.enso.libraryupload.LibraryUploader.$anonfun$updateManifest$1(LibraryUploader.scala:95)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at scala.util.Try$.apply(Try.scala:210)
        at org.enso.libraryupload.LibraryUploader.updateManifest(LibraryUploader.scala:94)
        at org.enso.runner.ProjectUploader$.updateManifest(ProjectUploader.scala:76)
        at org.enso.runner.Main$.main(Main.scala:1010)
        at org.enso.runner.Main.main(Main.scala)
Caused by: Attached Guest Language Frames (0)
Internal GraalVM error, please report at https://github.com/oracle/graal/issues/.
[error] Command [List(/usr/local/lib/graalvm-ce-java11-21.3.0/bin/java, -Dtruffle.class.path.append=runtime.jar, -jar, runner.jar, --update-manifest, --in-project, /home/ubuntu/repo/enso/wip/distribution/lib/Standard/Base/0.0.0-dev)] has failed with code 1.
[info] compiling 3 Scala sources to /home/ubuntu/repo/enso/wip/engine/language-server/target/scala-2.13/test-classes ...
[error] java.lang.RuntimeException: Command [List(/usr/local/lib/graalvm-ce-java11-21.3.0/bin/java, -Dtruffle.class.path.append=runtime.jar, -jar, runner.jar, --update-manifest, --in-project, /home/ubuntu/repo/enso/wip/distribution/lib/Standard/Base/0.0.0-dev)] has failed with code 1.
[error]         at LibraryManifestGenerator$.runGenerator(LibraryManifestGenerator.scala:72)
[error]         at LibraryManifestGenerator$.$anonfun$generateManifests$3(LibraryManifestGenerator.scala:41)
[error]         at LibraryManifestGenerator$.$anonfun$generateManifests$3$adapted(LibraryManifestGenerator.scala:37)
[error]         at sbt.util.Difference.apply(Tracked.scala:414)
[error]         at sbt.util.Difference.apply(Tracked.scala:389)
[error]         at LibraryManifestGenerator$.$anonfun$generateManifests$2(LibraryManifestGenerator.scala:37)
[error]         at LibraryManifestGenerator$.$anonfun$generateManifests$2$adapted(LibraryManifestGenerator.scala:23)
[error]         at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:985)
[error]         at scala.collection.immutable.List.foreach(List.scala:431)
[error]         at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:984)
[error]         at LibraryManifestGenerator$.generateManifests(LibraryManifestGenerator.scala:23)
[error]         at $1e2e758c0fad75e93a2c$.$anonfun$$sbtdef$2(/home/ubuntu/repo/enso/wip/build.sbt:2095)
[error]         at $1e2e758c0fad75e93a2c$.$anonfun$$sbtdef$2$adapted(/home/ubuntu/repo/enso/wip/build.sbt:2083)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error]         at sbt.Execute.work(Execute.scala:291)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error]         at java.base/java.lang.Thread.run(Thread.java:829)
[error] (updateLibraryManifests) Command [List(/usr/local/lib/graalvm-ce-java11-21.3.0/bin/java, -Dtruffle.class.path.append=runtime.jar, -jar, runner.jar, --update-manifest, --in-project, /home/ubuntu/repo/enso/wip/distribution/lib/Standard/Base/0.0.0-dev)] has failed with code 1.
[error] Total time: 31 s, completed Sep 20, 2022, 3:16:11 PM

Any idea what might be wrong with my environment? I think I have the right version of Graal.

@JaroslavTulach
Copy link
Member Author

Any idea what might be wrong with my environment? I think I have the right version of Graal.

Looks like there is some debris from previous builds - try sbt clean first. Or (to be sure):

enso$ rm -rf *; git checkout -f .

@kazcw
Copy link
Contributor

kazcw commented Sep 20, 2022

That worked! I had done a ./run git-clean, which I thought would be just as comprehensive

@mergify mergify bot merged commit 9134f9b into develop Sep 20, 2022
@mergify mergify bot deleted the wip/jtulach/TestRustParser_183250941 branch September 20, 2022 15:50
@JaroslavTulach JaroslavTulach mentioned this pull request Mar 14, 2023
5 tasks
mergify bot pushed a commit that referenced this pull request Mar 28, 2023
The primary delivery of this PR is a design of `SerdeCompilerTest` - a testing suite that allows us to write sample projects, parse them with and without caches and verify they still produce the same `IR`. This is a similar idea to #3723 which compared the old and new parser `IR`s.

With infrastructure like this we can start addressing #5567 without any (significant) fear of breaking something essential.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants