-
Notifications
You must be signed in to change notification settings - Fork 63
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
Parallel execution of round trip tests #1845
Conversation
@@ -14,7 +14,10 @@ sourceSets { | |||
} | |||
test { | |||
java { | |||
srcDirs = ['src/test/java', 'test-gen'] | |||
srcDirs = ['src/test/java'] |
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 changed this because both testFixtures
and test
used test-gen
as a same source directory. Intellij does not support this. Since test
depends on testFixtures
there is no problem.
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.
Oh, that explains why Intellij showed all these errors. Thanks!
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 just noticed that test-gen
is also removed from the test fixtures. Now I am wondering: why does this work?
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.
Oh, it works because the PR adds a custom implementation of LfParsingTestHelper
, which is the only class generated in test-gen
.
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.
Yes! I don't know if we can disable the generation of the test-gen directory entirely, but at least it is ignored
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.
In fact, we can disable it. See #1858
578fe42
to
20371e0
Compare
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.
Cool! This makes a lot of sense. We'll have to convince the CI as well though ;)
This is what CI complains about:
|
Make TestRegistry a non-static singleton that can be injected.
core/src/test/java/org/lflang/tests/compiler/LinguaFrancaValidationTest.java
Show resolved
Hide resolved
Maybe this Junit feature can be used in the future to run the target tests concurrently, which would greatly speed them up as they spend large amounts of time waiting on IO. |
Several versions of org.eclipse.core.runtime were being provided to the integrationTest module, which made IntelliJ fail with a SecurityException
@@ -21,7 +21,7 @@ dependencies { | |||
testFixturesImplementation "org.junit.platform:junit-platform-commons:$jUnitPlatformVersion" | |||
testFixturesImplementation "org.junit.platform:junit-platform-engine:$jUnitPlatformVersion" | |||
testFixturesImplementation "org.opentest4j:opentest4j:$openTest4jVersion" | |||
testFixturesImplementation "org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion" | |||
testFixturesImplementation platform("org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion") |
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.
What does this magic incantation do?
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 don't understand it well, but it changes the version conflict resolution for dependencies. Previously, running tests from the integrationTest module in intellij failed with
java.lang.SecurityException: class "org.eclipse.core.runtime.OperationCanceledException"'s signer information does not match signer information of other classes in the same package
which indicates there are several jars on the classpath containing classes in this package --dependency hell.
The platform incantation forces the version conflict resolver to pick the dependency versions required by the 'platform', ie the versions it has been built and tested with. Without it, gradle is free to pick a newer version of each dependency independently, which resulted in an inconsistent dependency set apparently.
You can inspect how this affects our dependencies by running ./gradle :core:dependencies --configuration integrationTestRuntimeClasspath
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.
Interesting.. Thanks for the fix and explaining this!!
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.
This looks great!
core/src/testFixtures/java/org/lflang/tests/LFInjectorProvider.java
Outdated
Show resolved
Hide resolved
Thanks for merging! |
The formatter round trip tests currently take about a minute on my machine. Using concurrent execution and a small refactoring this is now down to under 20secs.
I converted the test to use Junit dynamic tests, which means each individual test file gets its own test instance. This allows JUnit to parallelize them, and the IDE to display each test and its status separately. Additionally, the test is linked to the source file, so that if you click on it from the IDE you'll jump to the test file.