jdk/test/java/awt/FontClass/CreateFont/DeleteFont.sh
author ohair
Thu, 17 Sep 2009 13:17:57 -0700
changeset 3790 ab4f91337479
parent 2606 09ad5edb5330
child 5506 202f599c92aa
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2606
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     1
# Copyright 2004-2008 Sun Microsystems, Inc.  All Rights Reserved.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     2
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     3
#
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     4
# This code is free software; you can redistribute it and/or modify it
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     5
# under the terms of the GNU General Public License version 2 only, as
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     6
# published by the Free Software Foundation.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     7
#
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     8
# This code is distributed in the hope that it will be useful, but WITHOUT
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
     9
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    10
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    11
# version 2 for more details (a copy is included in the LICENSE file that
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    12
# accompanied this code).
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    13
#
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    14
# You should have received a copy of the GNU General Public License version
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    15
# 2 along with this work; if not, write to the Free Software Foundation,
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    16
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    17
#
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    18
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    19
# CA 95054 USA or visit www.sun.com if you need additional information or
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    20
# have any questions.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    21
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    22
# @test
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    23
# @bug 6189812 6380357 6632886
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    24
# @summary Verify that temporary font files are deleted on exit.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    25
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    26
if [ -z "${TESTSRC}" ]; then
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    27
  echo "TESTSRC undefined: defaulting to ."
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    28
  TESTSRC=.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    29
fi
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    30
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    31
if [ -z "${TESTCLASSES}" ]; then
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    32
  echo "TESTCLASSES undefined: defaulting to ."
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    33
  TESTCLASSES=.
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    34
fi
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    35
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    36
if [ -z "${TESTJAVA}" ]; then
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    37
  echo "TESTJAVA undefined: can't continue."
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    38
  exit 1
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    39
fi
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    40
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    41
echo "TESTJAVA=${TESTJAVA}"
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    42
echo "TESTSRC=${TESTSRC}"
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    43
echo "TESTCLASSES=${TESTCLASSES}"
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    44
cd ${TESTSRC}
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    45
${TESTJAVA}/bin/javac -d ${TESTCLASSES} DeleteFont.java
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    46
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    47
cd ${TESTCLASSES}
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    48
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    49
numfiles0=`ls ${TESTCLASSES} | wc -l`
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    50
${TESTJAVA}/bin/java -Djava.io.tmpdir=${TESTCLASSES} DeleteFont
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    51
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    52
if [ $? -ne 0 ]
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    53
    then
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    54
      echo "Test fails: exception thrown!"
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    55
      exit 1
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    56
fi
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    57
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    58
numfiles1=`ls ${TESTCLASSES} | wc -l`
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    59
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    60
if [ $numfiles0 -ne $numfiles1 ]
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    61
    then
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    62
      echo "Test fails: tmp file exists!"
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    63
      ls ${TESTCLASSES}
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    64
      exit 1
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    65
fi
09ad5edb5330 6632886: Font.createFont can be persuaded to leak temporary files
prr
parents:
diff changeset
    66
exit 0