Dmitry, After some debugging:
1. We have to explicitly @build JpsBase to put it into jar file. 2. Couple of testlibrary classes are build because of JpsBase.java dependency. Jtreg put it to ./JTwork/classes/sun/tools/jps/jdk/testlibrary/ i.e. we have incomplete jdk.testlibrary package. 3. If jtreg overwrites this directory processing @library tag it works. Otherwise we get classNotFound exception when attempt to run jar file. 4. If we copy multiple directories to the single jar file, we assemble complete jdk.testlibrary package from multiple places and it works. *So I'm working on large fix*, because: a. I don't think that the test should jar everything from entire classpath. b. I don't think that assembling a testlibrary is an appropriate behavior for the test -Dmitry On 2016-09-16 13:45, Dmitry Dmitriev wrote: > 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. > > Thanks, > Dmitry > > On 15.09.2016 19:14, Dmitry Samersoff wrote: >> Dmitry, >> >> I'd reproduced it. I'll check what is happening. >> >> -Dmitry >> >> >> On 2016-09-15 15:34, Dmitry Dmitriev wrote: >>> Hi Dmitry, >>> >>> 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 >>> following error: >>> stderr: [Exception in thread "main" java.lang.NoClassDefFoundError: >>> jdk/testlibrary/ProcessTools >>> at JpsBase.main(JpsBase.java:73) >>> Caused by: java.lang.ClassNotFoundException: >>> jdk.testlibrary.ProcessTools >>> at >>> jdk.internal.loader.BuiltinClassLoader.loadClass(java.base@9-internal/BuiltinClassLoader.java:366) >>> >>> >>> at >>> jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base@9-internal/ClassLoaders.java:185) >>> >>> >>> at >>> java.lang.ClassLoader.loadClass(java.base@9-internal/ClassLoader.java:424) >>> >>> ... 1 more >>> ] >>> exitValue = 1 >>> >>> java.lang.RuntimeException: Expected to get exit value of [0] >>> >>> Thanks, >>> Dmitry >>> >>> On 15.09.2016 15:18, Dmitry Samersoff wrote: >>>> Everybody, >>>> >>>> Please, review the small fix. >>>> >>>> http://cr.openjdk.java.net/~dsamersoff/JDK-8165500/webrev.01/ >>>> >>>> The problem: >>>> >>>> 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 >>>> exceptions. >>>> >>>> Solution: >>>> >>>> Jar only a directory with required files. >>>> >>>> -Dmitry >>>> >>>> >> > -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources.