hotspot/test/runtime/CommandLine/TestVMOptions.java
author amurillo
Fri, 06 May 2016 06:23:29 -0700
changeset 38208 ff63d43b0480
parent 36851 03e2f4d0a421
child 40631 ed82623d7831
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 27244
diff changeset
     2
 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     4
 *
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     8
 *
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    13
 * accompanied this code).
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    14
 *
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    18
 *
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    21
 * questions.
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    22
 */
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    23
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    24
/*
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    25
 * @test
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    26
 * @bug 8060256
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    27
 * @summary Test various command line options
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    28
 * @library /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35061
diff changeset
    29
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 27244
diff changeset
    30
 *          java.management
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    31
 * @run main TestVMOptions
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    32
 */
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    33
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 30285
diff changeset
    34
import jdk.test.lib.*;
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    35
import java.io.File;
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    36
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    37
public class TestVMOptions {
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    38
  public static void main(String[] args) throws Exception {
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    39
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    40
        "-XX:bogus",
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    41
        "-XX:+IgnoreUnrecognizedVMOptions",
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    42
        "-XX:+PrintFlagsInitial");
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    43
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    44
    output.shouldContain("bool UseSerialGC");
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    45
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    46
    pb = ProcessTools.createJavaProcessBuilder(
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    47
        "-XX:-PrintVMOptions", "-version");
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    48
    output = new OutputAnalyzer(pb.start());
30285
2ca5f3a28b0f 8078435: [TESTBUG] runtime/CommandLine/TestVMOptions.java fails when running with an OpenJDK build
ctornqvi
parents: 29678
diff changeset
    49
    output.shouldMatch("(openjdk|java)\\sversion");
27244
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    50
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    51
    File dir = new File(System.getProperty("test.src", "."));
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    52
    File file = new File(dir, "flagfile.txt");
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    53
    String s = file.getAbsolutePath();
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    54
    pb = ProcessTools.createJavaProcessBuilder("-XX:Flags="+s);
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    55
    output = new OutputAnalyzer(pb.start());
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    56
    output.shouldContain("VM option '-IgnoreUnrecognizedVMOptions'");
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    57
  }
a2bd9d3112d4 8060256: The loop in Arguments::parse() can be enhanced.
jiangli
parents:
diff changeset
    58
}