On Wed, 20 Sep 2023 20:36:20 GMT, Chris Plummer <cjplum...@openjdk.org> wrote:

> It seems like the "IPv6-only system" part of the test should include more 
> test cases, both passing and failing. I'm not sure why it was lmitted to just 
> the one:

I have added additional test cases

> Does this test guarantee that "system" was honored, or only verify that there 
> was no failure to attach? In other words, wouldn't this pass even if the 
> debug agent ignored the use of "system"?

That is true, with `preferIPv4Stack(true)` I don't think there's a decision to 
make about ordering. Would you like this test case to be removed?

> What happens if using "system" with `preferIPv4Stack(false)`? I'm not sure 
> why you don't have a test case for this.

I have added additional test cases.

> I guess maybe the reason is we don't know if the test case would pass or not 
> because we don't know if "system" will result in using v4 (pass) or v6 
> (fail). Is there a way to determine that in advanced?

Right, it depends on what `getaddrinfo` is doing on the current system. One way 
to determine that in advance is to run the test with 
`-Djava.net.preferIPv6Address=system` and check which address 
`InetAddress.getAllByName("localhost")` returns first, and then assert that is 
consistent with what JDWP is doing. I'm didn't see a more direct way to check 
what `getaddrinfo` is going to do, or avoid relying on its behavior on the 
current system.

> test/jdk/com/sun/jdi/JdwpNetProps.java line 82:
> 
>> 80:                 // - listen on IPv4
>> 81:                 new ListenTest("localhost", ipv6Address)
>> 82:                         .preferIPv6Addresses("false")
> 
> It seems we should also have a test case that omits using 
> `preferIPv6Addresses()`. I think like this test case, it should fail because 
> the debug agent will default to v4.

Done

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

PR Comment: https://git.openjdk.org/jdk/pull/15796#issuecomment-1728600933
PR Review Comment: https://git.openjdk.org/jdk/pull/15796#discussion_r1332312895
PR Review Comment: https://git.openjdk.org/jdk/pull/15796#discussion_r1332312949

Reply via email to