Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/7107135/Test7107135.sh
32284 views
#!/bin/sh12#3# Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.4# Copyright (c) 2011 SAP AG. All Rights Reserved.5# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.6#7# This code is free software; you can redistribute it and/or modify it8# under the terms of the GNU General Public License version 2 only, as9# published by the Free Software Foundation.10#11# This code is distributed in the hope that it will be useful, but WITHOUT12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License14# version 2 for more details (a copy is included in the LICENSE file that15# accompanied this code).16#17# You should have received a copy of the GNU General Public License version18# 2 along with this work; if not, write to the Free Software Foundation,19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.20#21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA22# or visit www.oracle.com if you need additional information or have any23# questions.24#2526##27## @test Test7107135.sh28## @bug 710713529## @bug 802129630## @summary Stack guard pages lost after loading library with executable stack.31## @run shell Test7107135.sh32##3334if [ "${TESTSRC}" = "" ]35then36TESTSRC=${PWD}37echo "TESTSRC not set. Using "${TESTSRC}" as default"38fi39echo "TESTSRC=${TESTSRC}"40## Adding common setup Variables for running shell tests.41. ${TESTSRC}/../../test_env.sh4243# set platform-dependent variables44OS=`uname -s`45case "$OS" in46Linux)47echo "Testing on Linux"48gcc_cmd=`which gcc`49if [ "x$gcc_cmd" == "x" ]; then50echo "WARNING: gcc not found. Cannot execute test." 2>&151exit 0;52fi53;;54*)55echo "Test passed; only valid for Linux"56exit 0;57;;58esac5960ARCH=`uname -m`6162THIS_DIR=.6364cp ${TESTSRC}${FS}*.java ${THIS_DIR}65${TESTJAVA}${FS}bin${FS}javac *.java6667$gcc_cmd -fPIC -shared -c -o test.o \68-I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \69${TESTSRC}${FS}test.c7071ld -shared -z execstack -o libtest-rwx.so test.o72ld -shared -z noexecstack -o libtest-rw.so test.o737475LD_LIBRARY_PATH=${THIS_DIR}76echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH}77export LD_LIBRARY_PATH7879# This should not fail.80echo Check testprogram. Expected to pass:81echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw82${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rw8384echo85echo Test changing of stack protection:86echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx87${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} Test test-rwx88JAVA_RETVAL=$?8990if [ "$JAVA_RETVAL" == "0" ]91then92echo93echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx94${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} TestMT test-rwx95JAVA_RETVAL=$?96fi9798exit $JAVA_RETVAL99100101