Dmitry, here is how I see this situation: When we ran
sun/tools/jps/TestJpsJar.java alone in the clean folder, it builds
testlibrary classes implicitly and put it under the same folder with
test class, i.e. to JTwork/classes/sun/tools/jps folder and test works fine.
But sun/tools/jinfo/BasicJInfoTest.java builds testlibrary classes by
"@build jdk.testlibrary.*" command and these classes are places in
JTwork/classes/lib/testlibrary folder. After that
sun/tools/jps/TestJpsJar.java skip building testlibrary classes, because
these classes are already built and classpath contains path to these
classes. Due to JDK-8165944 JpsHelper unable to add classes from second
folder within classpath and test failed. And with your patch JpsHelper
will add classes only from folder with test class.
On 15.09.2016 19:14, Dmitry Samersoff wrote:
I'd reproduced it. I'll check what is happening.
On 2016-09-15 15:34, Dmitry Dmitriev wrote:
I don't think that this solves the problem. If some test build
testlibrary before TestJpsJar.java, then testlibrary classes will be
outside the folder with JpsHelper class and thus missed in the jar file.
I can reproduce this problem with your patch applied:
1) Run sun/tools/jinfo/BasicJInfoTest.java in clean folder
2) Then run sun/tools/jps/TestJpsJar.java. TestJpsJar.java fails with
stderr: [Exception in thread "main" java.lang.NoClassDefFoundError:
Caused by: java.lang.ClassNotFoundException: jdk.testlibrary.ProcessTools
... 1 more
exitValue = 1
java.lang.RuntimeException: Expected to get exit value of 
On 15.09.2016 15:18, Dmitry Samersoff wrote:
Please, review the small fix.
TestJpsJar attempts to copy all directories found in test.class.path
into a single jar file.
It's not necessary and could lead to intermittent ClassNotFound
Jar only a directory with required files.