1 #!/bin/sh 2 3 # Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 # 6 # This code is free software; you can redistribute it and/or modify it 7 # under the terms of the GNU General Public License version 2 only, as 8 # published by the Free Software Foundation. 9 # 10 # This code is distributed in the hope that it will be useful, but WITHOUT 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 # version 2 for more details (a copy is included in the LICENSE file that 14 # accompanied this code). 15 # 16 # You should have received a copy of the GNU General Public License version 17 # 2 along with this work; if not, write to the Free Software Foundation, 18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 # 20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 # or visit www.oracle.com if you need additional information or have any 22 # questions. 23 24 # @test JAWT.sh 25 # @bug 7190587 26 # @summary Tests Java AWT native interface library 27 # @author kshefov 28 # @run shell JAWT.sh 29 30 # NB: To run on Windows with MKS and Visual Studio compiler 31 # add the following options to jtreg: -e INCLUDE="%INCLUDE%;." -e LIB="%LIB%;." 32 33 if [ "${TESTSRC}" = "" ] 34 then TESTSRC=. 35 fi 36 37 if [ "${TESTJAVA}" = "" ] 38 then 39 PARENT=`dirname \`which java\`` 40 TESTJAVA=`dirname ${PARENT}` 41 echo "TESTJAVA not set, selecting " ${TESTJAVA} 42 echo "If this is incorrect, try setting the variable manually." 43 fi 44 45 # set platform-dependent variables 46 OS=`uname -s` 47 case "$OS" in 48 Linux ) 49 NULL=/dev/null 50 PS=":" 51 FS="/" 52 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 53 if [ $? -eq '0' ] 54 then 55 ARCH="amd64" 56 else 57 ARCH="i386" 58 fi 59 SYST="linux" 60 MAKEFILE="Makefile.unix" 61 CC="gcc" 62 MAKE="make" 63 LD_LIBRARY_PATH="." 64 ;; 65 AIX ) 66 echo "Test passed. Not supported on AIX." 67 exit 0 68 ;; 69 SunOS ) 70 NULL=/dev/null 71 PS=":" 72 FS="/" 73 if [ `uname -p | grep -c 'sparc'` -gt '0' ] 74 then 75 ARCH="sparc" 76 else 77 ARCH="i386" 78 fi 79 SYST="solaris" 80 MAKEFILE="Makefile.unix" 81 CC="gcc" 82 MAKE="make" 83 LD_LIBRARY_PATH="." 84 ;; 85 Windows* ) 86 NULL=null 87 PS=";" 88 FS="\\" 89 MAKEFILE="Makefile.win" 90 CC="cl" 91 MAKE="nmake" 92 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 93 if [ "$?" -eq '0' ] 94 then 95 ARCH="amd64" 96 else 97 ARCH="i386" 98 fi 99 SYST="windows" 100 ;; 101 CYGWIN* ) 102 NULL=/dev/null 103 PS=":" 104 FS="/" 105 MAKEFILE="Makefile.cygwin" 106 CC="gcc" 107 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 108 if [ "$?" -eq '0' ] 109 then 110 ARCH="amd64" 111 else 112 ARCH="i386" 113 fi 114 SYST="cygwin" 115 MAKE="make" 116 ;; 117 Darwin ) 118 echo "Test passed. This test is not for MacOS." 119 exit 0; 120 ;; 121 * ) 122 echo "Unrecognized system!" 123 exit 1; 124 ;; 125 esac 126 127 # Skip unsupported platforms 128 case `uname -m` in 129 arm* | ppc* | s390* ) 130 echo "Test passed. Not supported on current architecture." 131 exit 0 132 ;; 133 esac 134 135 echo "OS-ARCH is" ${SYST}-${ARCH} 136 ${TESTJAVA}${FS}bin${FS}java -fullversion 2>&1 137 138 which ${MAKE} >${NULL} 2>&1 139 if [ "$?" -ne '0' ] 140 then 141 echo "No make found. Test passed." 142 exit 0 143 fi 144 145 which ${CC} >${NULL} 2>&1 146 if [ "$?" -ne '0' ] 147 then 148 echo "No C compiler found. Test passed." 149 exit 0 150 fi 151 case "$OS" in 152 SunOS ) 153 ${CC} -v >${NULL} 2>&1 154 if [ "$?" -ne '0' ] 155 then 156 echo "No C compiler found. Test passed." 157 exit 0 158 fi 159 esac 160 161 cp ${TESTSRC}${FS}${MAKEFILE} . 162 163 JAVA=${TESTJAVA}${FS}bin${FS}java 164 JAVAC=${TESTJAVA}${FS}bin${FS}javac 165 166 export CC SYST ARCH LD_LIBRARY_PATH 167 168 ${JAVAC} -d . -h . ${TESTSRC}${FS}MyCanvas.java 169 ${MAKE} -f ${MAKEFILE} 170 ${JAVA} ${TESTVMOPTS} -classpath . MyCanvas 171 172 exit $? 173