1 #!/bin/sh 2 3 # 4 # Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 5 # Copyright (c) 2018 Red Hat, Inc. All rights reserved. 6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7 # 8 # This code is free software; you can redistribute it and/or modify it 9 # under the terms of the GNU General Public License version 2 only, as 10 # published by the Free Software Foundation. 11 # 12 # This code is distributed in the hope that it will be useful, but WITHOUT 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 # version 2 for more details (a copy is included in the LICENSE file that 16 # accompanied this code). 17 # 18 # You should have received a copy of the GNU General Public License version 19 # 2 along with this work; if not, write to the Free Software Foundation, 20 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21 # 22 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23 # or visit www.oracle.com if you need additional information or have any 24 # questions. 25 # 26 27 ## 28 ## @test 29 ## @bug 8165673 30 ## @summary regression test for passing float args to a jni function. 31 ## @run shell/timeout=30 TestFloatJNIArgs.sh 32 ## 33 34 if [ "${TESTSRC}" = "" ] 35 then 36 TESTSRC=${PWD} 37 echo "TESTSRC not set. Using "${TESTSRC}" as default" 38 fi 39 echo "TESTSRC=${TESTSRC}" 40 ## Adding common setup Variables for running shell tests. 41 . ${TESTSRC}/../../../test_env.sh 42 43 # set platform-dependent variables 44 if [ $VM_OS == "linux" -a $VM_CPU == "aarch64" ]; then 45 echo "Testing on linux-aarch64" 46 gcc_cmd=`which gcc` 47 if [ "x$gcc_cmd" == "x" ]; then 48 echo "WARNING: gcc not found. Cannot execute test." 2>&1 49 exit 0; 50 fi 51 else 52 echo "Test passed; only valid for linux-aarch64" 53 exit 0; 54 fi 55 56 THIS_DIR=. 57 58 cp ${TESTSRC}${FS}*.java ${THIS_DIR} 59 ${TESTJAVA}${FS}bin${FS}javac *.java 60 61 $gcc_cmd -O1 -DLINUX -fPIC -shared \ 62 -o ${THIS_DIR}${FS}libTestFloatJNIArgs.so \ 63 -I${TESTJAVA}${FS}include \ 64 -I${TESTJAVA}${FS}include${FS}linux \ 65 ${TESTSRC}${FS}libTestFloatJNIArgs.c 66 67 # run the java test in the background 68 cmd="${TESTJAVA}${FS}bin${FS}java -Xint \ 69 -Djava.library.path=${THIS_DIR}${FS} TestFloatJNIArgs" 70 71 echo "$cmd" 72 eval $cmd 73 74 if [ $? -ne 0 ] 75 then 76 echo "Test Failed" 77 exit 1 78 fi 79 80 cmd="${TESTJAVA}${FS}bin${FS}java -XX:+TieredCompilation -Xcomp \ 81 -Djava.library.path=${THIS_DIR}${FS} TestFloatJNIArgs" 82 83 echo "$cmd" 84 eval $cmd 85 86 if [ $? -ne 0 ] 87 then 88 echo "Test Failed" 89 exit 1 90 fi 91 92 cmd="${TESTJAVA}${FS}bin${FS}java -XX:-TieredCompilation -Xcomp \ 93 -Djava.library.path=${THIS_DIR}${FS} TestFloatJNIArgs" 94 95 echo "$cmd" 96 eval $cmd 97 98 if [ $? -ne 0 ] 99 then 100 echo "Test Failed" 101 exit 1 102 fi 103 104 echo "Test Passed" 105 exit 0