--- old/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestDescription.java 2020-01-24 17:51:14.000000000 -0800 +++ new/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/TestDescription.java 2020-01-24 17:51:14.000000000 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2020, 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 @@ -28,8 +28,27 @@ * @summary converted from VM Testbase metaspace/flags/maxMetaspaceSize. * * @library /vmTestbase /test/lib - * @run driver jdk.test.lib.FileInstaller . . * @build metaspace.flags.maxMetaspaceSize.maxMetaspaceSize - * @run shell maxMetaspaceSize.sh + * @run driver metaspace.flags.maxMetaspaceSize.TestDescription */ +package metaspace.flags.maxMetaspaceSize; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestDescription { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = + ProcessTools.createJavaProcessBuilder(true, "-XX:MaxMetaspaceSize=100m", + maxMetaspaceSize.class.getName()); + OutputAnalyzer out = new OutputAnalyzer(pb.start()); + + if (out.getExitValue() == 0) { + // test passed + return; + } else { + System.out.println("Non-zero exit value from child process. Could be OOM, which is OK"); + out.shouldContain("Out of Memory Error"); + } + } +} --- /dev/null 2020-01-24 17:51:15.000000000 -0800 +++ new/test/hotspot/jtreg/runtime/7162488/TestUnrecognizedVmOption.java 2020-01-24 17:51:15.000000000 -0800 @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2020, 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. + */ + +/* + * @test + * @bug 7162488 + * @summary VM should print unrecognized -XX option + * @library /test/lib + * @run driver TestUnrecognizedVmOption + */ +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class TestUnrecognizedVmOption { + static final String OPTION="this_is_not_an_option"; + + public static void main(String[] args) throws Exception { + ProcessBuilder pb = + ProcessTools.createJavaProcessBuilder(true, "-showversion", "-XX:" + OPTION); + (new OutputAnalyzer(pb.start())) + .shouldNotHaveExitValue(0) + .shouldContain("Unrecognized VM option") + .shouldContain(OPTION); + } +} --- /dev/null 2020-01-24 17:51:16.000000000 -0800 +++ new/test/hotspot/jtreg/runtime/StackGap/TestStackGap.java 2020-01-24 17:51:15.000000000 -0800 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, 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. + */ + +/* + * @test + * @summary Linux kernel stack guard should not cause segfaults on x86-32 + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @requires os.family == "linux" + * @compile T.java + * @run main/native TestStackGap + */ +import jdk.test.lib.process.OutputAnalyzer; + +public class TestStackGap { + public static void main(String args[]) throws Exception { + ProcessBuilder pb = new ProcessBuilder("stack-gap"); + (new OutputAnalyzer(pb.start())) + .shouldHaveExitValue(0); + + pb = new ProcessBuilder("stack-gap", "-XX:+DisablePrimordialThreadGuardPages"); + (new OutputAnalyzer(pb.start())) + .shouldHaveExitValue(0); + } +} + --- /dev/null 2020-01-24 17:51:16.000000000 -0800 +++ new/test/hotspot/jtreg/runtime/StackGuardPages/TestStackGuardPages.java 2020-01-24 17:51:16.000000000 -0800 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2020, 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. + */ + +/* + * @test + * @summary Stack guard pages should be installed correctly and removed when thread is detached + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @requires os.family == "linux" + * @compile DoOverflow.java + * @run main/native TestStackGuardPages + */ +import jdk.test.lib.process.OutputAnalyzer; + +public class TestStackGuardPages { + public static void main(String args[]) throws Exception { + ProcessBuilder pb = new ProcessBuilder("invoke", "test_java_overflow"); + (new OutputAnalyzer(pb.start())) + .shouldHaveExitValue(0); + + pb = new ProcessBuilder("invoke", "test_native_overflow"); + (new OutputAnalyzer(pb.start())) + .shouldHaveExitValue(0); + } +} + --- /dev/null 2020-01-24 17:51:17.000000000 -0800 +++ new/test/hotspot/jtreg/runtime/TLS/TestTLS.java 2020-01-24 17:51:17.000000000 -0800 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, Google Inc. All rights reserved. + * Copyright (c) 2019, 2020, 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. + */ + +/* + * @test + * @summary Test with extra TLS size. + * @modules java.base/jdk.internal.misc + * @library /test/lib + * @requires os.family == "linux" + * @compile T.java + * @run main/native TestTLS + */ +import jdk.test.lib.process.OutputAnalyzer; + +public class TestTLS { + public static void main(String args[]) throws Exception { + ProcessBuilder pb = new ProcessBuilder("stack-tls", "-add_tls"); + (new OutputAnalyzer(pb.start())) + .shouldHaveExitValue(0); + } +} + --- old/test/hotspot/jtreg/runtime/7162488/Test7162488.sh 2020-01-24 17:51:18.000000000 -0800 +++ /dev/null 2020-01-24 17:51:18.000000000 -0800 @@ -1,63 +0,0 @@ -# -# Copyright (c) 2012, 2014, 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. -# - - -# @test Test7162488.sh -# @bug 7162488 -# @summary VM not printing unknown -XX options -# @run shell Test7162488.sh -# - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -JAVA=${TESTJAVA}${FS}bin${FS}java - -# -# Just run with an option we are confident will not be recognized, -# and check for the message: -# -OPTION=this_is_not_an_option - -${JAVA} -showversion -XX:${OPTION} 2>&1 | grep "Unrecognized VM option" -if [ "$?" != "0" ] -then - printf "FAILED: option not flagged as unrecognized.\n" - exit 1 -fi - -${JAVA} -showversion -XX:${OPTION} 2>&1 | grep ${OPTION} -if [ "$?" != "0" ] -then - printf "FAILED: bad option not named as being bad.\n" - exit 1 -fi - -printf "Passed.\n" - --- old/test/hotspot/jtreg/runtime/StackGap/testme.sh 2020-01-24 17:51:18.000000000 -0800 +++ /dev/null 2020-01-24 17:51:18.000000000 -0800 @@ -1,49 +0,0 @@ -# Copyright (c) 2014, 2018, 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. -#!/bin/sh - -# -# @test testme.sh -# @summary Linux kernel stack guard should not cause segfaults on x86-32 -# @compile T.java -# @run shell testme.sh -# - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -if [ "${VM_OS}" != "linux" ] -then - echo "Test only valid for Linux" - exit 0 -fi - -LD_LIBRARY_PATH=.:${TESTJAVA}/lib/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH - -${TESTNATIVEPATH}/stack-gap || exit $? -${TESTNATIVEPATH}/stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $? --- old/test/hotspot/jtreg/runtime/StackGuardPages/testme.sh 2020-01-24 17:51:19.000000000 -0800 +++ /dev/null 2020-01-24 17:51:19.000000000 -0800 @@ -1,51 +0,0 @@ -# Copyright (c) 2014, 2016, 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. -#!/bin/sh - -# -# @test testme.sh -# @summary Stack guard pages should be installed correctly and removed when thread is detached -# @compile DoOverflow.java -# @run shell testme.sh -# - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -if [ "${VM_OS}" != "linux" ] -then - echo "Test only valid for Linux" - exit 0 -fi - -LD_LIBRARY_PATH=.:${TESTJAVA}/lib/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH - -# Run the test for a java and native overflow -${TESTNATIVEPATH}/invoke test_java_overflow -${TESTNATIVEPATH}/invoke test_native_overflow -exit $? --- old/test/hotspot/jtreg/runtime/TLS/testtls.sh 2020-01-24 17:51:19.000000000 -0800 +++ /dev/null 2020-01-24 17:51:20.000000000 -0800 @@ -1,52 +0,0 @@ -# Copyright (c) 2019, Google Inc. All rights reserved. -# Copyright (c) 2019, 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. -#!/bin/sh - -# -# @test testtls.sh -# @summary Test with extra TLS size. -# @requires os.family == "linux" -# @compile T.java -# @run shell testtls.sh -# - -if [ "${TESTSRC}" = "" ] -then - TESTSRC=${PWD} - echo "TESTSRC not set. Using "${TESTSRC}" as default" -fi -echo "TESTSRC=${TESTSRC}" -## Adding common setup Variables for running shell tests. -. ${TESTSRC}/../../test_env.sh - -LD_LIBRARY_PATH=.:${TESTJAVA}/lib/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH - -# Test 1) Run with stack size adjusted for TLS -${TESTNATIVEPATH}/stack-tls -add_tls || exit $? - -# Test 2) Run with no stack size adjustment and expect failure. -# -# Potential failures include StackOverflowError, thread creation failures, -# crashes, and etc. The test case can be used to demonstrate the TLS issue -# but is excluded from running in regular testing. -#${TESTNATIVEPATH}/stack-tls || exit $? --- old/test/hotspot/jtreg/vmTestbase/metaspace/flags/maxMetaspaceSize/maxMetaspaceSize.sh 2020-01-24 17:51:20.000000000 -0800 +++ /dev/null 2020-01-24 17:51:20.000000000 -0800 @@ -1,45 +0,0 @@ -# Copyright (c) 2013, 2018, 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. - -JAVA="$TESTJAVA/bin/java" -JAVA_OPTS="$TESTJAVAOPTS $TESTVMOPTS -cp $TESTCLASSPATH" - -TST="metaspace.flags.maxMetaspaceSize.maxMetaspaceSize" -echo "" -echo "$JAVA $JAVA_OPTS -XX:MaxMetaspaceSize=100m $TST" -echo "" -$JAVA $JAVA_OPTS -XX:MaxMetaspaceSize=100m $TST -res=$? - -printf "\n\n" -if [ $res -eq 0 ]; then - echo Test passed -else - grep -s "Out of Memory Error" hs_err_pid*.log - res2=$? - if [ $res2 -eq 0 ]; then - echo JAVA crashed with expected Out of Memory Error error. - echo Test passed - else - echo Test failed - exit 1 - fi -fi