hotspot/test/runtime/CommandLine/ConfigFileParsing.java
author jdv
Tue, 09 Aug 2016 13:45:17 +0530
changeset 40432 6a878eae7459
parent 36851 03e2f4d0a421
child 40631 ed82623d7831
permissions -rw-r--r--
8160456: KSS : resource loading issue in TIFFMetadataFormat.java Reviewed-by: prr, bpb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 17598
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     4
 *
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     7
 * published by the Free Software Foundation.
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     8
 *
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    13
 * accompanied this code).
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    14
 *
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    18
 *
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    21
 * questions.
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    22
 */
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents:
diff changeset
    23
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    24
/*
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    25
 * @test ConfigFileParsing
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    26
 * @bug 7158804
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    27
 * @summary Improve config file parsing
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    28
 * @library /testlibrary
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 30604
diff changeset
    29
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 17598
diff changeset
    30
 *          java.management
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    31
 */
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    32
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    33
import java.io.PrintWriter;
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    34
import jdk.test.lib.*;
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    35
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    36
public class ConfigFileParsing {
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    37
  public static void main(String[] args) throws Exception {
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    38
    String testFileName = ".hotspotrc";
14139
339b184759f9 7158804: Improve config file parsing
kamg
parents:
diff changeset
    39
17598
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    40
    // Create really long invalid option
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    41
    String reallyLongInvalidOption = "";
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    42
    for (int i=0; i<5000; i++)
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    43
      reallyLongInvalidOption+='a';
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    44
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    45
    // Populate the options file with really long string
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    46
    PrintWriter pw = new PrintWriter(testFileName);
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    47
    pw.println("-XX:+" + reallyLongInvalidOption);
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    48
    pw.close();
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    49
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    50
    // start VM
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    51
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    52
        "-XX:+IgnoreUnrecognizedVMOptions", "-XX:Flags=.hotspotrc", "-version");
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    53
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    54
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    55
    output.shouldHaveExitValue(0);
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    56
  }
f78d22d3c6c2 8008169: test/runtime/7158804/Test7158804.sh has bad copyright header
ctornqvi
parents: 16457
diff changeset
    57
}