Path: blob/master/test/jdk/java/awt/JAWT/JAWT.sh
41149 views
#!/bin/sh12# Copyright (c) 2012, 2020, 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# @key headful25# @bug 719058726# @summary Tests Java AWT native interface library27# @author kshefov28# @run shell JAWT.sh2930# NB: To run on Windows with MKS and Visual Studio compiler31# add the following options to jtreg: -e INCLUDE="%INCLUDE%;." -e LIB="%LIB%;."3233if [ "${TESTSRC}" = "" ]34then TESTSRC=.35fi3637if [ "${TESTJAVA}" = "" ]38then39PARENT=`dirname \`which java\``40TESTJAVA=`dirname ${PARENT}`41echo "TESTJAVA not set, selecting " ${TESTJAVA}42echo "If this is incorrect, try setting the variable manually."43fi4445# set platform-dependent variables46OS=`uname -s`47case "$OS" in48Linux )49NULL=/dev/null50PS=":"51FS="/"52${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL53if [ $? -eq '0' ]54then55ARCH="amd64"56else57ARCH="i386"58fi59SYST="linux"60MAKEFILE="Makefile.unix"61CC="gcc"62MAKE="make"63LD_LIBRARY_PATH="."64;;65AIX )66echo "Test passed. Not supported on AIX."67exit 068;;69Windows* )70NULL=null71PS=";"72FS="\\"73MAKEFILE="Makefile.win"74CC="cl"75MAKE="nmake"76${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL77if [ "$?" -eq '0' ]78then79ARCH="amd64"80else81ARCH="i386"82fi83SYST="windows"84;;85CYGWIN* )86NULL=/dev/null87PS=":"88FS="/"89MAKEFILE="Makefile.cygwin"90CC="gcc"91${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL92if [ "$?" -eq '0' ]93then94ARCH="amd64"95else96ARCH="i386"97fi98SYST="cygwin"99MAKE="make"100;;101Darwin )102echo "Test passed. This test is not for MacOS."103exit 0;104;;105* )106echo "Unrecognized system!"107exit 1;108;;109esac110111# Skip unsupported platforms112case `uname -m` in113arm* | ppc* | s390* )114echo "Test passed. Not supported on current architecture."115exit 0116;;117esac118119echo "OS-ARCH is" ${SYST}-${ARCH}120${TESTJAVA}${FS}bin${FS}java -fullversion 2>&1121122which ${MAKE} >${NULL} 2>&1123if [ "$?" -ne '0' ]124then125echo "No make found. Test passed."126exit 0127fi128129which ${CC} >${NULL} 2>&1130if [ "$?" -ne '0' ]131then132echo "No C compiler found. Test passed."133exit 0134fi135136cp ${TESTSRC}${FS}${MAKEFILE} .137138JAVA=${TESTJAVA}${FS}bin${FS}java139JAVAC=${TESTJAVA}${FS}bin${FS}javac140141export CC SYST ARCH LD_LIBRARY_PATH142143${JAVAC} -d . -h . ${TESTSRC}${FS}MyCanvas.java144${MAKE} -f ${MAKEFILE}145${JAVA} ${TESTVMOPTS} -classpath . MyCanvas146147exit $?148149150151