17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 27 # Common setup for tool tests and other tests that use jtools. 28 # Checks that TESTJAVA, TESTSRC, and TESTCLASSES environment variables are set. 29 # 30 # Creates the following constants for use by the caller: 31 # JAVA - java launcher 32 # JHAT - jhat utility 33 # JINFO - jinfo utility 34 # JMAP - jmap utility 35 # JPS - jps utility 36 # JSTACK - jstack utility 37 # OS - operating system name 38 # PATTERN_EOL - grep or sed end-of-line pattern 39 # PATTERN_WS - grep or sed whitespace pattern 40 # PS - path separator (";" or ":") 41 # 42 # Sets the following variables: 43 # 44 # isCygwin - true if environment is Cygwin 45 # isMKS - true if environment is MKS 46 # isLinux - true if OS is Linux 47 # isSolaris - true if OS is Solaris 48 # isWindows - true if OS is Windows 49 50 51 if [ -z "${TESTJAVA}" ]; then 52 echo "ERROR: TESTJAVA not set. Test cannot execute. Failed." 53 exit 1 54 fi 55 56 if [ -z "${TESTSRC}" ]; then 57 echo "ERROR: TESTSRC not set. Test cannot execute. Failed." 58 exit 1 59 fi 60 61 if [ -z "${TESTCLASSES}" ]; then 62 echo "ERROR: TESTCLASSES not set. Test cannot execute. Failed." 63 exit 1 64 fi 65 66 # only enable these after checking the expected incoming env variables 67 set -eu 68 69 JAVA="${TESTJAVA}/bin/java" 70 JHAT="${TESTJAVA}/bin/jhat" 71 JINFO="${TESTJAVA}/bin/jinfo" 72 JMAP="${TESTJAVA}/bin/jmap" 73 JPS="${TESTJAVA}/bin/jps" 74 JSTACK="${TESTJAVA}/bin/jstack" 75 76 isCygwin=false 77 isMKS=false 78 isLinux=false 79 isSolaris=false 80 isUnknownOS=false 81 isWindows=false 82 83 OS=`uname -s` 84 85 # start with some UNIX like defaults 86 PATTERN_EOL='$' 87 # blank and tab 88 PATTERN_WS='[ ]' 89 PS=":" 90 91 case "$OS" in 92 CYGWIN* ) 93 OS="Windows" 94 PATTERN_EOL='[ ]*$' | 17 # You should have received a copy of the GNU General Public License version 18 # 2 along with this work; if not, write to the Free Software Foundation, 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 # 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 # or visit www.oracle.com if you need additional information or have any 23 # questions. 24 # 25 26 27 # Common setup for tool tests and other tests that use jtools. 28 # Checks that TESTJAVA, TESTSRC, and TESTCLASSES environment variables are set. 29 # 30 # Creates the following constants for use by the caller: 31 # JAVA - java launcher 32 # JHAT - jhat utility 33 # JINFO - jinfo utility 34 # JMAP - jmap utility 35 # JPS - jps utility 36 # JSTACK - jstack utility 37 # JCMD - jcmd utility 38 # OS - operating system name 39 # PATTERN_EOL - grep or sed end-of-line pattern 40 # PATTERN_WS - grep or sed whitespace pattern 41 # PS - path separator (";" or ":") 42 # 43 # Sets the following variables: 44 # 45 # isCygwin - true if environment is Cygwin 46 # isMKS - true if environment is MKS 47 # isLinux - true if OS is Linux 48 # isSolaris - true if OS is Solaris 49 # isWindows - true if OS is Windows 50 51 52 if [ -z "${TESTJAVA}" ]; then 53 echo "ERROR: TESTJAVA not set. Test cannot execute. Failed." 54 exit 1 55 fi 56 57 if [ -z "${TESTSRC}" ]; then 58 echo "ERROR: TESTSRC not set. Test cannot execute. Failed." 59 exit 1 60 fi 61 62 if [ -z "${TESTCLASSES}" ]; then 63 echo "ERROR: TESTCLASSES not set. Test cannot execute. Failed." 64 exit 1 65 fi 66 67 # only enable these after checking the expected incoming env variables 68 set -eu 69 70 JAVA="${TESTJAVA}/bin/java" 71 JHAT="${TESTJAVA}/bin/jhat" 72 JINFO="${TESTJAVA}/bin/jinfo" 73 JMAP="${TESTJAVA}/bin/jmap" 74 JPS="${TESTJAVA}/bin/jps" 75 JSTACK="${TESTJAVA}/bin/jstack" 76 JCMD="${TESTJAVA}/bin/jcmd" 77 78 isCygwin=false 79 isMKS=false 80 isLinux=false 81 isSolaris=false 82 isUnknownOS=false 83 isWindows=false 84 85 OS=`uname -s` 86 87 # start with some UNIX like defaults 88 PATTERN_EOL='$' 89 # blank and tab 90 PATTERN_WS='[ ]' 91 PS=":" 92 93 case "$OS" in 94 CYGWIN* ) 95 OS="Windows" 96 PATTERN_EOL='[ ]*$' |