--- /dev/null Thu Feb 23 20:40:44 2012 +++ new/test/compiler/7145024/Test7145024.sh Thu Feb 23 20:40:44 2012 @@ -0,0 +1,133 @@ +#!/bin/sh +# +# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# For now this is constructed as a manual test since there's no guarantee that a +# C compiler is available in the test environment + +## +## @test Test7145024.sh +## @bug 7145024 +## @summary Crashes in ucrypto related to C2 +## @run shell/manual Test7145024.sh +## + +if [ "${TESTSRC}" = "" ] +then TESTSRC=. +fi + +if [ "${TESTJAVA}" = "" ] +then + PARENT=`dirname \`which java\`` + TESTJAVA=`dirname ${PARENT}` + echo "TESTJAVA not set, selecting " ${TESTJAVA} + echo "If this is incorrect, try setting the variable manually." +fi + +# set platform-dependent variables +OS=`uname -s` +case "$OS" in + *BSD) + FS="/" + CC=gcc + CFLAGS="-fPIC -shared" + ;; + Linux) + FS="/" + CC=gcc + CFLAGS="-fPIC -shared" + OS=linux + ;; + SunOS) + FS="/" + CC=cc + CFLAGS="-G -KPIC" + OS=solaris + COMPILE64=-m64 + ;; + Windows_*) + FS="\\" + echo "Test passed; not currently valid on Windows" + exit 0; + ;; + * ) + echo "Unrecognized system!" + exit 1; + ;; +esac + + + +LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH + +THIS_DIR=`pwd` + +cp ${TESTSRC}${FS}Generate.java ${THIS_DIR} + +set -e + +${TESTJAVA}${FS}bin${FS}java -fullversion + +${TESTJAVA}${FS}bin${FS}javac Generate.java +${TESTJAVA}${FS}bin${FS}java Generate +${TESTJAVA}${FS}bin${FS}javac JNITest.java +${TESTJAVA}${FS}bin${FS}javah JNITest + +if [ "${COMPILE64}" != "" ]; then + $CC ${COMPILE64} -g ${CFLAGS} -o libjnitest.so -I${TESTJAVA}/include -I${TESTJAVA}/include/$OS JNITest.c + ${TESTJAVA}${FS}bin${FS}java -d64 JNITest + exitcode=$? + if [ $exitcode -ne 0 ]; then + exit $exitcode + fi +fi + +$CC -g ${CFLAGS} -o libjnitest.so -I${TESTJAVA}/include -I${TESTJAVA}/include/$OS JNITest.c + +EXTRA_OPTS="-XX:+IgnoreUnrecognizedVMOptions" + +${TESTJAVA}${FS}bin${FS}java -server ${EXTRA_OPTS} JNITest +exitcode=$? +if [ $exitcode -ne 0 ]; then + exit $exitcode +fi + +${TESTJAVA}${FS}bin${FS}java -client ${EXTRA_OPTS} -XX:UseSSE=1 JNITest +exitcode=$? +if [ $exitcode -ne 0 ]; then + exit $exitcode +fi +${TESTJAVA}${FS}bin${FS}java -client ${EXTRA_OPTS} -XX:UseSSE=0 JNITest +exitcode=$? +if [ $exitcode -ne 0 ]; then + exit $exitcode +fi + +${TESTJAVA}${FS}bin${FS}java -client ${EXTRA_OPTS} JNITest +exitcode=$? +if [ $exitcode -ne 0 ]; then + exit $exitcode +fi + +exit $?