8067889: 4 pack200 tests fail on mac since jdk became modular
Reviewed-by: alanb, chegar
This commit is contained in:
parent
89ee032790
commit
0542ae2f13
jdk/test/tools/pack200
@ -127,7 +127,7 @@ public class Pack200Test {
|
||||
// select the jars carefully, adding more jars will increase the
|
||||
// testing time, especially for jprt.
|
||||
jarList.add(Utils.createRtJar());
|
||||
jarList.add(Utils.locateJar("golden.jar"));
|
||||
jarList.add(Utils.getGoldenJar());
|
||||
System.out.println(jarList);
|
||||
doPackUnpack();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class PackTestZip64 {
|
||||
// make a copy of the test specimen to local directory
|
||||
File testFile = new File("tools_java.jar");
|
||||
// Add a large number of small files to the golden jar
|
||||
generateLargeJar(testFile, Utils.locateJar("golden.jar"));
|
||||
generateLargeJar(testFile, Utils.getGoldenJar());
|
||||
|
||||
List<String> cmdsList = new ArrayList<>();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -50,7 +50,7 @@ public class RepackTest {
|
||||
|
||||
// make a copy of the test specimen to local directory
|
||||
File testFile = new File("src_tools.jar");
|
||||
Utils.copyFile(Utils.locateJar("golden.jar"), testFile);
|
||||
Utils.copyFile(Utils.getGoldenJar(), testFile);
|
||||
List<String> cmdsList = new ArrayList<>();
|
||||
|
||||
// case 1:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -54,7 +54,7 @@ public class TimeStamp {
|
||||
public static void main(String... args) throws IOException {
|
||||
|
||||
// make a local copy of our test file
|
||||
File srcFile = Utils.locateJar("golden.jar");
|
||||
File srcFile = Utils.getGoldenJar();
|
||||
File goldenFile = new File("golden.jar");
|
||||
Utils.copyFile(srcFile, goldenFile);
|
||||
|
||||
|
@ -63,7 +63,7 @@ class Utils {
|
||||
System.getProperty("os.name").startsWith("Windows");
|
||||
static final boolean Is64Bit =
|
||||
System.getProperty("sun.arch.data.model", "32").equals("64");
|
||||
static final File JavaSDK = new File(JavaHome).getParentFile();
|
||||
static final File JavaSDK = new File(JavaHome);
|
||||
|
||||
static final String PACK_FILE_EXT = ".pack";
|
||||
static final String JAVA_FILE_EXT = ".java";
|
||||
@ -82,11 +82,7 @@ class Utils {
|
||||
if (VerifierJar.exists()) {
|
||||
return;
|
||||
}
|
||||
File srcDir = new File(TEST_SRC_DIR, VERIFIER_DIR_NAME);
|
||||
if (!srcDir.exists()) {
|
||||
// if not available try one level above
|
||||
srcDir = new File(TEST_SRC_DIR.getParentFile(), VERIFIER_DIR_NAME);
|
||||
}
|
||||
File srcDir = new File(getVerifierDir(), "src");
|
||||
List<File> javaFileList = findFiles(srcDir, createFilter(JAVA_FILE_EXT));
|
||||
File tmpFile = File.createTempFile("javac", ".tmp");
|
||||
XCLASSES.mkdirs();
|
||||
@ -115,6 +111,18 @@ class Utils {
|
||||
".");
|
||||
}
|
||||
|
||||
private static File getVerifierDir() {
|
||||
File srcDir = new File(TEST_SRC_DIR, VERIFIER_DIR_NAME);
|
||||
if (!srcDir.exists()) {
|
||||
// if not available try one level above
|
||||
srcDir = new File(TEST_SRC_DIR.getParentFile(), VERIFIER_DIR_NAME);
|
||||
}
|
||||
return srcDir;
|
||||
}
|
||||
|
||||
static File getGoldenJar() {
|
||||
return new File(new File(getVerifierDir(), "data"), "golden.jar");
|
||||
}
|
||||
static void dirlist(File dir) {
|
||||
File[] files = dir.listFiles();
|
||||
System.out.println("--listing " + dir.getAbsolutePath() + "---");
|
||||
@ -564,7 +572,8 @@ class Utils {
|
||||
File rtJar = new File("rt.jar");
|
||||
cmdList.clear();
|
||||
cmdList.add(getJarCmd());
|
||||
cmdList.add("cvf");
|
||||
// cmdList.add("cvf"); too noisy
|
||||
cmdList.add("cf");
|
||||
cmdList.add(rtJar.getName());
|
||||
cmdList.add("-C");
|
||||
cmdList.add("out");
|
||||
@ -574,24 +583,4 @@ class Utils {
|
||||
recursiveDelete(new File("out"));
|
||||
return rtJar;
|
||||
}
|
||||
private static List<File> locaterCache = null;
|
||||
// search the source dir and jdk dir for requested file and returns
|
||||
// the first location it finds.
|
||||
static File locateJar(String name) {
|
||||
try {
|
||||
if (locaterCache == null) {
|
||||
locaterCache = new ArrayList<File>();
|
||||
locaterCache.addAll(findFiles(TEST_SRC_DIR, createFilter(JAR_FILE_EXT)));
|
||||
locaterCache.addAll(findFiles(JavaSDK, createFilter(JAR_FILE_EXT)));
|
||||
}
|
||||
for (File f : locaterCache) {
|
||||
if (f.getName().equals(name)) {
|
||||
return f;
|
||||
}
|
||||
}
|
||||
throw new IOException("file not found: " + name);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user