diff --git a/test/Makefile b/test/Makefile index 9272bbb4cf4dc8f04efae4dc4541c4f4b7126196..ad4ca160486a784a2931b079783ae225363a7bb7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -307,7 +307,7 @@ BUNDLE_UP_AND_EXIT = \ 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 @@ all: jtreg_tests # 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 @@ else $(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_tools1: com/sun/jdi 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 diff --git a/test/ProblemList.txt b/test/ProblemList.txt index 5cb3a983dabc2e9b8d1df2f67d8fe561b62e68af..76d34d85b92b387c07dcae7ab29fe01c2d91fd3b 100644 --- a/test/ProblemList.txt +++ b/test/ProblemList.txt @@ -208,15 +208,12 @@ java/lang/ClassLoader/deadlock/TestCrossDelegate.sh generic-all # 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 @@ java/text/Bidi/Bug6665028.java linux-x64 # 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 diff --git a/test/com/sun/jdi/PopAndInvokeTest.java b/test/com/sun/jdi/PopAndInvokeTest.java index 3cc6381c600ff2bd70aeeb3b1eeec72c41762d12..b601f5e40bdc50b5148a34c726dfa19a18d296dd 100644 --- a/test/com/sun/jdi/PopAndInvokeTest.java +++ b/test/com/sun/jdi/PopAndInvokeTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 6517249 + * @ignore 6951287 * @summary JDWP: Cannot do an invokeMethod after a popFrames operation * * @author jjh diff --git a/test/com/sun/servicetag/JavaServiceTagTest1.java b/test/com/sun/servicetag/JavaServiceTagTest1.java index eb72cc7b8dcdbef98b22a2c4372dd3f53d3d90b1..db837ae113d7e8c71667c2851864f68cf54379ed 100644 --- a/test/com/sun/servicetag/JavaServiceTagTest1.java +++ b/test/com/sun/servicetag/JavaServiceTagTest1.java @@ -32,7 +32,7 @@ * @author Mandy Chung * * @run build JavaServiceTagTest1 - * @run main JavaServiceTagTest1 + * @run main/othervm JavaServiceTagTest1 */ import com.sun.servicetag.*; diff --git a/test/com/sun/servicetag/SystemRegistryTest.java b/test/com/sun/servicetag/SystemRegistryTest.java index 0e0be1ccb1eef8d1ec68c615108dbfad0ed20337..2ddf21b045e17e88eb8e269603c0839a3f3746a9 100644 --- a/test/com/sun/servicetag/SystemRegistryTest.java +++ b/test/com/sun/servicetag/SystemRegistryTest.java @@ -31,7 +31,7 @@ * @author Mandy Chung * * @run build SvcTagClient SystemRegistryTest Util - * @run main SystemRegistryTest + * @run main/othervm SystemRegistryTest */ import com.sun.servicetag.*; diff --git a/test/com/sun/tools/attach/BasicTests.sh b/test/com/sun/tools/attach/BasicTests.sh index 4c9236cca7fe2061718bf51261d3ee0a39c2b36b..3f8f8571411275a4c944ddf44bd5c651af8872d1 100644 --- a/test/com/sun/tools/attach/BasicTests.sh +++ b/test/com/sun/tools/attach/BasicTests.sh @@ -37,6 +37,21 @@ then 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 diff --git a/test/com/sun/tracing/BasicFunctionality.java b/test/com/sun/tracing/BasicFunctionality.java index 0311fde0282c83e9a38f999c9b541855c11243a1..614e73e2a5a6ceccf7eb939cc909cb1a69e6071c 100644 --- a/test/com/sun/tracing/BasicFunctionality.java +++ b/test/com/sun/tracing/BasicFunctionality.java @@ -24,6 +24,7 @@ /** * @test * @bug 6537506 + * @ignore 6962535 * @summary Basic unit test for tracing framework */ diff --git a/test/sun/jvmstat/testlibrary/utils.sh b/test/sun/jvmstat/testlibrary/utils.sh index fc27e1c65098a04dbfc44494a342767279a64235..a2e4608dae1a4e9e0e18a2d0f73ee8fd980300b2 100644 --- a/test/sun/jvmstat/testlibrary/utils.sh +++ b/test/sun/jvmstat/testlibrary/utils.sh @@ -189,3 +189,37 @@ kill_proc_common() { 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}" +} + + diff --git a/test/sun/tools/jps/jps-Vvml_2.sh b/test/sun/tools/jps/jps-Vvml_2.sh index 96f8678281becb6b3957cb38bdc69a4182b78346..83f9a05249adcc3747b5f0f5b2b4b7a836b8e72c 100644 --- a/test/sun/tools/jps/jps-Vvml_2.sh +++ b/test/sun/tools/jps/jps-Vvml_2.sh @@ -51,3 +51,9 @@ ${JAVA} -cp ${TESTCLASSES} Sleeper & SLEEPER_PID=$! ${JPS} -J-XX:Flags=${TESTSRC}/vmflags -Vvml | awk -f ${TESTSRC}/jps-Vvml_Output2.awk +RC=$? + +cleanup + +exit ${RC} + diff --git a/test/sun/tools/jps/jps-m_2.sh b/test/sun/tools/jps/jps-m_2.sh index 2846ff32d896889b4bd62f322046626bd6aadf31..afa0451804edd68b4e6fe65d84eaeecb2c2368bc 100644 --- a/test/sun/tools/jps/jps-m_2.sh +++ b/test/sun/tools/jps/jps-m_2.sh @@ -50,3 +50,9 @@ ${JAVA} -cp ${TESTCLASSES} Sleeper & SLEEPER_PID=$! ${JPS} -m | awk -f ${TESTSRC}/jps-m_Output2.awk +RC=$? + +cleanup + +exit ${RC} + diff --git a/test/sun/tools/jstatd/jstatdDefaults.sh b/test/sun/tools/jstatd/jstatdDefaults.sh index 1e25137e251dc4bbaeaec30032bea5eb065f6331..34b21801191e07ec646da3d053c0f8bdce57128f 100644 --- a/test/sun/tools/jstatd/jstatdDefaults.sh +++ b/test/sun/tools/jstatd/jstatdDefaults.sh @@ -56,12 +56,11 @@ ${JPS} ${HOSTNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk 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 @@ then RC=1 fi +cleanup + exit ${RC} diff --git a/test/sun/tools/jstatd/jstatdExternalRegistry.sh b/test/sun/tools/jstatd/jstatdExternalRegistry.sh index ce523681970acf118fe538f7817ece01e58105a1..3385c821ee6ee4afa0277a9f1ae0ded34fee9f01 100644 --- a/test/sun/tools/jstatd/jstatdExternalRegistry.sh +++ b/test/sun/tools/jstatd/jstatdExternalRegistry.sh @@ -44,7 +44,11 @@ JPS="${TESTJAVA}/bin/jps" 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 @@ then 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 ] diff --git a/test/sun/tools/jstatd/jstatdPort.sh b/test/sun/tools/jstatd/jstatdPort.sh index 48bed6616a8a490d894927e78064d08b7e91ff2c..7e8f4455dea8f9d6c3d2c6606c3afe75766ce6f2 100644 --- a/test/sun/tools/jstatd/jstatdPort.sh +++ b/test/sun/tools/jstatd/jstatdPort.sh @@ -42,7 +42,11 @@ JPS="${TESTJAVA}/bin/jps" 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 @@ ${JPS} ${HOSTNAME}:${PORT} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk 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 @@ then RC=1 fi +cleanup + exit ${RC} diff --git a/test/sun/tools/jstatd/jstatdServerName.sh b/test/sun/tools/jstatd/jstatdServerName.sh index 4215035d334549392f2764a5e3eb2689946e9f0c..723a26c2efeaa39ed9dede9963cfb749844235fb 100644 --- a/test/sun/tools/jstatd/jstatdServerName.sh +++ b/test/sun/tools/jstatd/jstatdServerName.sh @@ -43,8 +43,12 @@ JPS="${TESTJAVA}/bin/jps" 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 @@ ${JPS} ${HOSTNAME}:${PORT_1} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.awk if [ $? -ne 0 ] then echo "Output of jps differs from expected output. Failed." + cleanup exit 1 fi @@ -77,13 +82,12 @@ ${JPS} ${HOSTNAME}:${PORT_2}/${SERVERNAME} 2>&1 | awk -f ${TESTSRC}/jpsOutput1.a 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 @@ then 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 @@ then RC=1 fi +cleanup + exit ${RC} diff --git a/test/tools/jar/UpdateManifest.java b/test/tools/jar/UpdateManifest.java index f2b5ca4e3aebe4ab3067f6048d7f25ee229568fd..2bcd25081ea7238a4ce8f84d87f45d0db88b1fd8 100644 --- a/test/tools/jar/UpdateManifest.java +++ b/test/tools/jar/UpdateManifest.java @@ -143,6 +143,7 @@ public class UpdateManifest { } else { fail("did not match specVersion nor specTitle"); } + zf.close(); } // --------------------- Convenience --------------------------- diff --git a/test/tools/jar/index/MetaInf.java b/test/tools/jar/index/MetaInf.java index 2ffaa4afb188ec00d4f0487a03153c1b693214d1..ea62e2ba7bcb536c5074a50f178679eb424dd244 100644 --- a/test/tools/jar/index/MetaInf.java +++ b/test/tools/jar/index/MetaInf.java @@ -62,7 +62,13 @@ public class MetaInf { 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 @@ public class MetaInf { 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."); }