-
Notifications
You must be signed in to change notification settings - Fork 323
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
Serde testing infrastructure for the Enso compiler #6062
Conversation
…missing BindingAnalysis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the approach. Mostly minor nits
if (!ir1.equals(ir2)) { | ||
String name = findTestMethodName(); | ||
Path home = new File(System.getProperty("user.home")).toPath(); | ||
Files.writeString(home.resolve(name + ".1"), ir1, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE, StandardOpenOption.WRITE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we try and not write those to a user's home directory? A directory inside a checked out repo that is simply ignored would be much better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The files are written only in case of failure and are really helpful when one needs to diff
them. I was rewriting the old parser to new one without the files being dump and it was plain horrible - e.g. ignoring the files isn't an option. Feel free to suggest better location instead of home
. Anyway, this is not code introduced by this PR - I have just refactored it to another class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, it can write to the tmp
directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JaroslavTulach I know. I didn't like it then, I don't like it now. I understand the sentiment that with hundreds of failures you really want to have something nearby but I also don't like things polluting my home directory.
engine/runtime/src/test/java/org/enso/compiler/CompilerTest.java
Outdated
Show resolved
Hide resolved
engine/runtime/src/test/java/org/enso/compiler/SerdeCompilerTest.java
Outdated
Show resolved
Hide resolved
There were some suspicious test failures probably related not to the |
There is a failure in SerdeCompilerTest which can be reproduced as:
|
if (!ir1.equals(ir2)) { | ||
String name = findTestMethodName(); | ||
Path home = new File(System.getProperty("user.home")).toPath(); | ||
Files.writeString(home.resolve(name + ".1"), ir1, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE, StandardOpenOption.WRITE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, it can write to the tmp
directory
if (!ir1.equals(ir2)) { | ||
String name = findTestMethodName(); | ||
Path home = new File(System.getProperty("user.home")).toPath(); | ||
Files.writeString(home.resolve(name + ".1"), ir1, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE, StandardOpenOption.WRITE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JaroslavTulach I know. I didn't like it then, I don't like it now. I understand the sentiment that with hundreds of failures you really want to have something nearby but I also don't like things polluting my home directory.
OK, let's improve our engineering practices a bit. With fc013a7 one gets: [error] Test org.enso.compiler.SerdeCompilerTest.testFibTest failed:
Serialized and deserialized IR for Fib_Test expected:
</tmp/testFibTest.1> but was:</tmp/testFibTest.2>, took 2.608 sec
[error] Failed: Total 1, Failed 1, Errors 0, Passed 0 and one can diff the two files then. |
Pull Request Description
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 sameIR
. This is a similar idea to #3723 which compared the old and new parserIR
s.With infrastructure like this we can start addressing #5567 without any (significant) fear of breaking something essential.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
style guides. In case you are using a language not listed above, follow the Rust style guide.