STAMP-project / test-runner

test driver to run JUnit tests isolated in a new JVM
GNU General Public License v3.0
16 stars 15 forks source link

feat: add useOptionsFile config to pass looooooong options #142 #143

Closed danglotb closed 2 years ago

danglotb commented 2 years ago

@andre15silva , @monperrus WDYT?

monperrus commented 2 years ago

lgtm, thanks @danglotb

andre15silva commented 2 years ago

Hi @danglotb

I'm trying to use this PR on flacoco but I get the following error:

Running fr.spoonlabs.flacoco.api.Math70Test
[0] INFO Flacoco - Running Flacoco...
Unrecognized option: --path-options-file
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.885 sec <<< FAILURE!
testMath70(fr.spoonlabs.flacoco.api.Math70Test)  Time elapsed: 1.739 sec  <<< ERROR!
java.lang.RuntimeException: Forked process did not finish correctly.
Timeout set was 1000000 ms, process took 5 ms before ending.
Use the verbose mode to obtain more information regarding the error.
    at eu.stamp_project.testrunner.EntryPoint.runGivenCommandLine(EntryPoint.java:830)
    at eu.stamp_project.testrunner.EntryPoint.runOnlineCoveredTestResultPerTestMethods(EntryPoint.java:720)
    at fr.spoonlabs.flacoco.core.coverage.framework.JUnit4Strategy.execute(JUnit4Strategy.java:27)
    at fr.spoonlabs.flacoco.core.coverage.CoverageRunner.getCoverageMatrix(CoverageRunner.java:47)
    at fr.spoonlabs.flacoco.localization.spectrum.SpectrumRunner.computeCoverageMatrix(SpectrumRunner.java:68)
    at fr.spoonlabs.flacoco.localization.spectrum.SpectrumRunner.run(SpectrumRunner.java:42)
    at fr.spoonlabs.flacoco.api.Flacoco.run(Flacoco.java:31)
    at fr.spoonlabs.flacoco.api.Math70Test.testMath70(Math70Test.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
    at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
    at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:242)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:137)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

I have set the option to true:

        EntryPoint.useOptionsFile = true;
danglotb commented 2 years ago

Hi @andre15silva

Thank you for testing, I did not update the binaries, therefore the options were not included in the fresh JVM.

I also made a test and updated the README.

Best.

andre15silva commented 2 years ago

Great!

Flacoco's test suite is all green now! :tada:

danglotb commented 2 years ago

Great news! I think this is ready to be merged

@monperrus could merge it please?

Best.

monperrus commented 2 years ago

Thanks a lot @danglotb