[jdk8u-dev] RFR: 8297141: Fix hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java for 8u

zzambers duke at openjdk.org
Wed Nov 16 17:45:11 UTC 2022


On Wed, 16 Nov 2022 17:27:29 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Following test (from hotspot/tier1) currently fails on Windows x86:
>> `hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java`
>> 
>> **Test output:**
>> 
>> ...
>>  stdout: [];
>>  stderr: [openjdk version "1.8.0_362-internal"
>> OpenJDK Runtime Environment (build 1.8.0_362-internal-zzambers-54a485c13e59fa68ea9dc088f320520eedbe33fe-b00)
>> OpenJDK Server VM (build 25.362-b00, mixed mode)
>> ]
>>  exitValue = 0
>> 
>> java.lang.RuntimeException: 'UseSharedSpaces:' missing from stdout/stderr 
>> 
>> 	at com.oracle.java.testlibrary.OutputAnalyzer.shouldContain(OutputAnalyzer.java:134)
>> 	at DefaultUseWithClient.main(DefaultUseWithClient.java:68)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> 	at java.lang.reflect.Method.invoke(Method.java:498)
>> 	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
>> 	at java.lang.Thread.run(Thread.java:750)
>> ...
>> 
>> 
>> **Problem:**
>> Test is Windows 32-bit only, only applies to Client VM and checks default behaviour of shared archive feature. Problem is, that default build of 32-bit windows JDK does not include Client VM, so Server VM is used (so -client arg does nothing). With Server VM tests fails. I tried to make build which has Client VM and then this test passes (It breaks other tests which expect default to be Server VM though).
>> 
>> **Fix:**
>> Test runs java with `-version` argument, which can print something similar to:
>> 
>> openjdk version "1.8.0_362-internal"
>> OpenJDK Runtime Environment (build 1.8.0_362-internal-zzambers-2bbffac3199782df1f9b81867fdfeb3d72889fcd-b00)
>> OpenJDK Client VM (build 25.362-b00, mixed mode)
>> 
>> This output can be used to check if Client VM and skip other checks, if Client VM is not used. Fix is JDK 8 only as test has been removed on newer JDKs by JDK-8154204 by [2]. But I decided to fix it for JDK 8.
>> 
>> **Testing:**
>> With this change test passes on Windows 32-bit. (both with Server [3] and Client [4] Vms)
>> 
>> [1] https://github.com/zzambers/jdk8u-dev/actions/runs/3438556844
>> [2] https://bugs.openjdk.org/browse/JDK-8154204
>> [3] https://github.com/zzambers/jdk8u-dev/actions/runs/3462926725
>> [4] https://github.com/zzambers/jdk8u-dev/actions/runs/3462887672
>
> Shouldn't we just amend the condition on lines 41-45 to something like:
> 
> 
> boolean is32BitWindowsClientVm = (Platform.isWindows() && Platform.is32bit() && Platform.isClient());
> if (!is32BitWindowsClientVm) {
>     System.out.println("Test only applicable on 32-bit Windows Client VM. Skipping");
>     return;
> }

@jerboaa Oh, that is indeed cleaner. I have not checked Platform class and I did not know it is capable of that. I'll update my PR. Thanks

-------------

PR: https://git.openjdk.org/jdk8u-dev/pull/181


More information about the jdk8u-dev mailing list