< prev index next >
test/jdk/sun/nio/cs/FindEncoderBugs.java
Print this page
rev 52936 : 8215202: AArch64: jtreg test test/jdk/sun/nio/cs/FindEncoderBugs.java fails
Reviewed-by: duke
Contributed-by: nick.gasson@arm.com
*** 1,7 ****
/*
! * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 178,188 ****
// private static final long maxCharsetFailures = Long.MAX_VALUE;
private static final long maxCharsetFailures = 10000L;
private final long failed0 = failed;
// legend: r=regular d=direct In=Input Ou=Output
! static final int maxBufSize = 20;
static final CharBuffer[] rInBuffers = new CharBuffer[maxBufSize];
static final CharBuffer[] dInBuffers = new CharBuffer[maxBufSize];
static final ByteBuffer[] rOuBuffers = new ByteBuffer[maxBufSize];
static final ByteBuffer[] dOuBuffers = new ByteBuffer[maxBufSize];
--- 178,188 ----
// private static final long maxCharsetFailures = Long.MAX_VALUE;
private static final long maxCharsetFailures = 10000L;
private final long failed0 = failed;
// legend: r=regular d=direct In=Input Ou=Output
! static final int maxBufSize = 40;
static final CharBuffer[] rInBuffers = new CharBuffer[maxBufSize];
static final CharBuffer[] dInBuffers = new CharBuffer[maxBufSize];
static final ByteBuffer[] rOuBuffers = new ByteBuffer[maxBufSize];
static final ByteBuffer[] dOuBuffers = new ByteBuffer[maxBufSize];
*** 442,451 ****
--- 442,473 ----
ia[len + j] = randomChar();
test(ia);
}
}
+ void testISO88591InvalidChar() {
+ // Several architectures implement the ISO-8859-1 encoder as an
+ // intrinsic where the vectorised assembly has separate cases
+ // for different input sizes, so exhaustively test all sizes
+ // from 0 to maxBufSize to ensure we get coverage
+
+ for (int i = 0; i < CharsetTester.maxBufSize; i++) {
+ char[] ia = new char[i];
+ for (int j = 0; j < i; j++)
+ ia[j] = randomChar();
+
+ test(ia);
+
+ // Test break on unrepresentable character
+ for (int j = 0; j < i; j++) {
+ char[] iaInvalid = ia.clone();
+ iaInvalid[j] = (char)(randomChar() | 0x100);
+ test(iaInvalid);
+ }
+ }
+ }
+
void testPrefix(char[] prefix) {
if (prefix.length > 0)
System.out.printf("Testing prefix %s%n", string(prefix));
test(prefix);
*** 490,499 ****
--- 512,524 ----
if (csn.equals("x-ISCII91")) {
System.out.println("More ISCII testing...");
new CharsetTester(cs).testPrefix(new char[]{'\u094d'}); // Halant
new CharsetTester(cs).testPrefix(new char[]{'\u093c'}); // Nukta
+ } else if (csn.equals("ISO-8859-1")) {
+ System.out.println("More ISO-8859-1 testing...");
+ new CharsetTester(cs).testISO88591InvalidChar();
}
}
private static void realMain(String[] args) {
for (Charset cs : sort(Charset.availableCharsets().values())) {
< prev index next >