This test has been seen to fail occasionally when run with concurrency enabled. I believe the reason to be two fold:

 1) The order of the tags may trigger the compilation of the test
    classes before the library classes, causing the test classes to
    implicitly compile the library classes into the tests classes
    directory, rather than the shared higher level library directory,
    ( if the library classes are not already compiled, hence the reason
    the failure appears intermittently).

 2) The test needs to specify the TESTCLASSPATH variable, rather than
    TESTCLASSES. So it can find the library classes in the
    shared higher level library directory.

diff --git a/test/java/net/URLPermission/nstest/lookup.sh b/test/java/net/URLPermission/nstest/lookup.sh
--- a/test/java/net/URLPermission/nstest/lookup.sh
+++ b/test/java/net/URLPermission/nstest/lookup.sh
@@ -24,9 +24,9 @@

 # @test
 # @library /lib/testlibrary
+# @build jdk.testlibrary.*
 # @compile -XDignore.symbol.file=true SimpleNameService.java
 #            LookupTest.java SimpleNameServiceDescriptor.java
-# @build jdk.testlibrary.*
 # @run shell/timeout=50 lookup.sh
 #

@@ -42,8 +42,7 @@
     ;;
 esac

-
-port=`${TESTJAVA}/bin/java -cp ${TESTCLASSES} LookupTest -getport`
+port=`${TESTJAVA}/bin/java -cp ${TESTCLASSPATH} LookupTest -getport`

 cat << POLICY > policy
 grant {
@@ -60,4 +59,4 @@
 ${TESTJAVA}/bin/java ${TESTVMOPTS} \
     -Djava.security.policy=file:./policy \
     -Dsun.net.spi.nameservice.provider.1=simple,sun \
-    -cp ${TESTCLASSES}${PS}${TESTSRC} LookupTest -runtest ${port}
+    -cp ${TESTCLASSPATH}${PS}${TESTSRC} LookupTest -runtest ${port}

-Chris.

Reply via email to