2007-12-01 00:00:00 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
2012-11-02 15:50:11 +00:00
|
|
|
# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
2010-05-25 22:58:33 +00:00
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
2007-12-01 00:00:00 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2010-07-22 00:01:31 +00:00
|
|
|
# Common setup for tool tests and other tests that use jtools.
|
2007-12-01 00:00:00 +00:00
|
|
|
# Checks that TESTJAVA, TESTSRC, and TESTCLASSES environment variables are set.
|
2010-07-22 00:01:31 +00:00
|
|
|
#
|
|
|
|
# Creates the following constants for use by the caller:
|
|
|
|
# JAVA - java launcher
|
|
|
|
# JHAT - jhat utility
|
|
|
|
# JINFO - jinfo utility
|
|
|
|
# JMAP - jmap utility
|
|
|
|
# JPS - jps utility
|
|
|
|
# JSTACK - jstack utility
|
2012-01-04 11:49:35 +00:00
|
|
|
# JCMD - jcmd utility
|
2010-07-22 00:01:31 +00:00
|
|
|
# OS - operating system name
|
|
|
|
# PATTERN_EOL - grep or sed end-of-line pattern
|
|
|
|
# PATTERN_WS - grep or sed whitespace pattern
|
|
|
|
# PS - path separator (";" or ":")
|
|
|
|
#
|
|
|
|
# Sets the following variables:
|
|
|
|
#
|
|
|
|
# isCygwin - true if environment is Cygwin
|
|
|
|
# isMKS - true if environment is MKS
|
|
|
|
# isLinux - true if OS is Linux
|
|
|
|
# isSolaris - true if OS is Solaris
|
|
|
|
# isWindows - true if OS is Windows
|
2012-03-06 20:34:38 +00:00
|
|
|
# isMacos - true if OS is Macos X
|
2014-01-17 20:54:30 +00:00
|
|
|
# isAIX - true if OS is AIX
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
|
2010-07-22 00:01:31 +00:00
|
|
|
if [ -z "${TESTJAVA}" ]; then
|
|
|
|
echo "ERROR: TESTJAVA not set. Test cannot execute. Failed."
|
2007-12-01 00:00:00 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-07-22 00:01:31 +00:00
|
|
|
|
|
|
|
if [ -z "${TESTSRC}" ]; then
|
|
|
|
echo "ERROR: TESTSRC not set. Test cannot execute. Failed."
|
2007-12-01 00:00:00 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-07-22 00:01:31 +00:00
|
|
|
|
|
|
|
if [ -z "${TESTCLASSES}" ]; then
|
|
|
|
echo "ERROR: TESTCLASSES not set. Test cannot execute. Failed."
|
2007-12-01 00:00:00 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2010-07-22 00:01:31 +00:00
|
|
|
|
|
|
|
# only enable these after checking the expected incoming env variables
|
|
|
|
set -eu
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
JAVA="${TESTJAVA}/bin/java"
|
|
|
|
JHAT="${TESTJAVA}/bin/jhat"
|
2010-07-22 00:01:31 +00:00
|
|
|
JINFO="${TESTJAVA}/bin/jinfo"
|
|
|
|
JMAP="${TESTJAVA}/bin/jmap"
|
|
|
|
JPS="${TESTJAVA}/bin/jps"
|
|
|
|
JSTACK="${TESTJAVA}/bin/jstack"
|
2012-01-04 11:49:35 +00:00
|
|
|
JCMD="${TESTJAVA}/bin/jcmd"
|
2010-07-22 00:01:31 +00:00
|
|
|
|
|
|
|
isCygwin=false
|
|
|
|
isMKS=false
|
|
|
|
isLinux=false
|
|
|
|
isSolaris=false
|
|
|
|
isUnknownOS=false
|
|
|
|
isWindows=false
|
2012-03-06 20:34:38 +00:00
|
|
|
isMacos=false
|
2014-01-17 20:54:30 +00:00
|
|
|
isAIX=false
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
OS=`uname -s`
|
|
|
|
|
2010-07-22 00:01:31 +00:00
|
|
|
# start with some UNIX like defaults
|
|
|
|
PATTERN_EOL='$'
|
|
|
|
# blank and tab
|
|
|
|
PATTERN_WS='[ ]'
|
|
|
|
PS=":"
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
case "$OS" in
|
2010-01-04 23:56:42 +00:00
|
|
|
CYGWIN* )
|
|
|
|
OS="Windows"
|
2010-07-22 00:01:31 +00:00
|
|
|
PATTERN_EOL='[
]*$'
|
|
|
|
# blank and tab
|
|
|
|
PATTERN_WS='[ \t]'
|
2010-01-04 23:56:42 +00:00
|
|
|
isCygwin=true
|
2010-07-22 00:01:31 +00:00
|
|
|
isWindows=true
|
|
|
|
;;
|
|
|
|
Linux )
|
|
|
|
OS="Linux"
|
|
|
|
isLinux=true
|
|
|
|
;;
|
2012-03-06 20:34:38 +00:00
|
|
|
Darwin )
|
|
|
|
OS="Mac OS X"
|
|
|
|
isMacos=true
|
|
|
|
;;
|
2010-07-22 00:01:31 +00:00
|
|
|
SunOS )
|
|
|
|
OS="Solaris"
|
|
|
|
isSolaris=true
|
|
|
|
;;
|
2014-01-17 20:54:30 +00:00
|
|
|
AIX )
|
|
|
|
OS="AIX"
|
|
|
|
isAIX=true
|
|
|
|
;;
|
2010-07-22 00:01:31 +00:00
|
|
|
Windows* )
|
|
|
|
OS="Windows"
|
|
|
|
PATTERN_EOL='[
]*$'
|
|
|
|
PS=";"
|
|
|
|
isWindows=true
|
2010-01-04 23:56:42 +00:00
|
|
|
;;
|
2007-12-01 00:00:00 +00:00
|
|
|
* )
|
2010-07-22 00:01:31 +00:00
|
|
|
isUnknownOS=true
|
2007-12-01 00:00:00 +00:00
|
|
|
;;
|
|
|
|
esac
|