test/runtime/memory/ReadFromNoaccessArea.java

Tue, 26 Nov 2013 16:03:57 -0500

author
hseigel
date
Tue, 26 Nov 2013 16:03:57 -0500
changeset 6133
e567d5afd4dd
parent 6078
9d8b29a0548c
child 6876
710a3c8b516e
permissions
-rw-r--r--

8028160: [TESTBUG] Exclude failing (runtime) jtreg tests using @ignore
Summary: Use @ignore to exclude failing tests
Reviewed-by: coleenp, ctornqvi, mseledtsov
Contributed-by: george.triantafillou@oracle.com

mgerdin@6078 1 /*
mgerdin@6078 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
mgerdin@6078 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mgerdin@6078 4 *
mgerdin@6078 5 * This code is free software; you can redistribute it and/or modify it
mgerdin@6078 6 * under the terms of the GNU General Public License version 2 only, as
mgerdin@6078 7 * published by the Free Software Foundation.
mgerdin@6078 8 *
mgerdin@6078 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mgerdin@6078 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mgerdin@6078 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mgerdin@6078 12 * version 2 for more details (a copy is included in the LICENSE file that
mgerdin@6078 13 * accompanied this code).
mgerdin@6078 14 *
mgerdin@6078 15 * You should have received a copy of the GNU General Public License version
mgerdin@6078 16 * 2 along with this work; if not, write to the Free Software Foundation,
mgerdin@6078 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mgerdin@6078 18 *
mgerdin@6078 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
mgerdin@6078 20 * or visit www.oracle.com if you need additional information or have any
mgerdin@6078 21 * questions.
mgerdin@6078 22 */
mgerdin@6078 23
mgerdin@6078 24 /*
hseigel@6133 25 * @ignore 8028398
mgerdin@6078 26 * @test
mgerdin@6078 27 * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION
mgerdin@6078 28 * @library /testlibrary /testlibrary/whitebox
mgerdin@6078 29 * @build ReadFromNoaccessArea
mgerdin@6078 30 * @run main ClassFileInstaller sun.hotspot.WhiteBox
mgerdin@6078 31 * @run main ReadFromNoaccessArea
mgerdin@6078 32 */
mgerdin@6078 33
mgerdin@6078 34 import com.oracle.java.testlibrary.*;
mgerdin@6078 35 import sun.hotspot.WhiteBox;
mgerdin@6078 36
mgerdin@6078 37 public class ReadFromNoaccessArea {
mgerdin@6078 38
mgerdin@6078 39 public static void main(String args[]) throws Exception {
mgerdin@6078 40 if (!Platform.is64bit()) {
mgerdin@6078 41 System.out.println("ReadFromNoaccessArea tests is useful only on 64bit architecture. Passing silently.");
mgerdin@6078 42 return;
mgerdin@6078 43 }
mgerdin@6078 44
mgerdin@6078 45 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
mgerdin@6078 46 "-Xbootclasspath/a:.",
mgerdin@6078 47 "-XX:+UnlockDiagnosticVMOptions",
mgerdin@6078 48 "-XX:+WhiteBoxAPI",
mgerdin@6078 49 "-XX:+UseCompressedOops",
mgerdin@6078 50 "-XX:HeapBaseMinAddress=33G",
mgerdin@6078 51 DummyClassWithMainTryingToReadFromNoaccessArea.class.getName());
mgerdin@6078 52
mgerdin@6078 53 OutputAnalyzer output = new OutputAnalyzer(pb.start());
mgerdin@6078 54 System.out.println("******* Printing stdout for analysis in case of failure *******");
mgerdin@6078 55 System.out.println(output.getStdout());
mgerdin@6078 56 System.out.println("******* Printing stderr for analysis in case of failure *******");
mgerdin@6078 57 System.out.println(output.getStderr());
mgerdin@6078 58 System.out.println("***************************************************************");
mgerdin@6078 59 if (output.getStdout() != null && output.getStdout().contains("WB_ReadFromNoaccessArea method is useless")) {
mgerdin@6078 60 // Test conditions broken. There is no protected page in ReservedHeapSpace in these circumstances. Silently passing test.
mgerdin@6078 61 return;
mgerdin@6078 62 }
mgerdin@6078 63 if (Platform.isWindows()) {
mgerdin@6078 64 output.shouldContain("EXCEPTION_ACCESS_VIOLATION");
mgerdin@6078 65 } else if (Platform.isOSX()) {
mgerdin@6078 66 output.shouldContain("SIGBUS");
mgerdin@6078 67 } else {
mgerdin@6078 68 output.shouldContain("SIGSEGV");
mgerdin@6078 69 }
mgerdin@6078 70 }
mgerdin@6078 71
mgerdin@6078 72 public static class DummyClassWithMainTryingToReadFromNoaccessArea {
mgerdin@6078 73
mgerdin@6078 74 // This method calls whitebox method reading from noaccess area
mgerdin@6078 75 public static void main(String args[]) throws Exception {
mgerdin@6078 76 WhiteBox.getWhiteBox().readFromNoaccessArea();
mgerdin@6078 77 throw new Exception("Call of readFromNoaccessArea succeeded! This is wrong. Crash expected. Test failed.");
mgerdin@6078 78 }
mgerdin@6078 79 }
mgerdin@6078 80
mgerdin@6078 81 }

mercurial