8058569: Update java/lang/invoke/lambda tests to eliminate dependency on sun.tools.jar.Main

Reviewed-by: dholmes, alanb
This commit is contained in:
Amy Lu 2014-09-17 23:27:59 -04:00 committed by David Holmes
parent 6d148f368d
commit 6f7645f43c
2 changed files with 13 additions and 6 deletions

View File

@ -37,8 +37,6 @@ import java.util.Map;
* 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 @@ class LUtils {
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() {
}

View File

@ -67,12 +67,17 @@ public class LambdaAccessControlDoPrivilegedTest extends LUtils {
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();