Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
38821 views
#1# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#2223#24# @test25# @bug 498212826# @summary Test low memory detection of non-heap memory pool27# @requires vm.gc=="null"28# @run build LowMemoryTest2 MemoryUtil29# @run shell/timeout=600 LowMemoryTest2.sh30#3132if [ ! -z "${TESTJAVA}" ] ; then33JAVA=${TESTJAVA}/bin/java34CLASSPATH=${TESTCLASSES}35export CLASSPATH36else37echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."38exit 139fi4041# Test execution4243failures=04445go() {46echo ''47sh -xc "$JAVA $TESTVMOPTS $*" 2>&148if [ $? != 0 ]; then failures=`expr $failures + 1`; fi49}5051# Run test with each GC configuration52#53# Notes: To ensure that metaspace fills up we disable class unloading.54# Also we set the max metaspace to 8MB - otherwise the test takes too55# long to run.5657go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseSerialGC LowMemoryTest258go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParallelGC LowMemoryTest259go -noclassgc -XX:MaxMetaspaceSize=16m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC LowMemoryTest26061# Test class metaspace - might hit MaxMetaspaceSize instead if62# UseCompressedClassPointers is off or if 32 bit.63go -noclassgc -XX:MaxMetaspaceSize=16m -XX:CompressedClassSpaceSize=4m LowMemoryTest26465echo ''66if [ $failures -gt 0 ];67then echo "$failures test(s) failed";68else echo "All test(s) passed"; fi69exit $failures7071727374