1# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. 2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3# 4# This code is free software; you can redistribute it and/or modify it 5# under the terms of the GNU General Public License version 2 only, as 6# published by the Free Software Foundation. 7# 8# This code is distributed in the hope that it will be useful, but WITHOUT 9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11# version 2 for more details (a copy is included in the LICENSE file that 12# accompanied this code). 13# 14# You should have received a copy of the GNU General Public License version 15# 2 along with this work; if not, write to the Free Software Foundation, 16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17# 18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19# or visit www.oracle.com if you need additional information or have any 20# questions. 21 22# @test 23# @bug 6291034 24# @run shell DeleteOnExitTest.sh 25# @summary Verify that temporary imageio files files are deleted on VM exit. 26 27if [ -z "${TESTSRC}" ]; then 28 echo "TESTSRC undefined: defaulting to ." 29 TESTSRC=. 30fi 31 32if [ -z "${TESTCLASSES}" ]; then 33 echo "TESTCLASSES undefined: defaulting to ." 34 TESTCLASSES=. 35fi 36 37if [ -z "${TESTJAVA}" ]; then 38 echo "TESTJAVA undefined: can't continue." 39 exit 1 40fi 41 42echo "TESTJAVA=${TESTJAVA}" 43echo "TESTSRC=${TESTSRC}" 44echo "TESTCLASSES=${TESTCLASSES}" 45cd ${TESTSRC} 46${COMPILEJAVA}/bin/javac -d ${TESTCLASSES} DeleteOnExitTest.java 47 48cd ${TESTCLASSES} 49 50numfiles0=`ls ${TESTCLASSES} | grep "imageio*.tmp" | wc -l` 51 52${TESTJAVA}/bin/java ${TESTVMOPTS} \ 53 -Djava.io.tmpdir=${TESTCLASSES} DeleteOnExitTest 54 55if [ $? -ne 0 ] 56 then 57 echo "Test fails: exception thrown!" 58 exit 1 59fi 60 61numfiles1=`ls ${TESTCLASSES} | grep "imageio*.tmp" | wc -l` 62 63if [ $numfiles0 -ne $numfiles1 ] 64 then 65 echo "Test fails: tmp file exists!" 66 exit 1 67fi 68echo "Test passed." 69exit 0 70