Skip to content

Commit

Permalink
Merge pull request #196 from Mesbah-Alam/enableModularityTestsOnJDK11
Browse files Browse the repository at this point in the history
Update modularity tests based on Java 11 changes in SDK
  • Loading branch information
Mesbah-Alam authored Nov 27, 2018
2 parents 815d867 + 9a011f7 commit 7c36d5b
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 221 deletions.
10 changes: 4 additions & 6 deletions openjdk.build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ limitations under the License.
<!-- dir must be set on the ant task otherwise the basedir property is not set to a new value in the subant task. -->
<!-- Also make sure stf is built -->

<condition property="isJava11" value="true">
<equals arg1="${JDK_VERSION}" arg2="11"/>
<condition property="isJava8" value="true">
<equals arg1="${JDK_VERSION}" arg2="8"/>
</condition>

<target name="build-dependencies" depends="build-stf, build-modularity">
Expand All @@ -61,10 +61,8 @@ limitations under the License.
<ant antfile="${stf_root}/stf.build/build.xml" dir="${stf_root}/stf.build" inheritAll="false"/>
</target>

<!--Temporarily exclude compilation/running of test.modularity on Java11 due to
https://github.com/AdoptOpenJDK/openjdk-systemtest/issues/150
-->
<target name="build-modularity" unless="isJava11">
<!--Do not build modularity if we are on Java 8, build otherwise-->
<target name="build-modularity" unless="isJava8">
<ant antfile="${source_root}/openjdk.test.modularity/build.xml" dir="${source_root}/openjdk.test.modularity" inheritAll="false"/>
</target>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public void execute(StfCoreExtension test) throws StfException {
.addModuleToAddmods(hiModule)
.setOutput("HiJVM") // This is last of standard options. Now add a bunch of optional ones, but just to test the JlinkDefinition class.
.setCompress(2, "*Exception.class,*Error.class,^/java.base/java/lang/*")
.enableClassForName() // Turn on Class.forName optimisation
.addToExcludeFiles("/bin/keytool")
.addToExcludeResources("**.idl") // Don't ship with idl files
.addToOrderResources("**/module-info.class")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ public void execute(StfCoreExtension test) throws StfException {
DirectoryRef overridingAppModuleExpDir_HelloModule = test.env()
.findTestDirectory("openjdk.test.modularity/bin/common-override/com.hello");

DirectoryRef overridingPlatformModuleExpDir_JavaTransaction = test.env()
.findTestDirectory("openjdk.test.modularity/bin/common-override/java.transaction");
DirectoryRef overridingPlatformModuleExpDir_JavaXml = test.env()
.findTestDirectory("openjdk.test.modularity/bin/common-override/java.xml");

ModuleRef overridingPlatformModuleJar_JavaTransaction = test.doCreateModularJar("create java.transaction.jar",
"openjdk.test.modularity/bin/common-override/java.transaction");
ModuleRef overridingPlatformModuleJar_JavaTransaction = test.doCreateModularJar("create java.xml.jar",
"openjdk.test.modularity/bin/common-override/java.xml");

StfTestArguments testArgs = test.env().getTestProperties("variant");
Variant variant = testArgs.decodeEnum("variant", Variant.class);
Expand All @@ -127,7 +127,7 @@ public void execute(StfCoreExtension test) throws StfException {
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition().addRunImage(runtimeImage)
.addModuleAddReads("com.test=ALL-UNNAMED")
.addPatchModule("java.transaction", overridingPlatformModuleExpDir_JavaTransaction)
.addPatchModule("java.xml", overridingPlatformModuleExpDir_JavaXml)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
Expand All @@ -141,7 +141,7 @@ public void execute(StfCoreExtension test) throws StfException {
"OT12", ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition().addRunImage(runtimeImage)
.addModuleAddReads("com.test=ALL-UNNAMED")
.addPatchModule("java.transaction", overridingPlatformModuleJar_JavaTransaction)
.addPatchModule("java.xml", overridingPlatformModuleJar_JavaTransaction)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ public void execute(StfCoreExtension test) throws StfException {
DirectoryRef overridingAppModuleExpDir_DiscreetModule = test.env().findTestDirectory(
"openjdk.test.modularity/bin/common-override/com.discreet");

DirectoryRef overridingPlatformModuleExpDir_JavaTransaction = test.env().findTestDirectory(
"openjdk.test.modularity/bin/common-override/java.transaction");
DirectoryRef overridingPlatformModuleExpDir_JavaXml = test.env().findTestDirectory(
"openjdk.test.modularity/bin/common-override/java.xml");

ModuleRef overridingPlatformModuleJar_JavaTransaction = test.doCreateModularJar("create java.transaction.jar",
"openjdk.test.modularity/bin/common-override/java.transaction");
ModuleRef overridingPlatformModuleJar_JavaXml = test.doCreateModularJar("create java.xml.jar",
"openjdk.test.modularity/bin/common-override/java.xml");

StfTestArguments testArgs = test.env().getTestProperties("variant");
Variant variant = testArgs.decodeEnum("variant", Variant.class);
Expand All @@ -120,7 +120,7 @@ public void execute(StfCoreExtension test) throws StfException {
.addModuleToModulepath("openjdk.test.modularity/bin/common-mods")
.addModuleToModulepath("openjdk.test.modularity/bin/tests")
.addRootModule("com.test")
.addPatchModule("java.transaction", overridingPlatformModuleExpDir_JavaTransaction)
.addPatchModule("java.xml", overridingPlatformModuleExpDir_JavaXml)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
Expand All @@ -138,7 +138,7 @@ public void execute(StfCoreExtension test) throws StfException {
.addModuleToModulepath("openjdk.test.modularity/bin/common-mods")
.addModuleToModulepath("openjdk.test.modularity/bin/tests")
.addRootModule("com.test")
.addPatchModule("java.transaction", overridingPlatformModuleJar_JavaTransaction)
.addPatchModule("java.xml", overridingPlatformModuleJar_JavaXml)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@
* ---------
* 1) Using an exploded module folder:
* 1.1) Override an application module
* 1.2) Override an upgradable platform module.
* 1.3) Override a non-upgradable platform module(Negative test)
* 1.4) Override an application module using a custom runtime image
* 1.5) Override an upgradable platform module using a custom runtime image
* 1.6) Override a non-upgradable platform module using a custom runtime image(Negative test)
* 1.2) Override a non-upgradable platform module(Negative test)
* 1.3) Override an application module using a custom runtime image
* 1.4) Override a non-upgradable platform module using a custom runtime image(Negative test)
*
* 2) Repeat above using modularized jar.
* Note: Test (2.3) is specific to jarred tests -
Expand Down Expand Up @@ -74,7 +72,6 @@ public enum Variant {
};

ModuleRef helloOverrideModule = null;
ModuleRef txnOverrideModule = null;
ModuleRef loggingOverrideModule = null;

public void help(HelpTextGenerator help) {
Expand All @@ -97,8 +94,6 @@ public void execute(StfCoreExtension test) throws StfException {
ModuleRef helperModule = test.doCreateModularJar("Create com.helper jar", "openjdk.test.modularity/bin/common-mods/com.helper");
ModuleRef discreetModule = test.doCreateModularJar("Create com.discreet jar", "openjdk.test.modularity/bin/common-mods/com.discreet");
ModuleRef testModule = test.doCreateModularJar("Create tests jar", "openjdk.test.modularity/bin/tests/com.test");
FileRef javaTransactionNonModJar = test.doCreateProjectJar("create non-modularized java.transaction.jar",
"openjdk.test.modularity/bin/common-override/java.transaction", "javax");

DirectoryRef runtimeImage = test.doRunJlink("Create runtime image for "
+ "upgrademodulepath test",
Expand Down Expand Up @@ -132,22 +127,7 @@ public void execute(StfCoreExtension test) throws StfException {
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingAppModule")
);

/*1.2) Override an upgradable platform module*/
test.doRunForegroundProcess("Override an upgradable platform module", "OT12",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition()
.addModuleAddReads("com.test=ALL-UNNAMED")
.addModuleToModulepath("openjdk.test.modularity/bin/common-mods")
.addModuleToModulepath("openjdk.test.modularity/bin/tests")
.addRootModule("com.test")
.addModuleToUpgradeModulepath("openjdk.test.modularity/bin/common-override/java.transaction")
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingUpgradablePlatformModule")
);

/*1.3) (Negative test) Override a non-upgradable platform module */
/*1.2) (Negative test) Override a non-upgradable platform module */
StfProcess ot13 = test.doRunForegroundProcess("(Negative test) Override a non-upgradable platform "
+ "module", "OT13",
ECHO_ON, ExpectedOutcome.exitValue(1).within("1m"),
Expand Down Expand Up @@ -188,7 +168,7 @@ public void execute(StfCoreExtension test) throws StfException {

case ExpDirModUpgradeCRImage :

/*1.4) Override an application module using a custom runtime image*/
/*1.3) Override an application module using a custom runtime image*/
test.doRunForegroundProcess("Override an application module "
+ "using a custom runtime image", "OT14",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
Expand All @@ -201,22 +181,9 @@ public void execute(StfCoreExtension test) throws StfException {
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingAppModule")
);

/*1.5) Override an upgradable platform module using a custom runtime image*/
test.doRunForegroundProcess("Override an upgradable platform module "
+ "using a custom runtime image", "OT15",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition()
.addRunImage(runtimeImage)
.addModuleAddReads("com.test=ALL-UNNAMED")
.addModuleToUpgradeModulepath("openjdk.test.modularity/bin/common-override/java.transaction")
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingUpgradablePlatformModule")
);

/*1.6) (Negative test) Override a non-upgradable platform module using a custom runtime image*/

/*1.4) (Negative test) Override a non-upgradable platform module using a custom runtime image*/
StfProcess ot16 = test.doRunForegroundProcess("(Negative test) Override a non-upgradable platform "
+ "module using a custom runtime image", "OT16",
ECHO_ON, ExpectedOutcome.exitValue(1).within("1m"),
Expand Down Expand Up @@ -275,43 +242,8 @@ public void execute(StfCoreExtension test) throws StfException {
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingAppModule")
);

/*2.2) Override an upgradable platform module*/
intializeOverrideModuleJars(test);
test.doRunForegroundProcess("Override an upgradable platform module"
+ "where the overriding module is in a modularized jar", "OT22",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition()
.addModuleAddReads("com.test=ALL-UNNAMED")
.addModuleToModulepath("openjdk.test.modularity/bin/common-mods")
.addModuleToModulepath("openjdk.test.modularity/bin/tests")
.addRootModule("com.test")
.addFileToUpgradeModulepath(txnOverrideModule.getJarFileRef())
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit."
+ "TestOverrideUsingUpgradablePlatformModule")
);

/*2.3) Override an upgradable platform module using a non-modularized jar*/
test.doRunForegroundProcess("Override an upgradable platform module"
+ "using a non-modularized jar", "OT23",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition()
.addModuleAddReads("com.test=ALL-UNNAMED")
.addModuleToModulepath("openjdk.test.modularity/bin/common-mods")
.addModuleToModulepath("openjdk.test.modularity/bin/tests")
.addRootModule("com.test")
.addFileToUpgradeModulepath(javaTransactionNonModJar)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit."
+ "TestOverrideUsingPlatformModuleInRegularJar")
);

/*2.4) (Negative test) Override a non-upgradable platform module */
/*2.2) (Negative test) Override a non-upgradable platform module */
intializeOverrideModuleJars(test);
StfProcess ot24 = test.doRunForegroundProcess("(Negative test) Override a "
+ "non-upgradable platform module where the overriding module "
Expand Down Expand Up @@ -354,7 +286,7 @@ public void execute(StfCoreExtension test) throws StfException {

case JarredModUpgradeCRImage :

/*2.5) Override an application module using a custom runtime image*/
/*2.3) Override an application module using a custom runtime image*/
intializeOverrideModuleJars(test);
test.doRunForegroundProcess("Override an application module using a "
+ "custom runtime image where the overriding module is "
Expand All @@ -370,24 +302,7 @@ public void execute(StfCoreExtension test) throws StfException {
.addArg("net.adoptopenjdk.test.modularity.junit.TestOverrideUsingAppModule")
);

/*2.6) Override an upgradable platform module using a custom runtime image*/
intializeOverrideModuleJars(test);
test.doRunForegroundProcess("Override an upgradable platform module "
+ "using a custom runtime image "
+ "where the overriding module is in a modularized jar", "OT26",
ECHO_ON, ExpectedOutcome.cleanRun().within("1m"),
test.createJavaProcessDefinition()
.addRunImage(runtimeImage)
.addModuleAddReads("com.test=ALL-UNNAMED")
.addFileToUpgradeModulepath(txnOverrideModule.getJarFileRef())
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.JUNIT)
.addPrereqJarToClasspath(JavaProcessDefinition.JarId.HAMCREST)
.runClass(org.junit.runner.JUnitCore.class)
.addArg("net.adoptopenjdk.test.modularity.junit."
+ "TestOverrideUsingUpgradablePlatformModule")
);

/*2.7) (Negative test) Override a non-upgradable platform module using a
/*2.4) (Negative test) Override a non-upgradable platform module using a
* custom runtime image*/
intializeOverrideModuleJars(test);
StfProcess ot27 = test.doRunForegroundProcess("(Negative test) Override a "
Expand Down Expand Up @@ -442,11 +357,6 @@ private void intializeOverrideModuleJars(StfCoreExtension test) throws StfExcept
helloOverrideModule = test.doCreateModularJar("Create com.hello override jar",
"openjdk.test.modularity/bin/common-override/com.hello");
}

if (txnOverrideModule == null) {
txnOverrideModule = test.doCreateModularJar("Create java.transaction override jar",
"openjdk.test.modularity/bin/common-override/java.transaction");
}

if (loggingOverrideModule == null) {
loggingOverrideModule = test.doCreateModularJar("Create com.hello override jar",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
* limitations under the License.
*******************************************************************************/

package javax.transaction;
package javax.xml.namespace;

public class TransactionRequiredException extends java.rmi.RemoteException {

/**
*
*/
private static final long serialVersionUID = 1L;

public TransactionRequiredException() {
super();
}

public TransactionRequiredException(String msg) {
super(msg);
}
public class QName {
private String name;

public QName (String name) {
this.name = name;
}

public String getLocalPart​() {
return "Overridden";
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* limitations under the License.
*******************************************************************************/

module java.transaction {
requires transitive java.rmi;
exports javax.transaction;
module java.xml {
exports javax.xml.namespace;
}

Loading

0 comments on commit 7c36d5b

Please sign in to comment.