[jdk8u] RFR: 8186801: Add regression test to test mapping based charsets (generated at build time)

Andrew John Hughes andrew at openjdk.org
Fri Jun 23 02:04:10 UTC 2023


On Fri, 23 Jun 2023 01:48:06 GMT, Andrew John Hughes <andrew at openjdk.org> wrote:

>> jdk/test/sun/nio/cs/TestEBCDICLineFeed.java line 56:
>> 
>>> 54:                                   cs,  bb[0] & 0xff);
>>> 55:                 errs++;
>>> 56:             }
>> 
>> Took some thinking, but I think this is okay.
>> 
>> Are we sure the old (pre-8186803) translations are always "U+000A" -> 25? I am not sure, it looked to me like it could be either mapped to E15 or E25.
>
> The changes I've made to detect IBM0114x were necessary to get the test to pass. Prior to that, it was failing because those character sets were producing 0x25.

As to including this test, it seemed appropriate. The intention is for this backport to add tests to ensure the status quo, rather than change any behaviour (as Severin notes). So this version of `TestEBCDICLineFeed.java` is ensuring that the 8186803 bug is present in 8u.

I agree about it being a bit of a brainteaser. It was a pain to extract the 8186803 changes from the rest and I was surprised that even removing the `.nr` file additions still led to a mismatch in `TestCharsetMappings`, fixed by the hack. As you've seen, the IBM114x maps map both 0x15 and 0x25 to U+000a, so going the other way can produce either. In `TestCharsetMappings`, both are produced but 0x15 succeeds without the hack (i.e. `eq` is already true). As far as I can work out. the `.nr` files (no round trip) stop the 0x25 conversion happening, so only 0x15 occurs.

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

PR Review Comment: https://git.openjdk.org/jdk8u/pull/43#discussion_r1239245738


More information about the jdk8u-dev mailing list