8212627: [TESTBUG] runtime/CreateMirror/ArraysNewInstanceBug.java timed out

Reviewed-by: coleenp, dcubed, hseigel
This commit is contained in:
Christian Tornqvist 2019-04-01 14:34:24 -07:00
parent 757e6ecfec
commit 9910128b44

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2019, 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
@ -31,6 +31,7 @@
// This test crashes in compiled code with race, because the compiler generates code that assumes this ordering.
import java.lang.reflect.Array;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
@ -55,13 +56,13 @@ public class ArraysNewInstanceBug implements Runnable {
public static void main(String[] args) throws Throwable {
Class<?> c = ArraysNewInstanceBug.class;
ClassLoader apploader = c.getClassLoader();
ClassLoader apploader = c.getClassLoader();
File testClasses = new File(System.getProperty("test.classes"));
for (int iter = 0; iter < 10 ; iter++) { // 10 is enough to get it to crash on my machine.
System.err.print('[');
classes = new Class<?>[1000];
String urlpath = "file://" + System.getProperty("test.classes") + "/";
for (int i = 0; i < classes.length; i++) {
ClassLoader loader = new URLClassLoader(new URL[] { new URL(urlpath) }, apploader.getParent());
ClassLoader loader = new URLClassLoader(new URL[] { testClasses.toURI().toURL() }, apploader.getParent());
classes[i] = loader.loadClass(c.getSimpleName());
}
System.err.print(']');