jdk/test/java/awt/Toolkit/AutoShutdown/ShowExitTest/ShowExitTest.sh
author kshefov
Tue, 30 Oct 2012 12:47:35 +0100
changeset 14307 2378cc5c46cc
parent 5506 202f599c92aa
child 22602 0d9a07b0d7e9
permissions -rw-r--r--
7072120: No mac os x support in several regression tests Reviewed-by: anthony, serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/ksh -p
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
     4
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
# accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
#
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
# questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#   @test       ShowExitTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#   @bug        6513421
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#   @summary    Java process does not terminate on closing the Main Application Frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#   @compile ShowExitTest.java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#   @run shell/timeout=60 ShowExitTest.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
# NOTE: The following error message means that the regression test failed:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#       "Execution failed: Program `sh' interrupted! (timed out?)"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
# Beginning of subroutines:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
status=1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#Call this from anywhere to fail the test with an error message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
# usage: fail "reason why the test failed"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    42
fail()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 { echo "The test failed :-("
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
   echo "$*" 1>&2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
   echo "exit status was $status"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
   exit $status
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 } #end of fail()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#Call this from anywhere to pass the test with a message
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
# usage: pass "reason why the test passed if applicable"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    51
pass()
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 { echo "The test passed!!!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
   echo "$*" 1>&2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
   exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 } #end of pass()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
# end of subroutines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
# The beginning of the script proper
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
# Checking for proper OS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
OS=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
case "$OS" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
   SunOS )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
      VAR="One value for Sun"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    67
      DEFAULT_JDK=/
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
      FILESEP="/"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    69
      PATHSEP=":"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    70
      TMP="/tmp"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
   Linux )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
      VAR="A different value for Linux"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    75
      DEFAULT_JDK=/
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
      FILESEP="/"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    77
      PATHSEP=":"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    78
      TMP="/tmp"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    79
      ;;
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    80
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    81
   Darwin )
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    82
      VAR="A different value for MacOSX"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    83
      DEFAULT_JDK=/usr
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    84
      FILESEP="/"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    85
      PATHSEP=":"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    86
      TMP="/tmp"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    89
   Windows* )
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
      VAR="A different value for Win32"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    91
      DEFAULT_JDK="C:/Program Files/Java/jdk1.8.0"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      FILESEP="\\"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    93
      PATHSEP=";"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    94
      TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}`
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    95
      ;;
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    96
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    97
    CYGWIN* )
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    98
      VAR="A different value for Cygwin"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
    99
      DEFAULT_JDK="/cygdrive/c/Program\ Files/Java/jdk1.8.0"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   100
      FILESEP="/"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   101
      PATHSEP=";"
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   102
      TMP=`cd "${SystemRoot}/Temp"; echo ${PWD}`
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
   # catch all other OSs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
   * )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      echo "Unrecognized system!  $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
      fail "Unrecognized system!  $OS"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   113
# Want this test to run standalone as well as in the harness, so do the
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   114
#  following to copy the test's directory into the harness's scratch directory
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#  and set all appropriate variables:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
if [ -z "${TESTJAVA}" ] ; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
   # TESTJAVA is not set, so the test is running stand-alone.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
   # TESTJAVA holds the path to the root directory of the build of the JDK
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
   # to be tested.  That is, any java files run explicitly in this shell
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
   # should use TESTJAVA in the path to the java interpreter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
   # So, we'll set this to the JDK spec'd on the command line.  If none
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
   # is given on the command line, tell the user that and use a cheesy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
   # default.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
   # THIS IS THE JDK BEING TESTED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
   if [ -n "$1" ] ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      then TESTJAVA=$1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
      else echo "no JDK specified on command line so using default!"
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   129
     TESTJAVA=$DEFAULT_JDK
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
   fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
   TESTSRC=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
   TESTCLASSES=.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
   STANDALONE=1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
echo "JDK under test is: $TESTJAVA"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
#Deal with .class files:
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   138
if [ -n "${STANDALONE}" ] ;
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   139
   then
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
   #if standalone, remind user to cd to dir. containing test before running it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
   echo "Just a reminder: cd to the dir containing this test when running it"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
   # then compile all .java files (if there are any) into .class files
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   143
   if [ -a *.java ] ;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      then echo "Reminder, this test should be in its own directory with all"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      echo "supporting files it needs in the directory with it."
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   146
      ${TESTJAVA}/bin/javac ./*.java ;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
   fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
   # else in harness so copy all the class files from where jtreg put them
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   149
   # over to the scratch directory this test is running in.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
   else cp ${TESTCLASSES}/*.class . ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   153
#if in test harness, then copy the entire directory that the test is in over
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
# to the scratch directory.  This catches any support files needed by the test.
14307
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   155
if [ -z "${STANDALONE}" ] ;
2378cc5c46cc 7072120: No mac os x support in several regression tests
kshefov
parents: 5506
diff changeset
   156
   then cp ${TESTSRC}/* .
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
#Just before executing anything, make sure it has executable permission!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
chmod 777 ./*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
###############  YOUR TEST CODE HERE!!!!!!!  #############
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
#All files required for the test should be in the same directory with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
# this file.  If converting a standalone test to run with the harness,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
# as long as all files are in the same directory and it returns 0 for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
# pass, you should be able to cut and paste it into here and it will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
# run with the test harness.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
${TESTJAVA}/bin/java ShowExitTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
###############  END YOUR TEST CODE !!!!! ############
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
#Be sure the last command executed above this line returns 0 for success,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
# something non-zero for failure.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
status=$?
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
# pass or fail the test based on status of the command
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
if [ $status -eq "0" ];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
   then pass ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
   else fail "The program didn't terminate automatically!"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
#For additional examples of how to write platform independent KSH scripts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
# see the jtreg file itself.  It is a KSH script for both Solaris and Win32
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186