changeset 10686:bee3c5b0577f

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>
author dholmes
date Wed, 17 Sep 2014 23:27:59 -0400
parents 7f183794f7dd
children 07226b7c5c3e 49dcd4903b01
files test/java/lang/invoke/lambda/LUtils.java test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/invoke/lambda/LUtils.java	Wed Sep 17 14:11:40 2014 -0700
+++ b/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/test/java/lang/invoke/lambda/LambdaAccessControlDoPrivilegedTest.java	Wed Sep 17 14:11:40 2014 -0700
+++ b/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();