changeset 17822:cb4fd968fb83

8183351: Better cleanup for jdk/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh Reviewed-by: serb
author prr
date Thu, 31 Aug 2017 13:09:31 -0700
parents cd9b04ac647e
children c6f9f9e5f186
files test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh
diffstat 1 files changed, 15 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh	Thu Aug 31 10:51:07 2017 -0700
+++ b/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh	Thu Aug 31 13:09:31 2017 -0700
@@ -22,7 +22,7 @@
 #
 #   @test
 #
-#   @bug        6342404 7078379 8167503
+#   @bug        6342404 7078379 8167503 8183351
 #
 #   @summary    Test verifies that incorrectly configured ImageIO plugin spi
 #               does not affect registration of other ImageIO plugin in the
@@ -57,6 +57,7 @@
  { echo "The test failed :-("
    echo "$*" 1>&2
    echo "exit status was $status"
+   clean
    exit $status
  } #end of fail()
 
@@ -65,9 +66,19 @@
 pass()
  { echo "The test passed!!!"
    echo "$*" 1>&2
+   clean
    exit 0
  } #end of pass()
 
+#Clean up the test_ext directory (PLUGINDST_DIR) before leaving
+clean()
+ {
+ echo "Removing PLUGINDST_DIR ${PLUGINDST_DIR}"
+ if [ -n "${PLUGINDST_DIR}" -a -d "${PLUGINDST_DIR}" ] ; then
+ rm -rf "${PLUGINDST_DIR}"
+ fi
+ }
+
 # end of subroutines
 
 
@@ -169,14 +180,11 @@
 # app have file read permission for all subdirs of the
 # scratch dir
 
-PLUGINDST_DIR=${TMP}/test_ext
-#PLUGINDST_DIR=${TESTJAVA}/lib/ext
+PLUGINDST_DIR=$(mktemp -d ${TMP}/iio_test.XXXXXXXX)
+echo "Created PLUGINDST_DIR as ${PLUGINDST_DIR}"
+
 TEST_PLUGIN=dummy.jar
 
-if [ ! -d ${PLUGINDST_DIR} ] ; then
-    mkdir ${PLUGINDST_DIR}
-fi
-
 # remove old service declaration
 if [ -d META-INF ] ; then
     rm -rf META-INF