6962617: Testcase changes, cleanup of problem list for jdk_tools targets
authorohair
Sun, 20 Jun 2010 14:53:36 -0700
changeset 5813 8e455cd3e807
parent 5812 45384c2300ce
child 5814 abee09402885
6962617: Testcase changes, cleanup of problem list for jdk_tools targets Reviewed-by: alanb
jdk/test/Makefile
jdk/test/ProblemList.txt
jdk/test/com/sun/jdi/PopAndInvokeTest.java
jdk/test/com/sun/servicetag/JavaServiceTagTest1.java
jdk/test/com/sun/servicetag/SystemRegistryTest.java
jdk/test/com/sun/tools/attach/BasicTests.sh
jdk/test/com/sun/tracing/BasicFunctionality.java
jdk/test/sun/jvmstat/testlibrary/utils.sh
jdk/test/sun/tools/jps/jps-Vvml_2.sh
jdk/test/sun/tools/jps/jps-m_2.sh
jdk/test/sun/tools/jstatd/jstatdDefaults.sh
jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh
jdk/test/sun/tools/jstatd/jstatdPort.sh
jdk/test/sun/tools/jstatd/jstatdServerName.sh
jdk/test/tools/jar/UpdateManifest.java
jdk/test/tools/jar/index/MetaInf.java
--- a/jdk/test/Makefile	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/Makefile	Sun Jun 20 14:53:36 2010 -0700
@@ -307,7 +307,7 @@
     passc="`$(CAT) $(PASSLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     failc="`$(CAT) $(FAILLIST)    | $(WC) -l | $(AWK) '{print $$1;}'`"; \
     exclc="`$(CAT) $(EXCLUDELIST) | $(WC) -l | $(AWK) '{print $$1;}'`"; \
-    $(ECHO) "TEST STATS: run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
+    $(ECHO) "TEST STATS: name=$(UNIQUE_DIR)  run=$${runc}  pass=$${passc}  fail=$${failc}  excluded=$${exclc}" \
       >> $(STATS_TXT); \
   else \
     $(ECHO) "Missing file: $${_summary}" >> $(STATS_TXT); \
@@ -326,7 +326,7 @@
 # Prep for output
 prep: clean
 	@$(MKDIR) -p $(ABS_TEST_OUTPUT_DIR)
-	@$(MKDIR) -p `dirname $(ARCHIVE_BUNDLE)`
+	@$(MKDIR) -p `$(DIRNAME) $(ARCHIVE_BUNDLE)`
 
 # Cleanup
 clean:
@@ -376,7 +376,7 @@
 $(EXCLUDELIST): $(PROBLEM_LISTS) $(TESTDIRS)
 	@$(RM) $@ $@.temp1 $@.temp2
 	@(($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-all'          ) ;\
-	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH)'   ) ;\
+	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(PLATFORM_OS)'          ) ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_ARCH2)'  ) ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- '$(OS_NAME)-$(OS_VERSION)') ;\
 	  ($(CAT) $(PROBLEM_LISTS) | $(EGREP) -- 'generic-$(OS_ARCH)'      ) ;\
@@ -562,7 +562,7 @@
 JDK_ALL_TARGETS += jdk_tools2
 jdk_tools2: com/sun/tools sun/jvmstat sun/tools tools vm com/sun/servicetag com/sun/tracing
 	$(call SharedLibraryPermissions,tools/launcher)
-	$(call RunOthervmBatch)
+	$(call RunSamevmBatch)
 
 # All tools tests
 jdk_tools: jdk_tools1 jdk_tools2
--- a/jdk/test/ProblemList.txt	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/ProblemList.txt	Sun Jun 20 14:53:36 2010 -0700
@@ -208,15 +208,12 @@
 
 # jdk_management
 
+# Failing, bug was filed: 6959636
+javax/management/loading/LibraryLoader/LibraryLoaderTest.java	generic-all
+
 # Access denied messages on windows/mks, filed 6954450
 sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.sh	windows-all
 
-# Started failing on linux and solaris (filed 6950927)
-#   com.sun.tools.attach.AttachNotSupportedException:
-#     Unable to open socket file:
-#     target process not responding or HotSpot VM not loaded
-sun/management/jmxremote/bootstrap/JvmstatCountersTest.java	generic-all
-
 # Fails on linux: KO: StringMonitor notification missed or not emitted
 javax/management/monitor/NonComparableAttributeValueTest.java	generic-all
 
@@ -871,82 +868,6 @@
 
 # jdk_tools
 
-# Filed bug 6951287, failed on Linux 64bit, sometimes?
-com/sun/jdi/PopAndInvokeTest.java				generic-all
-
-# Some of the tools tests kind of require "othervm" or if they don't will
-#  always be firing up another VM anyway due to the nature of tools testing.
-#  So most if not all tools tests are now being run with "othervm" mode.
-#  Some of these tools tests have a tendency to use fixed ports, bad idea.
-
-# Fails with -ea -esa on Solaris, Assertion error (Solaris specific test)
-com/sun/tracing/BasicFunctionality.java				generic-all
-
-# Fails on Fedora 9 32bit, jps output differs problem
-sun/tools/jstatd/jstatdDefaults.sh				generic-all
-
-# Fails on Linux Fedora 9 32bit, Could not read data for remote JVM 16133
-#       jstat output differs from expected output
-sun/tools/jstatd/jstatdExternalRegistry.sh			generic-all
-
-# Output of jps differs from expected output.
-#   Invalid argument count on solaris-sparc and x64
-sun/tools/jstatd/jstatdPort.sh					generic-all
-
-# othervm mode, Could not synchronize with target
-sun/tools/jps/jps-l_1.sh					generic-all
-sun/tools/jps/jps-l_2.sh					generic-all
-sun/tools/jps/jps-lm.sh						generic-all
-sun/tools/jps/jps-Vvml_2.sh					generic-all
-sun/tools/jps/jps-m_2.sh					generic-all
-
-# Fails on Solaris 10 sparcv9, shell exits with 1
-#  Turning off use of shared archive because of choice of garbage collector or large pages 
-#  Could not synchronize with target
-sun/tools/jps/jps-v_1.sh					generic-all
-
-# Fails on OpenSolaris "Could not synchronize with target"
-sun/tools/jps/jps-Defaults.sh					generic-all
-sun/tools/jps/jps-V_2.sh					generic-all
-sun/tools/jps/jps-Vm_2.sh					generic-all
-sun/tools/jps/jps-Vvm.sh					generic-all
-sun/tools/jps/jps-Vvml.sh					generic-all
-sun/tools/jps/jps-m.sh						generic-all
-
-# Server name error, port 2098 problem?
-sun/tools/jstatd/jstatdServerName.sh				generic-all
-
-# Problems on windows, jmap.exe hangs?
-com/sun/tools/attach/BasicTests.sh				windows-all
-
-# Fails on Solaris 10 sparc, in othervm mode, throws unexpected exception
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java			generic-all
-
-# Unexpected Monitor Exception, solaris sparc -client
-sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.sh	generic-all
-
-# Problems on windows, jmap.exe hangs? (these run jmap)
-sun/tools/jmap/Basic.sh						windows-all
-
-# Invalid argument count on solaris-sparc and x64
-sun/tools/jstatd/jstatdDefaults.sh			 	solaris-all
-
-# Solaris sparcv9, jps output does not match, x64 different
-sun/tools/jstatd/jstatdExternalRegistry.sh		 	solaris-all
-
-# Solaris 10 sparc 32bit -client, java.lang.AssertionError: Some tests failed
-tools/jar/JarEntryTime.java					generic-all
-
-# Times out on sparc?
-tools/launcher/VersionCheck.java				generic-all
-
-# These tests fail on solaris sparc, all the time
-tools/jar/ChangeDir.java					generic-all
-
-# Cannot write jar
-#  Also, possible problems on windows, jmap.exe hangs? 
-tools/jar/index/MetaInf.java				 	windows-all
-
 ############################################################################
 
 # jdk_util
--- a/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/com/sun/jdi/PopAndInvokeTest.java	Sun Jun 20 14:53:36 2010 -0700
@@ -24,6 +24,7 @@
 /**
  *  @test
  *  @bug 6517249
+ *  @ignore 6951287
  *  @summary JDWP: Cannot do an invokeMethod after a popFrames operation
  *
  *  @author jjh
--- a/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/com/sun/servicetag/JavaServiceTagTest1.java	Sun Jun 20 14:53:36 2010 -0700
@@ -32,7 +32,7 @@
  * @author  Mandy Chung
  *
  * @run build JavaServiceTagTest1
- * @run main JavaServiceTagTest1
+ * @run main/othervm JavaServiceTagTest1
  */
 
 import com.sun.servicetag.*;
--- a/jdk/test/com/sun/servicetag/SystemRegistryTest.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/com/sun/servicetag/SystemRegistryTest.java	Sun Jun 20 14:53:36 2010 -0700
@@ -31,7 +31,7 @@
  * @author  Mandy Chung
  *
  * @run build SvcTagClient SystemRegistryTest Util
- * @run main SystemRegistryTest
+ * @run main/othervm SystemRegistryTest
  */
 
 import com.sun.servicetag.*;
--- a/jdk/test/com/sun/tools/attach/BasicTests.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/com/sun/tools/attach/BasicTests.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -37,6 +37,21 @@
   exit 1
 fi
 
+# Windows 2000 is a problem here, so we skip it, see 6962615
+osrev=`uname -a`
+if [ "`echo ${osrev} | grep 'CYGWIN'`" != "" ] ; then
+  if [ "`echo ${osrev} | grep '5.0'`" != "" ] ; then
+     echo "Treating as a pass, not testing Windows 2000"
+     exit 0
+  fi
+fi
+if [ "`echo ${osrev} | grep 'Windows'`" != "" ] ; then
+  if [ "`echo ${osrev} | grep '5 00'`" != "" ] ; then
+     echo "Treating as a pass, not testing Windows 2000"
+     exit 0
+  fi
+fi
+
 . ${TESTSRC}/CommonSetup.sh
 . ${TESTSRC}/ApplicationSetup.sh
 . ${TESTSRC}/AgentSetup.sh
--- a/jdk/test/com/sun/tracing/BasicFunctionality.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/com/sun/tracing/BasicFunctionality.java	Sun Jun 20 14:53:36 2010 -0700
@@ -24,6 +24,7 @@
 /**
  * @test
  * @bug 6537506
+ * @ignore 6962535
  * @summary Basic unit test for tracing framework
  */
 
--- a/jdk/test/sun/jvmstat/testlibrary/utils.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/jvmstat/testlibrary/utils.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -189,3 +189,37 @@
         echo "Error sending term signal to ${kpid}!"
     fi
 }
+
+# check to see if a port is free
+checkPort() # port
+{
+    inuse=`netstat -a | egrep "\.$1"`
+    if [ "${inuse}" = "" ] ; then
+      echo "free"
+    else
+      echo "inuse"
+    fi
+}
+
+# Get a free port, where port+1 is also free, return 0 when giving up
+freePort()
+{
+  start=3000
+  while [ ${start} -lt 3030 ] ; do
+    port1=`expr ${start} '+' $$ '%' 1000`
+    port2=`expr ${port1} '+' 1`
+    if [ "`checkPort ${port1}`" = "inuse" \
+         -o "`checkPort ${port2}`" = "inuse" ] ; then
+      start=`expr ${start} '+' 1`
+    else
+      break
+    fi
+  done
+  if [ "`checkPort ${port1}`" = "inuse" \
+       -o "`checkPort ${port2}`" = "inuse" ] ; then
+    port1="0"
+  fi
+  echo "${port1}"
+}
+
+
--- a/jdk/test/sun/tools/jps/jps-Vvml_2.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jps/jps-Vvml_2.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -51,3 +51,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -J-XX:Flags=${TESTSRC}/vmflags -Vvml | awk -f ${TESTSRC}/jps-Vvml_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
--- a/jdk/test/sun/tools/jps/jps-m_2.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jps/jps-m_2.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -50,3 +50,9 @@
 SLEEPER_PID=$!
 
 ${JPS} -m | awk -f ${TESTSRC}/jps-m_Output2.awk
+RC=$?
+
+cleanup
+
+exit ${RC}
+
--- a/jdk/test/sun/tools/jstatd/jstatdDefaults.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdDefaults.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -56,12 +56,11 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -75,4 +74,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdExternalRegistry.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -44,7 +44,11 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT=2099
+PORT=`freePort`
+if [ "${PORT}" = "0" ] ; then
+  echo "Cannot get free port"
+  exit 1
+fi
 
 RMIREGISTRY_OUT="rmiregistry_$$.out"
 JSTATD_OUT="jstatd_$$.out"
@@ -69,12 +73,7 @@
     exit 1
 fi
 
-# get the process id for the target app (jstatd). note, don't rely
-# on JSTATD_PID as mks interposes a shell when starting a process in
-# the background
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
--- a/jdk/test/sun/tools/jstatd/jstatdPort.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdPort.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -42,7 +42,11 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT=2099
+PORT=`freePort`
+if [ "${PORT}" = "0" ] ; then
+  echo "Cannot get free port"
+  exit 1
+fi
 
 JSTATD_OUT="jstatd_$$.out"
 
@@ -57,12 +61,11 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1`
-
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+${JSTAT} -gcutil ${JSTATD_PID}@${HOSTNAME}:${PORT} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -76,4 +79,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/sun/tools/jstatd/jstatdServerName.sh	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/sun/tools/jstatd/jstatdServerName.sh	Sun Jun 20 14:53:36 2010 -0700
@@ -43,8 +43,12 @@
 JSTAT="${TESTJAVA}/bin/jstat"
 
 HOSTNAME=`uname -n`
-PORT_1=2098
-PORT_2=2099
+PORT_1=`freePort`
+if [ "${PORT_1}" = "0" ] ; then
+  echo "ERROR: No free port"
+  exit 1
+fi
+PORT_2=`expr ${PORT_1} '+' 1`
 SERVERNAME="SecondJstatdServer"
 
 JSTATD_1_OUT="jstatd_$$_1.out"
@@ -68,6 +72,7 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
@@ -77,13 +82,12 @@
 if [ $? -ne 0 ]
 then
     echo "Output of jps differs from expected output. Failed."
+    cleanup
     exit 1
 fi
 
-TARGET_PID=`${JPS} | grep "Jstatd" | cut -d" " -f1 | head -1`
-
-echo "running: ${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_1} 250 5"
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5"
+${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_1} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -91,8 +95,8 @@
     echo "jstat output differs from expected output"
 fi
 
-echo "running: ${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
-${JSTAT} -gcutil ${TARGET_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
+echo "running: ${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5"
+${JSTAT} -gcutil ${JSTATD_1_PID}@${HOSTNAME}:${PORT_2}/${SERVERNAME} 250 5 2>&1 | awk -f ${TESTSRC}/jstatGcutilOutput1.awk
 RC=$?
 
 if [ ${RC} -ne 0 ]
@@ -112,4 +116,6 @@
     RC=1
 fi
 
+cleanup
+
 exit ${RC}
--- a/jdk/test/tools/jar/UpdateManifest.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/tools/jar/UpdateManifest.java	Sun Jun 20 14:53:36 2010 -0700
@@ -143,6 +143,7 @@
         } else {
             fail("did not match specVersion nor specTitle");
         }
+        zf.close();
     }
 
     // --------------------- Convenience ---------------------------
--- a/jdk/test/tools/jar/index/MetaInf.java	Sun Jun 20 14:51:33 2010 -0700
+++ b/jdk/test/tools/jar/index/MetaInf.java	Sun Jun 20 14:53:36 2010 -0700
@@ -62,7 +62,13 @@
 
     static boolean contains(File jarFile, String entryName)
         throws IOException {
-        return new ZipFile(jarFile).getEntry(entryName) != null;
+        ZipFile zf = new ZipFile(jarFile);
+        if ( zf != null ) {
+            boolean result = zf.getEntry(entryName) != null;
+            zf.close();
+            return result;
+        }
+        return false;
     }
 
     static void checkContains(File jarFile, String entryName)
@@ -94,9 +100,13 @@
         String line;
         while ((line = index.readLine()) != null) {
             if (line.equals(SERVICES)) {
+                index.close();
+                f.close();
                 return;
             }
         }
+        index.close();
+        f.close();
         throw new Error(SERVICES + " not indexed.");
     }