annotate test/gc/startup_warnings/TestCMSForegroundFlags.java @ 13008:3b3133d93fb6

8027132: Print deprecation warning message for the flags controlling the CMS foreground collector Reviewed-by: stefank, ehelin, ysr, tschatzl
author brutisso
date Mon, 28 Oct 2013 13:27:57 +0100
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13008
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
1 /*
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
4 *
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
7 * published by the Free Software Foundation.
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
8 *
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
13 * accompanied this code).
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
14 *
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
18 *
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
21 * questions.
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
22 */
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
23
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
24 /*
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
25 * @test TestCMSForegroundFlags
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
26 * @key gc
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
27 * @bug 8027132
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
28 * @summary Test that the deprecated CMS foreground collector flags print warning messages
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
29 * @library /testlibrary
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
30 * @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
31 * @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
32 * @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
33 */
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
34
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
35 import com.oracle.java.testlibrary.OutputAnalyzer;
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
36 import com.oracle.java.testlibrary.ProcessTools;
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
37
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
38 public class TestCMSForegroundFlags {
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
39 public static void main(String[] args) throws Exception {
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
40 if (args.length != 2) {
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
41 throw new Exception("Expected two arguments,flagValue and flagName");
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
42 }
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
43 String flagValue = args[0];
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
44 String flagName = args[1];
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
45
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
46 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
47 OutputAnalyzer output = new OutputAnalyzer(pb.start());
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
48 output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
49 output.shouldNotContain("error");
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
50 output.shouldHaveExitValue(0);
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
51 }
3b3133d93fb6 8027132: Print deprecation warning message for the flags controlling the CMS foreground collector
brutisso
parents:
diff changeset
52 }