Merge
authorohair
Wed, 18 Nov 2009 11:15:12 -0800
changeset 4322 6508d71adfd1
parent 4318 fdcb5ce9dc00 (current diff)
parent 4321 bfe4e99e62e1 (diff)
child 4323 da93d0c0f2f2
Merge
jdk/test/sun/tools/native2ascii/test2
--- a/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Nov 18 12:34:26 2009 -0500
+++ b/jdk/src/share/classes/com/sun/tools/hat/internal/model/JavaStatic.java	Wed Nov 18 11:15:12 2009 -0800
@@ -57,7 +57,10 @@
             id = ((JavaObjectRef)value).getId();
         }
         value = value.dereference(snapshot, field);
-        if (value.isHeapAllocated()) {
+        if (value.isHeapAllocated() &&
+            clazz.getLoader() == snapshot.getNullThing()) {
+            // static fields are only roots if they are in classes
+            //    loaded by the root classloader.
             JavaHeapObject ho = (JavaHeapObject) value;
             String s = "Static reference from " + clazz.getName()
                        + "." + field.getName();
--- a/jdk/test/ProblemList.txt	Wed Nov 18 12:34:26 2009 -0500
+++ b/jdk/test/ProblemList.txt	Wed Nov 18 11:15:12 2009 -0800
@@ -1117,9 +1117,6 @@
 # Unexpected Monitor Exception, solaris sparc -client
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh	generic-all
 
-# Probably should be samevm, but seem to cause errors even in othervm at times
-sun/tools/jhat/HatHeapDump1Test.java			 	generic-all
-
 # Problems on windows, jmap.exe hangs? (these run jmap)
 sun/tools/jmap/Basic.sh						windows-all
 
@@ -1129,9 +1126,6 @@
 # Solaris sparcv9, jps output does not match, x64 different
 sun/tools/jstatd/jstatdExternalRegistry.sh		 	solaris-all
 
-# Probably should be samevm, but seem to cause errors even in othervm at times
-sun/tools/native2ascii/NativeErrors.java		 	generic-all
-
 # Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
 tools/jar/JarEntryTime.java					generic-all
 
--- a/jdk/test/sun/tools/jhat/HatRun.java	Wed Nov 18 12:34:26 2009 -0500
+++ b/jdk/test/sun/tools/jhat/HatRun.java	Wed Nov 18 11:15:12 2009 -0800
@@ -186,11 +186,13 @@
          */
         int nvm_options = 0;
         if ( vm_options != null ) nvm_options = vm_options.length;
-        String cmd[]     = new String[1 + (d64?1:0) + 5 + nvm_options];
+        String cmd[]     = new String[1 + (d64?1:0) + 7 + nvm_options];
         int i,j;
 
         i = 0;
         cmd[i++] = java;
+        cmd[i++] = "-cp";
+        cmd[i++] = cdir;
         cmd[i++] = "-Dtest.classes=" + cdir;
         if ( d64 ) {
             cmd[i++] = "-d64";
--- a/jdk/test/sun/tools/native2ascii/NativeErrors.java	Wed Nov 18 12:34:26 2009 -0500
+++ b/jdk/test/sun/tools/native2ascii/NativeErrors.java	Wed Nov 18 11:15:12 2009 -0800
@@ -59,15 +59,28 @@
         in = new BufferedReader(new InputStreamReader(p.getInputStream()));
         checkResult(in, "err.bad.arg");
 
-        command = getComString("test123");
+        File f0 = new File(System.getProperty("test.src", "."), "test123");
+        String path0 = f0.getPath();
+        if ( f0.exists() ) {
+            throw new Error("Input file should not exist: " + path0);
+        }
+
+        command = getComString(path0);
         p = Runtime.getRuntime().exec(command);
         in = new BufferedReader(new InputStreamReader(p.getInputStream()));
         checkResult(in, "err.cannot.read");
 
         File f1 = new File(System.getProperty("test.src", "."), "test1");
-        File f2 = new File(System.getProperty("test.src", "."), "test2");
+        File f2 = File.createTempFile("test2", ".tmp");
         String path1 = f1.getPath();
         String path2 = f2.getPath();
+        if ( !f1.exists() ) {
+            throw new Error("Missing input file: " + path1);
+        }
+        if ( !f2.setWritable(false) ) {
+            throw new Error("Output file cannot be made read only: " + path2);
+        }
+        f2.deleteOnExit();
 
         command = getComString(path1, path2);
         p = Runtime.getRuntime().exec(command);
@@ -80,7 +93,9 @@
                                                            throws Exception {
         String errorReceived;
         errorReceived = in.readLine();
+        assert errorReceived != null : "First readline cannot be null";
         errorExpected = rsrc.getString(errorExpected);
+        assert errorExpected != null : "Expected message cannot be null";
         StringBuffer error = new StringBuffer(errorExpected);
         int start = errorExpected.indexOf("{0}");
         if (start >= 0) {
@@ -128,6 +143,7 @@
             f = new File(path);
             if (!f.exists())
                 throw new RuntimeException("Cannot find native2ascii at "+path);
+            System.out.println("Using native2ascii at "+path);
         }
         return path;
     }
--- a/jdk/test/sun/tools/native2ascii/test2	Wed Nov 18 12:34:26 2009 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-This file exists as a non-writable placeholder for NativeErrors.java