Path: blob/master/test/jdk/javax/imageio/stream/DeleteOnExitTest.sh
41152 views
# Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.1# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2#3# This code is free software; you can redistribute it and/or modify it4# under the terms of the GNU General Public License version 2 only, as5# published by the Free Software Foundation.6#7# This code is distributed in the hope that it will be useful, but WITHOUT8# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10# version 2 for more details (a copy is included in the LICENSE file that11# accompanied this code).12#13# You should have received a copy of the GNU General Public License version14# 2 along with this work; if not, write to the Free Software Foundation,15# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16#17# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18# or visit www.oracle.com if you need additional information or have any19# questions.2021# @test22# @bug 629103423# @run shell DeleteOnExitTest.sh24# @summary Verify that temporary imageio files files are deleted on VM exit.2526if [ -z "${TESTSRC}" ]; then27echo "TESTSRC undefined: defaulting to ."28TESTSRC=.29fi3031if [ -z "${TESTCLASSES}" ]; then32echo "TESTCLASSES undefined: defaulting to ."33TESTCLASSES=.34fi3536if [ -z "${TESTJAVA}" ]; then37echo "TESTJAVA undefined: can't continue."38exit 139fi4041echo "TESTJAVA=${TESTJAVA}"42echo "TESTSRC=${TESTSRC}"43echo "TESTCLASSES=${TESTCLASSES}"44cd ${TESTSRC}45${COMPILEJAVA}/bin/javac -d ${TESTCLASSES} DeleteOnExitTest.java4647cd ${TESTCLASSES}4849numfiles0=`ls ${TESTCLASSES} | grep "imageio*.tmp" | wc -l`5051${TESTJAVA}/bin/java ${TESTVMOPTS} \52-Djava.io.tmpdir=${TESTCLASSES} DeleteOnExitTest5354if [ $? -ne 0 ]55then56echo "Test fails: exception thrown!"57exit 158fi5960numfiles1=`ls ${TESTCLASSES} | grep "imageio*.tmp" | wc -l`6162if [ $numfiles0 -ne $numfiles1 ]63then64echo "Test fails: tmp file exists!"65exit 166fi67echo "Test passed."68exit 0697071