src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/ClassfileBytecodeProviderTest.java
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/ClassfileBytecodeProviderTest.java Tue Apr 23 14:09:54 2019 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/classfile/ClassfileBytecodeProviderTest.java Tue Apr 23 22:55:09 2019 +0200
@@ -140,6 +140,11 @@
return false;
}
+ /**
+ * Keep test time down by only sampling a limited number of class files per jar.
+ */
+ private static final int CLASSES_PER_JAR = 250;
+
@Test
public void test() {
RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
@@ -156,28 +161,33 @@
if (shouldProcess(path)) {
try {
final ZipFile zipFile = new ZipFile(new File(path));
+ int index = 0;
+ int step = zipFile.size() > CLASSES_PER_JAR ? zipFile.size() / CLASSES_PER_JAR : 1;
for (final Enumeration<? extends ZipEntry> entry = zipFile.entries(); entry.hasMoreElements();) {
final ZipEntry zipEntry = entry.nextElement();
- String name = zipEntry.getName();
- if (name.endsWith(".class") && !name.equals("module-info.class") && !name.startsWith("META-INF/versions/")) {
- String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
- if (isInNativeImage(className)) {
- /*
- * Native image requires non-graalsdk classes to be present in the
- * classpath.
- */
- continue;
- }
- if (isGSON(className)) {
- /* uses old class format */
- continue;
- }
- try {
- checkClass(metaAccess, getSnippetReflection(), className);
- } catch (ClassNotFoundException e) {
- throw new AssertionError(e);
+ if ((index % step) == 0) {
+ String name = zipEntry.getName();
+ if (name.endsWith(".class") && !name.equals("module-info.class") && !name.startsWith("META-INF/versions/")) {
+ String className = name.substring(0, name.length() - ".class".length()).replace('/', '.');
+ if (isInNativeImage(className)) {
+ /*
+ * Native image requires non-graalsdk classes to be present in
+ * the classpath.
+ */
+ continue;
+ }
+ if (isGSON(className)) {
+ /* uses old class format */
+ continue;
+ }
+ try {
+ checkClass(metaAccess, getSnippetReflection(), className);
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError(e);
+ }
}
}
+ index++;
}
} catch (IOException ex) {
Assert.fail(ex.toString());