TestCardTablePageCommits.java revision 11833:1cbffa2beba6
190075Sobrien/*
2132718Skan* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
3169689Skan* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
490075Sobrien*
590075Sobrien* This code is free software; you can redistribute it and/or modify it
690075Sobrien* under the terms of the GNU General Public License version 2 only, as
790075Sobrien* published by the Free Software Foundation.
8132718Skan*
990075Sobrien* This code is distributed in the hope that it will be useful, but WITHOUT
10132718Skan* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11132718Skan* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12132718Skan* version 2 for more details (a copy is included in the LICENSE file that
13132718Skan* accompanied this code).
1490075Sobrien*
15132718Skan* You should have received a copy of the GNU General Public License version
16132718Skan* 2 along with this work; if not, write to the Free Software Foundation,
17132718Skan* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18132718Skan*
1990075Sobrien* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20132718Skan* or visit www.oracle.com if you need additional information or have any
21132718Skan* questions.
22169689Skan*/
23169689Skan
24169689Skanimport jdk.test.lib.JDKToolFinder;
2590075Sobrienimport jdk.test.lib.process.ProcessTools;
2690075Sobrienimport jdk.test.lib.process.OutputAnalyzer;
27132718Skanimport jdk.test.lib.Platform;
28132718Skan
2990075Sobrien/*
3090075Sobrien * @test TestCardTablePageCommits
3190075Sobrien * @key gc
3290075Sobrien * @bug 8059066
3390075Sobrien * @summary Tests that the card table does not commit the same page twice
3490075Sobrien * @requires vm.gc.Parallel
3590075Sobrien * @library /test/lib
3690075Sobrien * @modules java.base/jdk.internal.misc
3790075Sobrien *          java.management
3890075Sobrien * @run driver TestCardTablePageCommits
3990075Sobrien */
4090075Sobrienpublic class TestCardTablePageCommits {
4190075Sobrien    public static void main(String args[]) throws Exception {
4290075Sobrien        // The test is run with a small heap to make sure all pages in the card
4390075Sobrien        // table gets committed. Need 8 MB heap to trigger the bug on SPARC
4490075Sobrien        // because of 8kB pages, assume 4 KB pages for all other CPUs.
4590075Sobrien        String Xmx = Platform.isSparc() ? "-Xmx8m" : "-Xmx4m";
4690075Sobrien
4790075Sobrien        String[] opts = {Xmx, "-XX:NativeMemoryTracking=detail", "-XX:+UseParallelGC", "-version"};
4890075Sobrien        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(opts);
4990075Sobrien        OutputAnalyzer output = new OutputAnalyzer(pb.start());
5090075Sobrien        output.shouldHaveExitValue(0);
5190075Sobrien    }
5290075Sobrien}
53132718Skan