test/runtime/CommandLine/ConfigFileParsing.java

Wed, 21 Jan 2015 12:38:11 +0100

author
goetz
date
Wed, 21 Jan 2015 12:38:11 +0100
changeset 7574
a51071796915
parent 5132
243469d929e6
child 6876
710a3c8b516e
permissions
-rw-r--r--

8068013: [TESTBUG] Aix support in hotspot jtreg tests
Reviewed-by: ctornqvi, fzhinkin, farvidsson

ctornqvi@5132 1 /*
ctornqvi@5132 2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
ctornqvi@5132 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ctornqvi@5132 4 *
ctornqvi@5132 5 * This code is free software; you can redistribute it and/or modify it
ctornqvi@5132 6 * under the terms of the GNU General Public License version 2 only, as
ctornqvi@5132 7 * published by the Free Software Foundation.
ctornqvi@5132 8 *
ctornqvi@5132 9 * This code is distributed in the hope that it will be useful, but WITHOUT
ctornqvi@5132 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ctornqvi@5132 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ctornqvi@5132 12 * version 2 for more details (a copy is included in the LICENSE file that
ctornqvi@5132 13 * accompanied this code).
ctornqvi@5132 14 *
ctornqvi@5132 15 * You should have received a copy of the GNU General Public License version
ctornqvi@5132 16 * 2 along with this work; if not, write to the Free Software Foundation,
ctornqvi@5132 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ctornqvi@5132 18 *
ctornqvi@5132 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ctornqvi@5132 20 * or visit www.oracle.com if you need additional information or have any
ctornqvi@5132 21 * questions.
ctornqvi@5132 22 */
kamg@4212 23
ctornqvi@5132 24 /*
ctornqvi@5132 25 * @test ConfigFileParsing
ctornqvi@5132 26 * @bug 7158804
ctornqvi@5132 27 * @summary Improve config file parsing
ctornqvi@5132 28 * @library /testlibrary
ctornqvi@5132 29 */
kamg@4212 30
ctornqvi@5132 31 import java.io.PrintWriter;
ctornqvi@5132 32 import com.oracle.java.testlibrary.*;
ctornqvi@5132 33
ctornqvi@5132 34 public class ConfigFileParsing {
ctornqvi@5132 35 public static void main(String[] args) throws Exception {
ctornqvi@5132 36 String testFileName = ".hotspotrc";
ctornqvi@5132 37
ctornqvi@5132 38 // Create really long invalid option
ctornqvi@5132 39 String reallyLongInvalidOption = "";
ctornqvi@5132 40 for (int i=0; i<5000; i++)
ctornqvi@5132 41 reallyLongInvalidOption+='a';
ctornqvi@5132 42
ctornqvi@5132 43 // Populate the options file with really long string
ctornqvi@5132 44 PrintWriter pw = new PrintWriter(testFileName);
ctornqvi@5132 45 pw.println("-XX:+" + reallyLongInvalidOption);
ctornqvi@5132 46 pw.close();
ctornqvi@5132 47
ctornqvi@5132 48 // start VM
ctornqvi@5132 49 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
ctornqvi@5132 50 "-XX:+IgnoreUnrecognizedVMOptions", "-XX:Flags=.hotspotrc", "-version");
ctornqvi@5132 51
ctornqvi@5132 52 OutputAnalyzer output = new OutputAnalyzer(pb.start());
ctornqvi@5132 53 output.shouldHaveExitValue(0);
ctornqvi@5132 54 }
ctornqvi@5132 55 }

mercurial