On Mon, 21 Aug 2023 07:35:19 GMT, Jaikiran Pai <[email protected]> wrote:

>> Some jtreg tests fail with ipv6 disabled on the machine, this should be 
>> improved in the tests (e.g. by using IPSupport.hasIPv6() ).
>
> test/jdk/java/net/InetAddress/HostsFileOrderingTest.java line 91:
> 
>> 89:     @Test
>> 90:     public void testOrdering() throws Exception {
>> 91:         if (IPSupport.hasIPv6()) {
> 
> Hello Matthias, unlike changes to some other tests, this skips the entire 
> test method if there's no IPv6 support. So perhaps add a System.out message 
> that this test is skipped? I checked if `testng` has `assumeTrue` kind of API 
> like junit, but I couldn't find any, so just returning by printing a 
> System.out message might be enough.

Some of the test runs should work whether the machine has IPv6 or not. Maybe 
this test should be more selective with respect to when the test should be 
skipped. For instance at line 47-48: 

 * @run testng/othervm -Djdk.net.hosts.file=TestHostsFile.txt
 * -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false 
HostsFileOrderingTest

well - that should work - and only return IPv4 addresses.

On second thought - I suspect it's `getExpectedAddressesArray()` that should be 
fixed to take into account IPSupport.hasIPv6() instead of doing it here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15341#discussion_r1300440236

Reply via email to