8058569: Update java/lang/invoke/lambda tests to eliminate dependency on sun.tools.jar.Main
Reviewed-by: dholmes, alanb
Contributed-by: Amy Lu <amy.lu@oracle.com>
--- a/jdk/test/java/lang/invoke/lambda/LUtils.java Wed Sep 17 14:11:40 2014 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LUtils.java Wed Sep 17 23:27:59 2014 -0400
@@ -37,8 +37,6 @@
* support infrastructure to invoke a java class from the command line
*/
class LUtils {
- static final sun.tools.jar.Main jarTool =
- new sun.tools.jar.Main(System.out, System.err, "jar-tool");
static final com.sun.tools.javac.Main javac =
new com.sun.tools.javac.Main();
static final File cwd = new File(".").getAbsoluteFile();
@@ -49,6 +47,10 @@
static final File JAVA_BIN_FILE = new File(JAVAHOME, "bin");
static final File JAVA_CMD = new File(JAVA_BIN_FILE,
isWindows ? "java.exe" : "java");
+ static final File JAR_BIN_FILE =
+ new File(new File(JAVAHOME).getParentFile(), "bin");
+ static final File JAR_CMD = new File(JAR_BIN_FILE,
+ isWindows ? "jar.exe" : "jar");
protected LUtils() {
}
--- a/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java Wed Sep 17 14:11:40 2014 -0700
+++ b/jdk/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java Wed Sep 17 23:27:59 2014 -0400
@@ -67,12 +67,17 @@
compile(javacArgs);
File jarFile = new File("foo.jar");
String[] jargs = {"cvf", jarFile.getName(), doprivClass.getName()};
- jarTool.run(jargs);
+ TestResult tr = doExec(JAR_CMD.getAbsolutePath(),
+ "cvf", jarFile.getName(),
+ doprivClass.getName());
+ if (tr.exitValue != 0){
+ throw new RuntimeException(tr.toString());
+ }
doprivJava.delete();
doprivClass.delete();
- TestResult tr = doExec(JAVA_CMD.getAbsolutePath(),
- "-Xbootclasspath/p:foo.jar",
- "-cp", ".", "Bar");
+ tr = doExec(JAVA_CMD.getAbsolutePath(),
+ "-Xbootclasspath/p:foo.jar",
+ "-cp", ".", "Bar");
tr.assertZero("testDoPrivileged fails");
barJava.delete();
barClass.delete();