jdk/test/java/nio/channels/spi/SelectorProvider/inheritedChannel/run_tests.sh
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
# Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
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
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
# CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
# have any questions.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
# @bug 4673940
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
# @bug 4930794
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
# @summary Unit tests for inetd feature
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
# @build StateTest StateTestService EchoTest EchoService CloseTest Launcher Util
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
# @run shell run_tests.sh
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
os=`uname -s`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
if [ "$os" != "Linux" -a "$os" != "SunOS" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
    echo "Test not designed to run on this operating system, skipping..."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
# if TESTJAVA isn't set then we assume an interactive run. So that it's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
# clear which version of 'java' is running we do a 'which java' and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
# a 'java -version'.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
if [ -z "$TESTJAVA" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    TESTSRC=`pwd`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    TESTCLASSES=`pwd`
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    JAVA=java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    which $JAVA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    ${JAVA} -d64 -version > /dev/null 2<&1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    if [ $? = 1 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
	${JAVA} -version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
	${JAVA} -d64 -version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    JAVA="${TESTJAVA}/bin/java"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
CLASSPATH=${TESTCLASSES}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
export CLASSPATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
# Check that we have libLauncher.so for the right platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
# On Solaris we assume 64-bit if java -d64 works.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
DFLAG=
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
if [ "$os" = "SunOS" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    PLATFORM=solaris
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    case "`uname -p`" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
	i[3-9]86) 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
	    ARCH=i586
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
	    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
	sparc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
	    ARCH=sparc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
	    ${JAVA} -d64 -version > /dev/null 2<&1 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
	    if [ $? = 1 ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
	        ARCH=sparc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
	    else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
		ARCH=sparcv9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
		DFLAG=-d64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
	    fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
	    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    esac 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
if [ "$os" = "Linux" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    PLATFORM=linux
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    ARCH=unknown
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    case "`uname -m`" in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
	i[3-6]86)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
	    ARCH=i586
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
	    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
	ia64)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
	    ARCH=ia64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
	    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
	x86_64)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
	    ARCH=amd64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
	    ;;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    esac
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
LIBDIR=lib/${PLATFORM}-${ARCH}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
LAUNCHERLIB=${LIBDIR}/libLauncher.so
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
echo $LIBDIR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
if [ ! -f "${TESTSRC}/${LAUNCHERLIB}" ]; then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    echo "Cannot find ${LAUNCHERLIB} - library not available for this system"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    exit 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
LD_LIBRARY_PATH=${TESTSRC}/${LIBDIR}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
export LD_LIBRARY_PATH
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
failures=0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
go() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    echo ''
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    sh -xc "$JAVA $DFLAG $1 $2 $3 $4 $5 $6 $7 $8" 2>&1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
# Run the tests
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
go StateTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
go EchoTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
go CloseTest
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
# Re-run StateTest with a SecurityManager set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
# Note that the system properties are arguments to StateTest and not options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
# These system properties are passed to the launched service as options:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
#   java [-options] class [args...]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
go StateTest -Djava.security.manager -Djava.security.policy=${TESTSRC}/java.policy.pass
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
go StateTest -expectFail -Djava.security.manager -Djava.security.policy=${TESTSRC}/java.policy.fail
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
# Results
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
#
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
echo ''
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
if [ $failures -gt 0 ];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  then echo "$failures test(s) failed";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  else echo "All test(s) passed"; fi
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
exit $failures