8153370: Drop use of old style -XaddExports from tests

Reviewed-by: mchung
This commit is contained in:
Alan Bateman 2016-04-05 21:18:01 +01:00
parent 657cfea401
commit 4af24b6def
22 changed files with 83 additions and 47 deletions

View File

@ -113,7 +113,8 @@ fi
case "$OS" in
Windows* | CYGWIN* )
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
*.java
status=$?
if [ ! $status -eq "0" ]; then
@ -123,7 +124,8 @@ case "$OS" in
SunOS | Linux )
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
*.java
status=$?
if [ ! $status -eq "0" ]; then
@ -133,7 +135,8 @@ case "$OS" in
Darwin)
${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
*.java
status=$?
if [ ! $status -eq "0" ]; then
@ -151,14 +154,16 @@ chmod 777 ./*
case "$OS" in
Windows* | CYGWIN* )
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
TestWrapped sun.awt.windows.WToolkit
status=$?
if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.windows.WToolkit";
fi
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.windows=ALL-UNNAMED ${CP} \
-Dawt.toolkit=sun.awt.windows.WToolkit \
TestWrapped sun.awt.windows.WToolkit
status=$?
@ -169,7 +174,8 @@ case "$OS" in
SunOS | Linux )
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
-Dawt.toolkit=sun.awt.X11.XToolkit \
TestWrapped sun.awt.X11.XToolkit
status=$?
@ -177,7 +183,8 @@ case "$OS" in
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.awt.xawt.XToolkit";
fi
AWT_TOOLKIT=XToolkit ${TESTJAVA}/bin/java ${TESTVMOPTS} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.awt.X11=ALL-UNNAMED ${CP} \
-Djava.awt.headless=true \
TestWrapped sun.awt.X11.XToolkit
status=$?
@ -188,14 +195,16 @@ case "$OS" in
Darwin)
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
TestWrapped sun.lwawt.macosx.LWCToolkit
status=$?
if [ ! $status -eq "0" ]; then
fail "Test FAILED: toolkit wrapped into HeadlessToolkit is not an instance of sun.lwawt.macosx.LWCToolkit";
fi
${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.awt.headless=true \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED,java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
-XaddExports:java.desktop/sun.awt=ALL-UNNAMED \
-XaddExports:java.desktop/sun.lwawt.macosx=ALL-UNNAMED ${CP} \
-Dawt.toolkit=sun.lwawt.macosx.LWCToolkit \
TestWrapped sun.lwawt.macosx.LWCToolkit
status=$?

View File

@ -61,8 +61,8 @@ import jdk.internal.module.Modules;
* loads all the classes in the BCL, get their declared fields,
* and call setAccessible(false) followed by setAccessible(true);
* @modules java.base/jdk.internal.module
* @run main/othervm FieldSetAccessibleTest UNSECURE
* @run main/othervm FieldSetAccessibleTest SECURE
* @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM FieldSetAccessibleTest UNSECURE
* @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM FieldSetAccessibleTest SECURE
*
* @author danielfuchs
*/

View File

@ -44,7 +44,7 @@ case "$OS" in
;;
esac
EXTRAOPTS="-XaddExports:java.base/sun.net.www=ALL-UNNAMED,java.base/sun.net.www.protocol.http=ALL-UNNAMED"
EXTRAOPTS="-XaddExports:java.base/sun.net.www=ALL-UNNAMED -XaddExports:java.base/sun.net.www.protocol.http=ALL-UNNAMED"
export EXTRAOPTS
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . \

View File

@ -51,6 +51,10 @@ rm classes/ExtLoadedImpl.class classes/ExtLoadedImpl_Stub.class classes/CheckLoa
mkdir -p ext
$COMPILEJAVA/bin/jar ${TESTTOOLVMOPTS} cf ext/ext.jar -C $TESTCLASSES ExtLoadedImpl.class -C $TESTCLASSES ExtLoadedImpl_Stub.class -C $TESTCLASSES CheckLoader.class
TESTVMOPTS="${TESTVMOPTS} -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED,java.rmi/sun.rmi.server=ALL-UNNAMED,java.rmi/sun.rmi.transport=ALL-UNNAMED,java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
TESTVMOPTS="${TESTVMOPTS} \
-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
$TESTJAVA/bin/java ${TESTVMOPTS} -cp classes -Dtest.src=$TESTSRC -Dtest.classes=$TESTCLASSES -Djava.security.policy=$TESTSRC/security.policy -Djava.ext.dirs=ext ExtLoadedImplTest

View File

@ -138,9 +138,11 @@ public class DownloadActivationGroup
p.put("java.security.policy", TestParams.defaultGroupPolicy);
CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(
null,
new String[] { "-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.server=ALL-UNNAMED,java.rmi/sun.rmi.transport=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
new String[] {
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
ActivationGroupDesc groupDesc =
new ActivationGroupDesc("MyActivationGroupImpl",

View File

@ -120,9 +120,12 @@ public class StubClassesPermitted
//
System.err.println("Create activation group, in a new VM");
CommandEnvironment cmd = new ActivationGroupDesc.CommandEnvironment(null,
new String[] { "-XaddExports:java.base/sun.security.provider=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.registry=ALL-UNNAMED,java.rmi/sun.rmi.server=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.transport=ALL-UNNAMED,java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
new String[] {
"-XaddExports:java.base/sun.security.provider=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED",
"-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" });
ActivationGroupDesc groupDesc =
new ActivationGroupDesc(p, cmd);

View File

@ -98,7 +98,11 @@ case "$OS" in
;;
esac
# trailing / after code base is important for rmi codebase property.
TESTVMOPTS="${TESTVMOPTS} -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED,java.rmi/sun.rmi.server=ALL-UNNAMED,java.rmi/sun.rmi.transport=ALL-UNNAMED,java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
TESTVMOPTS="${TESTVMOPTS} \
-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED \
-XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -cp $TEST_CLASSPATH ${ARGS} -Djava.rmi.server.codebase=${FILEURL}$CODEBASE/ readTest > OUT.TXT 2>&1 &
TEST_PID=$!
#bulk of testcase - let it run for a while

View File

@ -123,9 +123,10 @@ public class CheckFQDN extends UnicastRemoteObject
propOption + property +
equal +
propertyValue + extraProp +
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.server=ALL-UNNAMED,java.rmi/sun.rmi.transport=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
" -Drmi.registry.port=" +
REGISTRY_PORT,
"");

View File

@ -74,10 +74,10 @@ public class DGCDeadLock implements Runnable {
try {
String options = " -Djava.security.policy=" +
TestParams.defaultPolicy +
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED," +
"java.rmi/sun.rmi.server=ALL-UNNAMED," +
"java.rmi/sun.rmi.transport=ALL-UNNAMED," +
"java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED" +
" -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED" +
" -Djava.rmi.dgc.leaseValue=500000" +
" -Dsun.rmi.dgc.checkInterval=" +
(HOLD_TARGET_TIME - 5000) +

View File

@ -122,7 +122,8 @@ tznp
tznp8013086
EOF
EXTRAOPTS="-XaddExports:java.base/sun.util.locale=ALL-UNNAMED,java.base/sun.util.locale.provider=ALL-UNNAMED"
EXTRAOPTS="-XaddExports:java.base/sun.util.locale=ALL-UNNAMED \
-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED"
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${SPIDIR}${FS}dest \
${SPIDIR}${FS}src${FS}tznp.java \

View File

@ -93,7 +93,8 @@ case "$1" in
esac
EXTRA_OPTS="-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED,java.base/sun.util.resources=ALL-UNNAMED"
EXTRA_OPTS="-XaddExports:java.base/sun.util.locale.provider=ALL-UNNAMED \
-XaddExports:java.base/sun.util.resources=ALL-UNNAMED"
# compile
cp ${TESTSRC}${FS}ProviderTest.java .

View File

@ -26,7 +26,7 @@
* @summary Verify the defining class loader of each module never delegates
* to its child class loader. Also sanity check java.compact2
* requires.
* @run testng VerifyModuleDelegation
* @run testng/othervm -Djdk.launcher.addmods=ALL-SYSTEM VerifyModuleDelegation
*/
import java.lang.module.ModuleDescriptor;

View File

@ -51,7 +51,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED,java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED \
-XaddExports:java.management/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

View File

@ -49,7 +49,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED,java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED \
-XaddExports:java.management/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

View File

@ -48,7 +48,8 @@ chmod -R 777 ${TESTCLASSES}/ssl
DEBUGOPTIONS=""
export DEBUGOPTIONS
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED,java.management/sun.management.jmxremote=ALL-UNNAMED"
EXTRAOPTIONS="-XaddExports:java.management/sun.management=ALL-UNNAMED \
-XaddExports:java.management/sun.management.jmxremote=ALL-UNNAMED"
export EXTRAOPTIONS
# Call the common generic test

View File

@ -68,9 +68,10 @@ public class NoConsoleOutput {
// (neither on standard output, nor on standard err streams).
JavaVM vm = new JavaVM(
DoRMIStuff.class.getName(),
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.server=ALL-UNNAMED,java.rmi/sun.rmi.transport=ALL-UNNAMED,"
+ "java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
"-XaddExports:java.rmi/sun.rmi.registry=ALL-UNNAMED"
+ " -XaddExports:java.rmi/sun.rmi.server=ALL-UNNAMED"
+ " -XaddExports:java.rmi/sun.rmi.transport=ALL-UNNAMED"
+ " -XaddExports:java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED"
+ " -Djava.util.logging.config.file="
+ loggingPropertiesFile, "", out, err);
vm.execute();

View File

@ -61,7 +61,8 @@ rm $KEYTAB
EXTRA_OPTIONS="-Djava.security.krb5.conf=${TESTSRC}${FS}onlythree.conf"
KTAB="${TESTJAVA}${FS}bin${FS}ktab -J${EXTRA_OPTIONS} -k $KEYTAB -f"
CHECK="${TESTJAVA}${FS}bin${FS}java -cp ${TESTCLASSES} ${TESTVMOPTS} ${EXTRA_OPTIONS} \
-XaddExports:java.security.jgss/sun.security.krb5.internal.ktab=ALL-UNNAMED,java.security.jgss/sun.security.krb5=ALL-UNNAMED \
-XaddExports:java.security.jgss/sun.security.krb5.internal.ktab=ALL-UNNAMED \
-XaddExports:java.security.jgss/sun.security.krb5=ALL-UNNAMED \
KtabCheck $KEYTAB"
echo ${EXTRA_OPTIONS}

View File

@ -95,7 +95,11 @@ $KT -alias tsbad3 -certreq | \
$KT -alias ca -gencert -ext eku:critical=cs | \
$KT -alias tsbad3 -importcert
EXTRAOPTS="-XaddExports:java.base/sun.misc=ALL-UNNAMED,java.base/sun.security.pkcs=ALL-UNNAMED,java.base/sun.security.timestamp=ALL-UNNAMED,java.base/sun.security.x509=ALL-UNNAMED,java.base/sun.security.util=ALL-UNNAMED"
EXTRAOPTS="-XaddExports:java.base/sun.misc=ALL-UNNAMED \
-XaddExports:java.base/sun.security.pkcs=ALL-UNNAMED \
-XaddExports:java.base/sun.security.timestamp=ALL-UNNAMED \
-XaddExports:java.base/sun.security.x509=ALL-UNNAMED \
-XaddExports:java.base/sun.security.util=ALL-UNNAMED"
$JAVAC ${EXTRAOPTS} -d . ${TESTSRC}/TimestampCheck.java
$JAVA ${TESTVMOPTS} ${EXTRAOPTS} "-Dtest.tool.vm.opts=${TESTTOOLVMOPTS}" TimestampCheck

View File

@ -100,7 +100,9 @@ fi
echo "Using NSS lib at $LIBNAME"
EXTRAOPTS="-XaddExports:java.base/sun.security.tools.keytool=ALL-UNNAMED,java.base/sun.security.util=ALL-UNNAMED,java.base/sun.security.x509=ALL-UNNAMED"
EXTRAOPTS="-XaddExports:java.base/sun.security.tools.keytool=ALL-UNNAMED \
-XaddExports:java.base/sun.security.util=ALL-UNNAMED \
-XaddExports:java.base/sun.security.x509=ALL-UNNAMED"
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . -XDignore.symbol.file \
${TESTSRC}${FS}KeyToolTest.java || exit 10

View File

@ -57,7 +57,9 @@ case "$OS" in
;;
esac
EXTRAOPTS="-XaddExports:java.base/sun.security.tools.keytool=ALL-UNNAMED,java.base/sun.security.util=ALL-UNNAMED,java.base/sun.security.x509=ALL-UNNAMED"
EXTRAOPTS="-XaddExports:java.base/sun.security.tools.keytool=ALL-UNNAMED \
-XaddExports:java.base/sun.security.util=ALL-UNNAMED \
-XaddExports:java.base/sun.security.x509=ALL-UNNAMED"
${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRAOPTS} -d . -XDignore.symbol.file ${TESTSRC}${FS}KeyToolTest.java || exit 10

View File

@ -49,6 +49,7 @@ import jdk.internal.jimage.ImageLocation;
* @test
* @summary Verify jimage
* @modules java.base/jdk.internal.jimage
* @run main/othervm -Djdk.launcher.addmods=ALL-SYSTEM VerifyJimage
*/
/**

View File

@ -128,18 +128,15 @@ public class PatchTest {
// value for -Xpatch
String patchPath = PATCHES1_DIR + File.pathSeparator + PATCHES2_DIR;
// value for -XaddExports
String addExportsValue = "java.base/java.lang2=test"
+ ",jdk.naming.dns/com.sun.jndi.dns=test"
+ ",jdk.naming.dns/com.sun.jndi.dns2=test"
+ ",jdk.compiler/com.sun.tools.javac2=test";
// the argument to the test is the list of classes overridden or added
String arg = Stream.of(CLASSES).collect(Collectors.joining(","));
int exitValue
= executeTestJava("-Xpatch:" + patchPath,
"-XaddExports:" + addExportsValue,
"-XaddExports:java.base/java.lang2=test",
"-XaddExports:jdk.naming.dns/com.sun.jndi.dns=test",
"-XaddExports:jdk.naming.dns/com.sun.jndi.dns2=test",
"-XaddExports:jdk.compiler/com.sun.tools.javac2=test",
"-addmods", "jdk.naming.dns,jdk.compiler",
"-mp", MODS_DIR.toString(),
"-m", "test/jdk.test.Main", arg)