Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/runtime/StackGap/testme.sh
32284 views
# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.1# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2#3# This code is free software; you can redistribute it and/or modify it4# under the terms of the GNU General Public License version 2 only, as5# published by the Free Software Foundation.6#7# This code is distributed in the hope that it will be useful, but WITHOUT8# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or9# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License10# version 2 for more details (a copy is included in the LICENSE file that11# accompanied this code).12#13# You should have received a copy of the GNU General Public License version14# 2 along with this work; if not, write to the Free Software Foundation,15# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.16#17# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA18# or visit www.oracle.com if you need additional information or have any19# questions.20#!/bin/sh2122#23# @test testme.sh24# @bug 819742925# @summary Linux kernel stack guard should not cause segfaults on x86-3226# @compile T.java27# @run shell testme.sh28#2930if [ "${TESTSRC}" = "" ]31then32TESTSRC=${PWD}33echo "TESTSRC not set. Using "${TESTSRC}" as default"34fi35echo "TESTSRC=${TESTSRC}"36## Adding common setup Variables for running shell tests.37. ${TESTSRC}/../../test_env.sh3839if [ "${VM_OS}" != "linux" ]40then41echo "Test only valid for Linux"42exit 043fi4445gcc_cmd=`which gcc`46if [ "x$gcc_cmd" = "x" ]; then47echo "WARNING: gcc not found. Cannot execute test." 2>&148exit 0;49fi5051CFLAGS="-m${VM_BITS}"5253LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH54export LD_LIBRARY_PATH5556cp ${TESTSRC}${FS}exestack-gap.c .5758# Copy the result of our @compile action:59cp ${TESTCLASSES}${FS}T.class .6061echo "Compilation flag: ${COMP_FLAG}"62# Note pthread may not be found thus invoke creation will fail to be created.63# Check to ensure you have a /usr/lib/libpthread.so if you don't please look64# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.6566$gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \67-I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \68-L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \69exestack-gap.c \70-ljvm -lpthread7172./stack-gap || exit $?73./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $?747576