JUnit Test for Model Checker of languages
I have written a simple node testcase code like this for the model checker of the language.
ModelCheckerTool instance = ModelCheckerTool.getInstance(toIdeaProject);
ModelCheckerViewer checkModels = instance.checkModels(language.getModels());
SearchResults<IssueKindReportItem> searchResults = checkModels.getSearchResults();
if (searchResults.getResultObjects() != null) {
assert (ModelCheckerUtils.getIssueCountForSeverity(searchResults, ModelCheckerIssueFinder.SEVERITY_ERROR)) <= 0;
}
Result:
The test is running completely fine inside MPS. While running through ant target for the same, I am getting loop hole like this.
17:19:24 [junit] [ 89286] INFO - st.runtime.TestParametersCache - Initializing the test 17:19:24 [junit] [ 89286] INFO - ol.environment.EnvironmentBase - Using the last created project 17:19:24 [junit] [ 89343] INFO - il.indexing.FileBasedIndexImpl - START INDEX SHUTDOWN 17:19:24 [junit] [ 89373] INFO - il.indexing.FileBasedIndexImpl - END INDEX SHUTDOWN 17:19:24 [junit] [ 89373] INFO - stubs.SerializationManagerImpl - START StubSerializationManager SHUTDOWN 17:19:24 [junit] [ 89373] INFO - stubs.SerializationManagerImpl - END StubSerializationManager SHUTDOWN 17:19:24 [junit] [ 89375] INFO - newvfs.persistent.PersistentFS - VFS dispose started 17:19:24 [junit] [ 89379] INFO - newvfs.persistent.PersistentFS - VFS dispose completed
I increased the VM size in the buildScript and then disposed off the modelchecker tool like this.
instance.dispose();
But both didn't work in my case.
Any clues for resolving the issue. Waiting for your answers.
Thanks in Advance,
Narendran
Please sign in to leave a comment.
When you run the test from the IDE, do you execute it within the same process as MPS is running, or in a separate process (it's a setting in the Run configuration of your test).
I remember that there were issues running the model checker programmatically from command line, not sure what the current state of afairs is though.
One thing to point out is that there is also the possibility to run the model checks with a different API, namely implementations of the IChecker interface in the jetbrains.mps.kernel module, but it might very well be that this is not the only (or best) way to achieve that. Maybe also have a look at https://github.com/mbeddr/mps-gradle-plugin/blob/master/README.md#model-check, where one apparently can run model checks from gradle directly.