< prev index next >
test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java
Print this page
rev 51638 : [mq]: 8210112
*** 22,56 ****
*/
/**
* @test
* @bug 8169909
! * @library src /lib/testlibrary
* @build test/*
* @run shell AppendToClassPathModuleTest.sh
* @run main AppendToClassPathModuleTest
*/
import java.util.Map;
! import static jdk.testlibrary.ProcessTools.*;
/**
* Launch a modular test with no class path and no CLASSPATH set.
* The java agent appends to the "hidden" directory to the class path
* at runtime.
*/
public class AppendToClassPathModuleTest {
public static void main(String... args) throws Throwable {
String modulepath = System.getProperty("test.module.path");
! ProcessBuilder pb =
! createJavaProcessBuilder("-javaagent:Agent.jar",
"--module-path", modulepath,
"-m", "test/jdk.test.Main");
- // remove CLASSPATH environment variable
Map<String,String> env = pb.environment();
! String value = env.remove("CLASSPATH");
int exitCode = executeCommand(pb).getExitValue();
if (exitCode != 0) {
throw new RuntimeException("Test failed: " + exitCode);
}
--- 22,63 ----
*/
/**
* @test
* @bug 8169909
! * @library src /test/lib
* @build test/*
* @run shell AppendToClassPathModuleTest.sh
* @run main AppendToClassPathModuleTest
*/
+ import jdk.test.lib.JDKToolFinder;
+
import java.util.Map;
! import java.util.stream.Stream;
!
! import static jdk.test.lib.process.ProcessTools.*;
/**
* Launch a modular test with no class path and no CLASSPATH set.
* The java agent appends to the "hidden" directory to the class path
* at runtime.
*/
public class AppendToClassPathModuleTest {
public static void main(String... args) throws Throwable {
String modulepath = System.getProperty("test.module.path");
!
! // can't use ProcessTools.createJavaProcessBuilder as it always adds -cp
! ProcessBuilder pb = new ProcessBuilder(
! JDKToolFinder.getTestJDKTool("java"),
! "-javaagent:Agent.jar",
"--module-path", modulepath,
"-m", "test/jdk.test.Main");
Map<String,String> env = pb.environment();
! // remove CLASSPATH environment variable
! env.remove("CLASSPATH");
int exitCode = executeCommand(pb).getExitValue();
if (exitCode != 0) {
throw new RuntimeException("Test failed: " + exitCode);
}
< prev index next >