8187124: [TESTBUG] TestInterpreterMethodEntries.java: Unable to create shared archive file

Added the current timestamp into the shared archive file name

Reviewed-by: mseledtsov, gtriantafill
This commit is contained in:
Calvin Cheung 2017-09-26 19:31:06 -07:00
parent b9f1af71e5
commit 2a93b38ee9

@ -26,7 +26,9 @@ import java.io.IOException;
import java.io.File;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import jdk.test.lib.Utils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
@ -60,6 +62,8 @@ public class CDSTestUtils {
public static OutputAnalyzer createArchive(CDSOptions opts)
throws Exception {
startNewArchiveName();
ArrayList<String> cmd = new ArrayList<String>();
for (String p : opts.prefix) cmd.add(p);
@ -328,9 +332,19 @@ public class CDSTestUtils {
return testName;
}
private static final SimpleDateFormat timeStampFormat =
new SimpleDateFormat("HH'h'mm'm'ss's'SSS");
private static String defaultArchiveName;
// Call this method to start new archive with new unique name
public static void startNewArchiveName() {
defaultArchiveName = getTestName() +
timeStampFormat.format(new Date()) + ".jsa";
}
public static String getDefaultArchiveName() {
return getTestName() + ".jsa";
return defaultArchiveName;
}