Hi,

JaCoCo and hence EclEmma rely on the execution of JVM shutdown hook.
The message "java.net.SocketException: Connection reset" might indicate 
that JVM shutdown hook was not executed.

Using
Eclipse Version: 2019-09 R (4.13.0), Build id: 20190917-1200

After clone of your project at 
https://github.com/ReactiveX/RxJava/commits/5f6aafcbaa97f330ad2007f4ad02c5e33db8914b

Execution of the following test *even without EclEmma* 

package io.reactivex.rxjava3.core;

import org.junit.Test;

public class ExampleTest extends RxJavaTest {
    @Test
    public void test() {
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
        @Override
        public void run() {
            System.err.println("hook executed");
        }
    }));
    }
}


Won't print anything, whereas execution of the same test without "extends 
RxJavaTest" will print "hook executed".

The same test will also print "hook executed" if you remove "globalTimeout" 
defined in "RJavaTest".

>From the above IMO clear that the issue is not in EclEmma.

Furthermore, problem with execution of JVM shutdown hooks
in presence of org.junit.rules.Timeout from JUnit 4.13 can be demonstrated
without Eclipse
using following "build.gradle"

apply plugin: 'java'

repositories {
  mavenCentral()
}

test {
  testLogging.showStandardStreams = true
}

dependencies {
  testCompile 'junit:junit:4.13'
}

and following "src/test/java/Example.java"

import org.junit.Test;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.Timeout;

import java.util.concurrent.TimeUnit;

public class ExampleTest {
  @Rule
  public Timeout globalTimeout = new Timeout(5, TimeUnit.MINUTES);

  @Test
  public final void test() {
    Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
      @Override
      public void run() {
        System.err.println("hook executed");
      }
    }));
  }
}


And since the problem goes away in all the above cases after downgrade to 
JUnit 4.12,
then IMO it is caused by changes in JUnit 4.13.


Regards,
Evgeny


On Sunday, February 16, 2020 at 6:56:33 PM UTC+1, Dávid Karnok wrote:
>
> Hi. I've run into an odd coverage failure with JUnit 4.13, Eclipse, 
> EclEmma and test methods referencing Google Guava's Cache. 
>
> I was advised by the JUnit project to ask about the situation with this 
> project (and/or with Eclipse / Google Guava).
>
>
> #### Environment:
>
> Eclipse: Version: 2019-09 R (4.13.0), Build id: 20190917-1200
> EclEmma 3.1.2.201903112331 org.eclipse.eclemma.feature.feature.group Eclipse 
> EclEmma
> JUnit 4.13
> Windows 10 x64
> Java 1.8u241
>
> #### Issue:
>
> I've run into an odd error while running coverage on an unit test having 
> some methods use Google Guava's CacheBuilder in Eclipse. The coverage fails 
> with the error code 5013 and error report indicating 
> java.net.SocketException: Connection reset. If I remove these methods, the 
> coverage succeeds.
>
> If I revert back to JUnit 4.12, both the test file and the individual test 
> succeeds in producing the coverage data.
>
> Example method:
>
> https://github.com/ReactiveX/RxJava/blob/5f6aafcbaa97f330ad2007f4ad02c5e33db8914b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java#L1917
>
> This is where the cache is created:
>
> https://github.com/ReactiveX/RxJava/blob/5f6aafcbaa97f330ad2007f4ad02c5e33db8914b/src/test/java/io/reactivex/rxjava3/internal/operators/flowable/FlowableGroupByTest.java#L2194
>
> #### Additional details:
>
> - If I run "gradlew test jacocoTestReport" on the entire project, it 
> succeeds in creating the report HTML apparently.
> - If I run "Coverage As > JUnit test" on the entire project from Eclipse, 
> it fails with the same 5013 error.
> - If I run any other test class/package/method in the project, the 
> coverage is created successfully.
>
> Please advise.
>

-- 
You received this message because you are subscribed to the Google Groups 
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jacoco/9e33ca8c-f0cf-467a-9254-cb170d61c44d%40googlegroups.com.

Reply via email to