8249142: java/awt/FontClass/CreateFont/DeleteFont.sh is unstable

Reviewed-by: serb
This commit is contained in:
Phil Race 2020-09-19 17:36:12 +00:00
parent 1438ce097f
commit d27835b34e
2 changed files with 17 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020, 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
@ -21,8 +21,11 @@
* questions.
*/
import java.io.*;
import java.awt.*;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.awt.Font;
public class DeleteFont {
@ -55,19 +58,22 @@ public class DeleteFont {
if (!gotException) {
throw new RuntimeException("No expected IOException");
}
badRead(-2, Font.TRUETYPE_FONT);
badRead(8193, Font.TRUETYPE_FONT);
badRead(-2, Font.TYPE1_FONT);
badRead(8193, Font.TYPE1_FONT);
badRead(-2, 16, Font.TYPE1_FONT);
badRead(8193, 14, Font.TYPE1_FONT);
badRead(-2, 12, Font.TRUETYPE_FONT);
badRead(8193, 10, Font.TRUETYPE_FONT);
// Make sure GC has a chance to clean up before we exit.
System.gc(); System.gc();
Thread.sleep(5000);
System.gc(); System.gc();
}
static void badRead(final int retval, int fontType) {
static void badRead(final int retval, final int multiple, int fontType) {
int num = 2;
byte[] buff = new byte[16*8192]; // Multiple of 8192 is important.
byte[] buff = new byte[multiple*8192]; // Multiple of 8192 is important.
for (int ct=0; ct<num; ++ct) {
try {
Font.createFont(

View File

@ -20,7 +20,8 @@
# questions.
# @test
# @bug 6189812 6380357 6632886
# @bug 6189812 6380357 6632886 8249142
# @key intermittent
# @summary Verify that temporary font files are deleted on exit.
if [ -z "${TESTSRC}" ]; then