1 #!/bin/sh 2 3 # Copyright (c) 2012, 2018, 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 # @key headful 26 # @bug 7190587 27 # @summary Tests Java AWT native interface library 28 # @author kshefov 29 # @run shell JAWT.sh 30 31 # NB: To run on Windows with MKS and Visual Studio compiler 32 # add the following options to jtreg: -e INCLUDE="%INCLUDE%;." -e LIB="%LIB%;." 33 34 if [ "${TESTSRC}" = "" ] 35 then TESTSRC=. 36 fi 37 38 if [ "${TESTJAVA}" = "" ] 39 then 40 PARENT=`dirname \`which java\`` 41 TESTJAVA=`dirname ${PARENT}` 42 echo "TESTJAVA not set, selecting " ${TESTJAVA} 43 echo "If this is incorrect, try setting the variable manually." 44 fi 45 46 # set platform-dependent variables 47 OS=`uname -s` 48 case "$OS" in 49 Linux ) 50 NULL=/dev/null 51 PS=":" 52 FS="/" 53 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 54 if [ $? -eq '0' ] 55 then 56 ARCH="amd64" 57 else 58 ARCH="i386" 59 fi 60 SYST="linux" 61 MAKEFILE="Makefile.unix" 62 CC="gcc" 63 MAKE="make" 64 LD_LIBRARY_PATH="." 65 ;; 66 AIX ) 67 echo "Test passed. Not supported on AIX." 68 exit 0 69 ;; 70 SunOS ) 71 NULL=/dev/null 72 PS=":" 73 FS="/" 74 if [ `uname -p | grep -c 'sparc'` -gt '0' ] 75 then 76 ARCH="sparc" 77 else 78 ARCH="i386" 79 fi 80 SYST="solaris" 81 MAKEFILE="Makefile.unix" 82 CC="gcc" 83 MAKE="make" 84 LD_LIBRARY_PATH="." 85 ;; 86 Windows* ) 87 NULL=null 88 PS=";" 89 FS="\\" 90 MAKEFILE="Makefile.win" 91 CC="cl" 92 MAKE="nmake" 93 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 94 if [ "$?" -eq '0' ] 95 then 96 ARCH="amd64" 97 else 98 ARCH="i386" 99 fi 100 SYST="windows" 101 ;; 102 CYGWIN* ) 103 NULL=/dev/null 104 PS=":" 105 FS="/" 106 MAKEFILE="Makefile.cygwin" 107 CC="gcc" 108 ${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL 109 if [ "$?" -eq '0' ] 110 then 111 ARCH="amd64" 112 else 113 ARCH="i386" 114 fi 115 SYST="cygwin" 116 MAKE="make" 117 ;; 118 Darwin ) 119 echo "Test passed. This test is not for MacOS." 120 exit 0; 121 ;; 122 * ) 123 echo "Unrecognized system!" 124 exit 1; 125 ;; 126 esac 127 128 # Skip unsupported platforms 129 case `uname -m` in 130 arm* | ppc* | s390* ) 131 echo "Test passed. Not supported on current architecture." 132 exit 0 133 ;; 134 esac 135 136 echo "OS-ARCH is" ${SYST}-${ARCH} 137 ${TESTJAVA}${FS}bin${FS}java -fullversion 2>&1 138 139 which ${MAKE} >${NULL} 2>&1 140 if [ "$?" -ne '0' ] 141 then 142 echo "No make found. Test passed." 143 exit 0 144 fi 145 146 which ${CC} >${NULL} 2>&1 147 if [ "$?" -ne '0' ] 148 then 149 echo "No C compiler found. Test passed." 150 exit 0 151 fi 152 case "$OS" in 153 SunOS ) 154 ${CC} -v >${NULL} 2>&1 155 if [ "$?" -ne '0' ] 156 then 157 echo "No C compiler found. Test passed." 158 exit 0 159 fi 160 esac 161 162 cp ${TESTSRC}${FS}${MAKEFILE} . 163 164 JAVA=${TESTJAVA}${FS}bin${FS}java 165 JAVAC=${TESTJAVA}${FS}bin${FS}javac 166 167 export CC SYST ARCH LD_LIBRARY_PATH 168 169 ${JAVAC} -d . -h . ${TESTSRC}${FS}MyCanvas.java 170 ${MAKE} -f ${MAKEFILE} 171 ${JAVA} ${TESTVMOPTS} -classpath . MyCanvas 172 173 exit $? 174