← All tasks
javajacoco/jacoco #828Not a task: already works

Upgrade maven-surefire-plugin

envgap__jacoco__jacoco-828

01 / FAILURE SIGNATURE

As reported upstream

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project org.jacoco.core.test: There are test failures.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
af337538d57f900be7e94c30b6c162fb8606e5f6
Manifest
org.jacoco.build/pom.xml
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

jacoco/jacoco #828 · read the original issue
This ticket is about upgrade of `maven-surefire-plugin` in the build of JaCoCo itself.



----



Failure of agent startup during build of JaCoCo with JDK 13 EA b3 without #835 was ignored by `maven-surefire-plugin` version `2.9` that we currently use:



```

$ java -version

openjdk version "13-ea" 2019-09-17

OpenJDK Runtime Environment (build 13-ea+3)

OpenJDK 64-Bit Server VM (build 13-ea+3, mixed mode, sharing)



$ mvn clean package -Dmaven.javadoc.skip

...

[INFO] ------------------< org.jacoco:org.jacoco.core.test >-------------------

[INFO] Building JaCoCo :: Test :: Core 0.8.3-SNAPSHOT                   [11/27]

[INFO] --------------------------------[ jar ]---------------------------------

...

[INFO] --- maven-surefire-plugin:2.9:test (default-test) @ org.jacoco.core.test ---

[INFO] Surefire report directory: /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports



-------------------------------------------------------

 T E S T S

-------------------------------------------------------

Exception in thread "main" java.lang.reflect.InvocationTargetException

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

	at java.base/java.lang.reflect.Method.invoke(Method.java:567)

	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)

	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)

Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.

FATAL ERROR in native method: processing of -javaagent failed

	at org.jacoco.agent.rt.internal_0a2a6bf.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)

	at org.jacoco.agent.rt.internal_0a2a6bf.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)

	at org.jacoco.agent.rt.internal_0a2a6bf.PreMain.createRuntime(PreMain.java:55)

	at org.jacoco.agent.rt.internal_0a2a6bf.PreMain.premain(PreMain.java:47)

	... 6 more

Caused by: java.lang.NoSuchFieldException: $jacocoAccess

	at java.base/java.lang.Class.getField(Class.java:2005)

	at org.jacoco.agent.rt.internal_0a2a6bf.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)

	... 9 more



Results :



Tests run: 0, Failures: 0, Errors: 0, Skipped: 0



...

[INFO] -------------< org.jacoco:org.jacoco.core.test.validation >-------------

[INFO] Building JaCoCo :: Test :: Core :: Validation 0.8.3-SNAPSHOT     [12/27]

[INFO] --------------------------------[ pom ]---------------------------------

...

```



This was fixed (https://issues.apache.org/jira/browse/SUREFIRE-780) in version `2.11`.



----



And BTW starting from `2.20` failure looks differently:



```

...

[INFO] -------------------------------------------------------

[INFO]  T E S T S

[INFO] -------------------------------------------------------

[WARNING] Corrupted stdin stream in forked JVM 1. See the dump file /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports/2019-01-11T10-50-15_109-jvmRun1.dumpstream

[INFO]

[INFO] Results:

[INFO]

[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

...

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project org.jacoco.core.test: There are test failures.

[ERROR]

[ERROR] Please refer to /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports for the individual test results.

[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.

[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

[ERROR] Command was /bin/sh -c cd /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test && /Users/evgeny.mandrikov/.java-select/versions/openjdk-13-ea+3_osx-x64_bin/bin/java '-javaagent:/Users/evgeny.mandrikov/projects/jacoco/org.jacoco.agent/target/classes/jacocoagent.jar=destfile=/Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/jacoco.exec,includes=org.jacoco.core.*,excludes=null,exclclassloader=sun.reflect.DelegatingClassLoader:org.jacoco.core.test.TargetLoader:org.jacoco.core.test.InstrumentingLoader,sessionid=org.jacoco.core.test' -jar /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire/surefirebooter14352498116841005164.jar /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire 2019-01-11T10-50-15_109-jvmRun1 surefire14648698342658008777tmp surefire_06189757239861878345tmp

[ERROR] Error occurred in starting fork, check output in log

[ERROR] Process Exit Code: 134

[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?

[ERROR] Command was /bin/sh -c cd /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test && /Users/evgeny.mandrikov/.java-select/versions/openjdk-13-ea+3_osx-x64_bin/bin/java '-javaagent:/Users/evgeny.mandrikov/projects/jacoco/org.jacoco.agent/target/classes/jacocoagent.jar=destfile=/Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/jacoco.exec,includes=org.jacoco.core.*,excludes=null,exclclassloader=sun.reflect.DelegatingClassLoader:org.jacoco.core.test.TargetLoader:org.jacoco.core.test.InstrumentingLoader,sessionid=org.jacoco.core.test' -jar /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire/surefirebooter14352498116841005164.jar /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire 2019-01-11T10-50-15_109-jvmRun1 surefire14648698342658008777tmp surefire_06189757239861878345tmp

[ERROR] Error occurred in starting fork, check output in log

```



warning was improved in `2.21.0`



```

[WARNING] Corrupted STDOUT by directly writing to native stream in forked JVM 1. See FAQ web page and the dump file /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports/2019-01-11T10-43-51_263-jvmRun1.dumpstream

```



yet principle stays the same till latest released version `3.0.0-M4` - one need to check log files to see our exception



```

$ cat /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports/2019-01-11T10-43-51_263-jvmRun1.dumpstream

# Created at 2019-01-11T10:44:01.009

Corrupted STDOUT by directly writing to native stream in forked JVM 1. Stream 'FATAL ERROR in native method: processing of -javaagent failed'.

java.lang.IllegalArgumentException: Stream stdin corrupted. Expected comma after third character in command 'FATAL ERROR in native method: processing of -javaagent failed'.

	at org.apache.maven.plugin.surefire.booterclient.output.ForkClient$OperationalData.<init>(ForkClient.java:507)

	at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.processLine(ForkClient.java:210)

	at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consumeLine(ForkClient.java:177)

	at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamConsumer$Pumper.run(ThreadedStreamConsumer.java:88)

	at java.base/java.lang.Thread.run(Thread.java:835)

```



```

$ cat /Users/evgeny.mandrikov/projects/jacoco/org.jacoco.core.test/target/surefire-reports/2019-01-11T10-43-51_263.dumpstream

# Created at 2019-01-11T10:44:01.008

Exception in thread "main" java.lang.reflect.InvocationTargetException



# Created at 2019-01-11T10:44:01.009

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



# Created at 2019-01-11T10:44:01.010

	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)



# Created at 2019-01-11T10:44:01.011

	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)



# Created at 2019-01-11T10:44:01.011

	at java.base/java.lang.reflect.Method.invoke(Method.java:567)



# Created at 2019-01-11T10:44:01.012

	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)



# Created at 2019-01-11T10:44:01.012

	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)



# Created at 2019-01-11T10:44:01.012

Caused by: java.lang.RuntimeException: Class java/lang/UnknownError could not be instrumented.



# Created at 2019-01-11T10:44:01.012

	at org.jacoco.agent.rt.internal_0a2a6bf.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)

```

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]