Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/awt/JAWT/JAWT.sh
48437 views
#!/bin/sh12# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4#5# This code is free software; you can redistribute it and/or modify it6# under the terms of the GNU General Public License version 2 only, as7# published by the Free Software Foundation.8#9# This code is distributed in the hope that it will be useful, but WITHOUT10# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12# version 2 for more details (a copy is included in the LICENSE file that13# accompanied this code).14#15# You should have received a copy of the GNU General Public License version16# 2 along with this work; if not, write to the Free Software Foundation,17# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18#19# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20# or visit www.oracle.com if you need additional information or have any21# questions.2223# @test JAWT.sh24# @bug 719058725# @summary Tests Java AWT native interface library26# @author kshefov27# @run shell JAWT.sh2829# NB: To run on Windows with MKS and Visual Studio compiler30# add the following options to jtreg: -e INCLUDE="%INCLUDE%;." -e LIB="%LIB%;."3132if [ "${TESTSRC}" = "" ]33then TESTSRC=.34fi3536if [ "${TESTJAVA}" = "" ]37then38PARENT=`dirname \`which java\``39TESTJAVA=`dirname ${PARENT}`40echo "TESTJAVA not set, selecting " ${TESTJAVA}41echo "If this is incorrect, try setting the variable manually."42fi4344# set platform-dependent variables45OS=`uname -s`46case "$OS" in47Linux )48NULL=/dev/null49PS=":"50FS="/"51${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL52if [ $? -eq '0' ]53then54ARCH="amd64"55else56ARCH="i386"57fi58SYST="linux"59MAKEFILE="Makefile.unix"60CC="gcc"61MAKE="make"62LD_LIBRARY_PATH="."63;;64SunOS )65NULL=/dev/null66PS=":"67FS="/"68if [ `uname -p | grep -c 'sparc'` -gt '0' ]69then70ARCH="sparc"71else72ARCH="i386"73fi74SYST="solaris"75MAKEFILE="Makefile.unix"76CC="gcc"77MAKE="make"78LD_LIBRARY_PATH="."79;;80Windows* )81NULL=null82PS=";"83FS="\\"84MAKEFILE="Makefile.win"85CC="cl"86MAKE="nmake"87${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL88if [ "$?" -eq '0' ]89then90ARCH="amd64"91else92ARCH="i386"93fi94SYST="windows"95;;96CYGWIN* )97NULL=/dev/null98PS=":"99FS="/"100MAKEFILE="Makefile.cygwin"101CC="gcc"102${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL103if [ "$?" -eq '0' ]104then105ARCH="amd64"106else107ARCH="i386"108fi109SYST="cygwin"110MAKE="make"111;;112Darwin )113echo "Test passed. This test is not for MacOS."114exit 0;115;;116* )117echo "Unrecognized system!"118exit 1;119;;120esac121122# Skip unsupported platforms123case `uname -m` in124arm* | ppc* )125echo "Test passed. Not supported on current architecture."126exit 0127;;128esac129130echo "OS-ARCH is" ${SYST}-${ARCH}131${TESTJAVA}${FS}jre${FS}bin${FS}java -fullversion 2>&1132133which ${MAKE} >${NULL} 2>&1134if [ "$?" -ne '0' ]135then136echo "No make found. Test passed."137exit 0138fi139140which ${CC} >${NULL} 2>&1141if [ "$?" -ne '0' ]142then143echo "No C compiler found. Test passed."144exit 0145fi146case "$OS" in147SunOS )148${CC} -v >${NULL} 2>&1149if [ "$?" -ne '0' ]150then151echo "No C compiler found. Test passed."152exit 0153fi154esac155156cp ${TESTSRC}${FS}${MAKEFILE} .157158JAVA=${TESTJAVA}${FS}jre${FS}bin${FS}java159JAVAC=${TESTJAVA}${FS}bin${FS}javac160JAVAH=${TESTJAVA}${FS}bin${FS}javah161162export CC SYST ARCH LD_LIBRARY_PATH163164${JAVAC} -d . ${TESTSRC}${FS}MyCanvas.java165${JAVAH} -jni -classpath . -d . MyCanvas166${MAKE} -f ${MAKEFILE}167${JAVA} -classpath . MyCanvas168169exit $?170171172173