8133180: [TESTBUG] runtime/SharedArchiveFile/SharedStrings.java failed with WhiteBox.class : no such file or directory
authormseledtsov
Thu, 03 Sep 2015 08:57:16 -0700
changeset 32615 b6c0aafd6945
parent 32614 b7b2407bc7e5
child 32616 888b4f477ec9
8133180: [TESTBUG] runtime/SharedArchiveFile/SharedStrings.java failed with WhiteBox.class : no such file or directory Summary: Removed ambiguity on where JarBuilder looks for classes Reviewed-by: jiangli, ctornqvi, gtriantafill
hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java
hotspot/test/runtime/SharedArchiveFile/SharedStrings.java
hotspot/test/runtime/SharedArchiveFile/SharedStringsWb.java
--- a/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java	Thu Sep 03 10:22:39 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/BasicJarBuilder.java	Thu Sep 03 08:57:16 2015 -0700
@@ -35,14 +35,14 @@
 import java.util.ArrayList;
 import sun.tools.jar.Main;
 
+// Using JarBuilder requires that all to-be-jarred classes should be placed
+// in the current working directory, aka "."
 public class BasicJarBuilder {
     private static final String classDir = System.getProperty("test.classes");
 
-    public static void build(String jarName, String ...classNames)
-        throws Exception {
-
-        createSimpleJar(classDir, classDir + File.separator + jarName +
-            ".jar", classNames);
+    public static void build(String jarName, String ...classNames) throws Exception {
+        createSimpleJar(".", classDir + File.separator + jarName + ".jar",
+            classNames);
     }
 
     private static void createSimpleJar(String jarclassDir, String jarName,
@@ -71,7 +71,7 @@
         }
     }
 
-    // helpers
+    // Get full path to the test jar
     public static String getTestJar(String jar) {
         File dir = new File(System.getProperty("test.classes", "."));
         File jarFile = new File(dir, jar);
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java	Thu Sep 03 10:22:39 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStrings.java	Thu Sep 03 08:57:16 2015 -0700
@@ -32,12 +32,10 @@
  * @library /testlibrary /../../test/lib
  * @modules java.base/sun.misc
  *          java.management
- * @ignore - 8133180
- * @build SharedStringsWb SharedStrings BasicJarBuilder
+ * @build SharedStringsWb SharedStrings BasicJarBuilder sun.hotspot.WhiteBox
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main SharedStrings
  */
-
 import jdk.test.lib.*;
 
 public class SharedStrings {
--- a/hotspot/test/runtime/SharedArchiveFile/SharedStringsWb.java	Thu Sep 03 10:22:39 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedStringsWb.java	Thu Sep 03 08:57:16 2015 -0700
@@ -34,8 +34,8 @@
             return;
         }
 
-        // The string "java" is known to be interened and added to CDS archive
-        String s = "java";
+        // The string below is known to be added to CDS archive
+        String s = "<init>";
         String internedS = s.intern();
 
         if (wb.isShared(internedS)) {