Junit5: Bug report: Exception thrown when building :junit-jupiter-engine on Windows 7

Created on 11 Mar 2017  路  8Comments  路  Source: junit-team/junit5

Overview

Expected behaviour

Running ./gradlew {clean} :junit-jupiter-engine:build from JUnit 5 master branch should succeed.

Actual behaviour

When running ./gradlew clean :junit-jupiter-engine:build on my (at time of writing) up-to-date fork of JUnit 5, at the master branch, on my Windows 7 laptop, it throws the following stack trace. For some reason, AppVeyor is not catching this.

:junit-jupiter-engine:junitPlatformTest
17:12:49.138 [main] WARN  org.junit.platform.commons.util.ClasspathScanner - Error scanning files for URI file:///C:/Users/Jonathan/dev/Java/IntelliJ%20Projects/junit5/junit-jupiter-engine/build/resources/test/jupiter-testjar.jar
java.nio.file.FileSystemNotFoundException: C:\Users\Jonathan\dev\Java\IntelliJ%20Projects\junit5\junit-jupiter-engine\build\resources\test\jupiter-testjar.jar
        at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:120) ~[zipfs.jar:1.8.0_121]
        at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:117) ~[zipfs.jar:1.8.0_121]
        at java.nio.file.FileSystems.newFileSystem(FileSystems.java:326) ~[?:1.8.0_121]
        at java.nio.file.FileSystems.newFileSystem(FileSystems.java:276) ~[?:1.8.0_121]
        at org.junit.platform.commons.util.CloseablePath.createForJarFileSystem(CloseablePath.java:54) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.commons.util.CloseablePath.create(CloseablePath.java:46) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.commons.util.ClasspathScanner.findClassesForUri(ClasspathScanner.java:123) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.commons.util.ClasspathScanner.scanForClassesInClasspathRoot(ClasspathScanner.java:103) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.commons.util.ReflectionUtils.findAllClassesInClasspathRoot(ReflectionUtils.java:508) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.lambda$resolveSelectors$0(DiscoverySelectorResolver.java:51) ~[main/:?]
        at java.util.ArrayList.forEach(ArrayList.java:1249) ~[?:1.8.0_121]
        at org.junit.jupiter.engine.discovery.DiscoverySelectorResolver.resolveSelectors(DiscoverySelectorResolver.java:50) ~[main/:?]
        at org.junit.jupiter.engine.discovery.DiscoverySelectorResolverTests.classpathResolutionForJarFiles(DiscoverySelectorResolverTests.java:419) ~[test/:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:312) ~[junit-platform-commons-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:114) ~[main/:?]
        at org.junit.jupiter.engine.descriptor.MethodTestDescriptor.lambda$invokeTestMethod$6(MethodTestDescriptor.java:177) ~[main/:?]
        at org.junit.jupiter.engine.execution.ThrowableCollector.execute(ThrowableCollector.java:40) ~[main/:?]
        at org.junit.jupiter.engine.descriptor.MethodTestDescriptor.invokeTestMethod(MethodTestDescriptor.java:173) ~[main/:?]
        at org.junit.jupiter.engine.descriptor.MethodTestDescriptor.execute(MethodTestDescriptor.java:120) ~[main/:?]
        at org.junit.jupiter.engine.descriptor.MethodTestDescriptor.execute(MethodTestDescriptor.java:57) ~[main/:?]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$1(HierarchicalTestExecutor.java:81) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:76) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$1(HierarchicalTestExecutor.java:91) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:76) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.lambda$execute$1(HierarchicalTestExecutor.java:91) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.SingleTestExecutor.executeSafely(SingleTestExecutor.java:66) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:76) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:51) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:43) ~[junit-platform-engine-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:133) ~[junit-platform-launcher-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:85) ~[junit-platform-launcher-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.tasks.ConsoleTestExecutor.executeTests(ConsoleTestExecutor.java:65) ~[junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.tasks.ConsoleTestExecutor.lambda$execute$0(ConsoleTestExecutor.java:57) ~[junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.tasks.CustomContextClassLoaderExecutor.invoke(CustomContextClassLoaderExecutor.java:33) [junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.tasks.ConsoleTestExecutor.execute(ConsoleTestExecutor.java:57) [junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.ConsoleLauncher.executeTests(ConsoleLauncher.java:79) [junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.ConsoleLauncher.execute(ConsoleLauncher.java:69) [junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
        at org.junit.platform.console.ConsoleLauncher.main(ConsoleLauncher.java:41) [junit-platform-console-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]

Failures (1):
  JUnit Jupiter:DiscoverySelectorResolverTests:classpathResolutionForJarFiles()
    MethodSource [className = 'org.junit.jupiter.engine.discovery.DiscoverySelectorResolverTests', methodName = 'classpathResolutionForJarFiles', methodParameterTypes = '']
    => java.lang.AssertionError:
Expecting:
 <[]>
to contain:
 <[[engine:junit-jupiter]/[class:com.example.project.FirstTest]]>
but could not find:
 <[[engine:junit-jupiter]/[class:com.example.project.FirstTest]]>


Test run finished after 3482 ms
[        64 containers found      ]
[         0 containers skipped    ]
[        64 containers started    ]
[         0 containers aborted    ]
[        64 containers successful ]
[         0 containers failed     ]
[       561 tests found           ]
[         0 tests skipped         ]
[       561 tests started         ]
[         0 tests aborted         ]
[       560 tests successful      ]
[         1 tests failed          ]

:junit-jupiter-engine:junitPlatformTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':junit-jupiter-engine:junitPlatformTest'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Running ./gradlew --version outputs the following:

$ ./gradlew --version

------------------------------------------------------------
Gradle 3.4.1
------------------------------------------------------------

Build time:   2017-03-03 19:45:41 UTC
Revision:     9eb76efdd3d034dc506c719dac2955efb5ff9a93

Groovy:       2.4.7
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          1.8.0_121 (Oracle Corporation 25.121-b13)
OS:           Windows 7 6.1 amd64

Deliverables

  • [ ] Investigate this stack trace, find its cause and fix it if applicable.
Platform bug

All 8 comments

@jbduncan can you verify whether the jupiter-testjar.jar file actually exists?

On a first quick look it seems somewhere we have a problem handling spaces in paths.

Hi @gaganis. Yes, I can verify that that jar exists, but only if I replace the %20 in the path with a normal space before entering it into Windows Explorer. Otherwise, Windows throws a bit of a hissy fit.

image

Screenshot of it working successfully once I enter the parent path of the jar, %20 replaced with space, into Windows Explorer:

image

I have managed to replicate it also on my system running linux. Just moving the project under a path that contains a space makes it break.

Good catch @jbduncan!

Fix is under construction...

Thanks @jbduncan and @gaganis for the detailed report!

YW @sormuras! :)

NP @sormuras This was was fixed blazingly fast!

Was this page helpful?
0 / 5 - 0 ratings