test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 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) 2015, 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.
*** 43,87 ****
import jdk.test.lib.process.OutputAnalyzer;
public class DummyClassesInBootClassPath {
private static final String METHOD_NAME = "thisClassIsDummy()";
public static void main(String[] args) throws Exception {
String classNames[] = { "java/net/HttpCookie",
"javax/activation/MimeType"};
JarBuilder.build("dummyClasses", classNames[0], classNames[1]);
String appJar = TestCommon.getTestJar("dummyClasses.jar");
OutputAnalyzer dumpOutput = TestCommon.dump(
! appJar, classNames, "-Xbootclasspath/a:" + appJar);
!
List<String> argsList = new ArrayList<String>();
for (int i = 0; i < classNames.length; i++) {
argsList.add(classNames[i].replace('/', '.'));
}
String[] arguments = new String[argsList.size()];
arguments = argsList.toArray(arguments);
OutputAnalyzer execOutput = TestCommon.execCommon(
! "-cp", TestCommon.getTestDir("."), "-verbose:class",
! "--add-modules", "java.activation",
! "-Xbootclasspath/a:" + appJar, "DummyClassHelper",
! arguments[0], arguments[1]);
! for (int i = 0; i < arguments.length; i++) {
! TestCommon.checkExec(execOutput,
! "java.lang.NoSuchMethodException: " + arguments[i] + "." +
! METHOD_NAME);
! }
JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");
String whiteBoxJar = TestCommon.getTestJar("WhiteBox.jar");
String bootClassPath = "-Xbootclasspath/a:" + appJar +
File.pathSeparator + whiteBoxJar;
argsList.add("testWithWhiteBox");
arguments = new String[argsList.size()];
arguments = argsList.toArray(arguments);
String[] opts = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
! bootClassPath, "-XX:+TraceClassPaths", "DummyClassHelper",
! arguments[0], arguments[1], arguments[2]};
! OutputAnalyzer output = TestCommon.execCommon(opts);
}
}
--- 43,94 ----
import jdk.test.lib.process.OutputAnalyzer;
public class DummyClassesInBootClassPath {
private static final String METHOD_NAME = "thisClassIsDummy()";
+ static void checkOutput(OutputAnalyzer output, String[] classNames) throws Exception {
+ for (int i = 0; i < classNames.length; i++) {
+ String cn = classNames[i].replace('/', '.');
+ TestCommon.checkExec(output,
+ "java.lang.NoSuchMethodException: " + cn + "." +
+ METHOD_NAME);
+ output.shouldNotContain(cn + ".class should be in shared space.");
+ }
+ }
+
public static void main(String[] args) throws Exception {
String classNames[] = { "java/net/HttpCookie",
"javax/activation/MimeType"};
JarBuilder.build("dummyClasses", classNames[0], classNames[1]);
String appJar = TestCommon.getTestJar("dummyClasses.jar");
OutputAnalyzer dumpOutput = TestCommon.dump(
! appJar, classNames, "-Xbootclasspath/a:" + appJar,
! "--add-modules", "java.activation");
List<String> argsList = new ArrayList<String>();
for (int i = 0; i < classNames.length; i++) {
argsList.add(classNames[i].replace('/', '.'));
}
String[] arguments = new String[argsList.size()];
arguments = argsList.toArray(arguments);
OutputAnalyzer execOutput = TestCommon.execCommon(
! "--add-modules", "java.activation", "-Xbootclasspath/a:" + appJar,
! "DummyClassHelper", arguments[0], arguments[1]);
! checkOutput(execOutput, classNames);
JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox");
String whiteBoxJar = TestCommon.getTestJar("WhiteBox.jar");
String bootClassPath = "-Xbootclasspath/a:" + appJar +
File.pathSeparator + whiteBoxJar;
+ dumpOutput = TestCommon.dump(
+ appJar, classNames, bootClassPath, "--add-modules", "java.activation");
argsList.add("testWithWhiteBox");
arguments = new String[argsList.size()];
arguments = argsList.toArray(arguments);
String[] opts = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+WhiteBoxAPI",
! "--add-modules", "java.activation", bootClassPath, "-Xlog:class+path=trace",
! "DummyClassHelper", arguments[0], arguments[1], arguments[2]};
! execOutput = TestCommon.execCommon(opts);
! checkOutput(execOutput, classNames);
}
}
test/hotspot/jtreg/runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File