Gradle, Test task and '-XstartOnFirstThread' makes gradle hang

Hi,

I’m having problems with test run hanging when using the ‘-XstartOnFirstThread’ flag.

I want to run functional tests with UISpec4J, and using SWT which requires the ‘-XstartOnFirstThread’ flag. Hence I use the configuration:

test {
  jvmArgs '-XstartOnFirstThread'
} 

But the tests hang indefinitely. The execution doesn’t even get to the first line of the setup method in the tests (running junit).

Can this be related to how gradle runs tests regarding threads? The hanging doesn’t occur with maven and the surefire plugin (also using the -XstartOnFirstThread flag).

Continuing the discussion from Gradle, Test task and '-XstartOnFirstThread':

Do you have a small, reproducible example for us to try?

I found out that UISpec4J may not support SWT, but I’m uploading a minimal example (uispec4j_swt_test.zip (5.6 KB)) in case this is interesting for you to investigate.

The tests doesn’t pass because of above, but in the case with maven, the application is started and the printouts from the tests are there.

To run the tests with maven:

  mvn install

With gradle:

gradle test --info

If you’d like to run the hello world app, build with

mvn install -DskipTests
java -XstartOnFirstThread -jar <path-to-jar-with-dependencies>

Great, thanks.

I raised GRADLE-3290