Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/test/gc/shenandoah/jni/TestPinnedGarbage.sh
32285 views
#!/bin/sh12#3# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.5#6# This code is free software; you can redistribute it and/or modify it7# under the terms of the GNU General Public License version 2 only, as8# published by the Free Software Foundation.9#10# This code is distributed in the hope that it will be useful, but WITHOUT11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13# version 2 for more details (a copy is included in the LICENSE file that14# accompanied this code).15#16# You should have received a copy of the GNU General Public License version17# 2 along with this work; if not, write to the Free Software Foundation,18# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19#20# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21# or visit www.oracle.com if you need additional information or have any22# questions.23#2425##26## @test27## @summary test Test that garbage in the pinned region does not crash VM28## @run shell/timeout=480 TestPinnedGarbage.sh29##3031if [ "${TESTSRC}" = "" ]32then33TESTSRC=${PWD}34echo "TESTSRC not set. Using "${TESTSRC}" as default"35fi36echo "TESTSRC=${TESTSRC}"37## Adding common setup Variables for running shell tests.38. ${TESTSRC}/../../../test_env.sh3940# set platform-dependent variables41if [ "$VM_OS" = "linux" ]; then42echo "Testing on linux"43gcc_cmd=`which gcc`44if [ "x$gcc_cmd" = "x" ]; then45echo "WARNING: gcc not found. Cannot execute test." 2>&146exit 0;47fi48else49echo "Test passed; only valid for linux: $VM_OS"50exit 0;51fi5253# Unfortunately, configurations cross-compiled to 32 bits would54# fail with bitness mismatch, when compiled with platform gcc.55# This would be fixed with /native support in JDK-8072842.56if [ "$VM_BITS" = "32" ]; then57echo "Test passed; only reliable on 64-bit"58exit 0;59fi6061THIS_DIR=.6263cp ${TESTSRC}${FS}*.java ${THIS_DIR}64${TESTJAVA}${FS}bin${FS}javac TestPinnedGarbage.java6566$gcc_cmd -O1 -DLINUX -fPIC -shared \67-o ${THIS_DIR}${FS}libTestPinnedGarbage.so \68-I${TESTJAVA}${FS}include \69-I${TESTJAVA}${FS}include${FS}linux \70${TESTSRC}${FS}libTestPinnedGarbage.c7172# run the java test in the background73cmd="${TESTJAVA}${FS}bin${FS}java -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahVerify -XX:+ShenandoahDegeneratedGC -XX:ShenandoahGCMode=passive \74-Djava.library.path=${THIS_DIR}${FS} TestPinnedGarbage"7576echo "$cmd"77eval $cmd7879if [ $? -ne 0 ]80then81echo "Test Failed"82exit 183fi8485cmd="${TESTJAVA}${FS}bin${FS}java -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahVerify -XX:-ShenandoahDegeneratedGC -XX:ShenandoahGCMode=passive \86-Djava.library.path=${THIS_DIR}${FS} TestPinnedGarbage"8788echo "$cmd"89eval $cmd9091if [ $? -ne 0 ]92then93echo "Test Failed"94exit 195fi9697cmd="${TESTJAVA}${FS}bin${FS}java -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahVerify \98-Djava.library.path=${THIS_DIR}${FS} TestPinnedGarbage"99100echo "$cmd"101eval $cmd102103if [ $? -ne 0 ]104then105echo "Test Failed"106exit 1107fi108109cmd="${TESTJAVA}${FS}bin${FS}java -Xmx128m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive \110-Djava.library.path=${THIS_DIR}${FS} TestPinnedGarbage"111112echo "$cmd"113eval $cmd114115if [ $? -ne 0 ]116then117echo "Test Failed"118exit 1119fi120121122