8187124: [TESTBUG] TestInterpreterMethodEntries.java: Unable to create shared archive file
authorccheung
Tue, 26 Sep 2017 19:31:06 -0700
changeset 47545 b741e818a8ac
parent 47544 56fa7dfd11cd
child 47546 64ba55ba8516
8187124: [TESTBUG] TestInterpreterMethodEntries.java: Unable to create shared archive file Summary: added the current timestamp into the shared archive file name Reviewed-by: mseledtsov, gtriantafill
test/lib/jdk/test/lib/cds/CDSTestUtils.java
--- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Tue Sep 26 21:12:39 2017 +0000
+++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Tue Sep 26 19:31:06 2017 -0700
@@ -26,7 +26,9 @@
 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 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 @@
         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;
     }