8310631: test/jdk/sun/nio/cs/TestCharsetMapping.java is spuriously passing

Reviewed-by: mdoerr
Backport-of: e3201d1d13433857a1b34ff0ca93f9ae1a4e22aa
This commit is contained in:
Goetz Lindenmaier 2024-01-17 21:26:19 +00:00
parent ddd5f21949
commit 347ee0f91c
2 changed files with 5037 additions and 6 deletions

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
*/ */
/* @test /* @test
* @bug 8186801 8186751 * @bug 8186801 8186751 8310631
* @summary Test the charset mappings * @summary Test the charset mappings
* @modules jdk.charsets * @modules jdk.charsets
*/ */
@ -569,11 +569,9 @@ public class TestCharsetMapping {
public static void main(String args[]) throws Exception { public static void main(String args[]) throws Exception {
Path dir = Paths.get(System.getProperty("test.src", ".") + Path dir = Paths.get(System.getProperty("test.src", ".") +
"/../../../../make/data/charsetmapping"); "/../../../../../make/data/charsetmapping").normalize();
if (!Files.exists(dir)) { if (!Files.exists(dir)) {
// not inside jdk repo, no mappings, exit silently throw new Exception("charsetmapping files cannot be located in " + dir);
log.println("Nothing done, not in a jdk repo: ");
return;
} }
if (args.length > 0 && "-v".equals(args[0])) { if (args.length > 0 && "-v".equals(args[0])) {
// For debugging: java CoderTest [-v] // For debugging: java CoderTest [-v]
@ -608,7 +606,8 @@ public class TestCharsetMapping {
+ " vs " + cs.name() + "]"); + " vs " + cs.name() + "]");
} }
// test aliases() // test aliases()
if (!cs.aliases().equals(csinfo.aliases)) { if (!cs.aliases().equals(csinfo.aliases)
&& !csname.equals("GB18030")) { // no alias in "charsets" file
errors++; errors++;
log.printf(" [error wrong aliases]"); log.printf(" [error wrong aliases]");
if (verbose) { if (verbose) {
@ -625,6 +624,19 @@ public class TestCharsetMapping {
} }
if (!csinfo.loadMappings(dir)) { if (!csinfo.loadMappings(dir)) {
// Ignore these cs, as mapping files are not provided
if (csinfo.csName.equals("x-IBM942C") ||
csinfo.csName.equals("x-IBM943C") ||
csinfo.csName.equals("x-IBM834") ||
csinfo.csName.equals("x-IBM949C") ||
csinfo.csName.equals("x-IBM964") ||
csinfo.csName.equals("x-IBM29626C"))
{
log.println(" [**** skipped, mapping file is not provided]");
known++;
continue;
}
log.println(" [error loading mappings failed]"); log.println(" [error loading mappings failed]");
errors++; errors++;
continue; continue;