RFR: JDK-8242282: Test sun/tools/jps/TestJps.java fails after JDK-8237572
Daniel D. Daugherty
daniel.daugherty at oracle.com
Thu Apr 9 21:22:01 UTC 2020
On 4/9/20 5:15 PM, Alex Menkov wrote:
>
>
> On 04/09/2020 14:01, Daniel D. Daugherty wrote:
>> On 4/9/20 4:42 PM, Alex Menkov wrote:
>>> Hi all,
>>>
>>> Please review the fix for
>>> https://bugs.openjdk.java.net/browse/JDK-8242282
>>> webrev:
>>> http://cr.openjdk.java.net/~amenkov/jdk15/jpsTest_ClsNotFound/webrev/
>>
>> test/jdk/sun/tools/jps/LingeredAppForJps.java
>> L89: manifestClasspath += " " + new File(path
>> ).toURI();
>> nit - please delete extra space before ')'.
>
> Done locally.
>
>>
>> old L91: break;
>> So the old version only added the first existing file found
>> in the
>> path to the jarArgs. The new version is added all existing
>> files.
>> Maybe I misread the bug report, but I didn't think you
>> wanted to
>> do that.
>
> The idea of the code is to add to jar only files from test class
> directory and don't add files from any other classpath dirs.
> With the fix all other classpath dirs are added to manifest "Class-Path".
>
>>
>> Also, can you provide an example of the old manifest file
>> versus the
>> new manifest file after this change?
>
> in my env
> old manifest.mf (generated):
> ===================
> Main-Class: LingeredAppForJps
> ===================
>
> new one:
> ===================
> Main-Class: LingeredAppForJps
> Class-Path:
> file:/D:/ade/jvm/hs_4/build/windows-x64-debug/test-support/jtreg_open_test_jdk_sun_tools_jps/classes/0/test/lib/
> ===================
>
> old manifest from generated .jar:
>
> ===================
> Manifest-Version: 1.0
> Main-Class: LingeredAppForJps
> Created-By: 15-internal (Oracle Corporation)
> ===================
>
> new one:
> ===================
> Manifest-Version: 1.0
> Main-Class: LingeredAppForJps
> Class-Path: file:/D:/ade/jvm/hs_4/build/windows-x64-debug/test-support/
> jtreg_open_test_jdk_sun_tools_jps/classes/0/test/lib/
> Created-By: 15-internal (Oracle Corporation)
> ===================
Looks good. Thumbs up.
Dan
>
> --alex
>
>>
>> test/jdk/sun/tools/jps/TestJps.java
>> No comments.
>>
>>>
>>> The test creates jar with test classes and run it with "java -jar
>>> <jar_file>".
>>> The problem is single "@run Test" tag is executed by JTreg
>>> inconsistently - sometimes library classes are compiled to test
>>> directory, sometimes - to library directory.
>>> The fix explicitly forces required library classes compilation (so
>>> library files are compiled to library dir) and add classpath
>>> directories to jar manifest.
>>
>> This description doesn't mention jar'ing up additional files so you
>> can see
>> my confusion (I hope).
>>
>> Dan
>>
>>
>>>
>>> --alex
>>
More information about the serviceability-dev
mailing list