RFR(S): JDK-8165500: TestJpsJar shouldn't jar all test.classpath directories
Dmitry Dmitriev
dmitry.dmitriev at oracle.com
Fri Sep 16 10:45:05 UTC 2016
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 at 9-internal/BuiltinClassLoader.java:366)
>>
>> at
>> jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(java.base at 9-internal/ClassLoaders.java:185)
>>
>> at
>> java.lang.ClassLoader.loadClass(java.base at 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
>>>
>>>
>
More information about the serviceability-dev
mailing list