ctornqvi@4563: /* ctornqvi@4563: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. ctornqvi@4563: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ctornqvi@4563: * ctornqvi@4563: * This code is free software; you can redistribute it and/or modify it ctornqvi@4563: * under the terms of the GNU General Public License version 2 only, as ctornqvi@4563: * published by the Free Software Foundation. ctornqvi@4563: * ctornqvi@4563: * This code is distributed in the hope that it will be useful, but WITHOUT ctornqvi@4563: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ctornqvi@4563: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ctornqvi@4563: * version 2 for more details (a copy is included in the LICENSE file that ctornqvi@4563: * accompanied this code). ctornqvi@4563: * ctornqvi@4563: * You should have received a copy of the GNU General Public License version ctornqvi@4563: * 2 along with this work; if not, write to the Free Software Foundation, ctornqvi@4563: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ctornqvi@4563: * ctornqvi@4563: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ctornqvi@4563: * or visit www.oracle.com if you need additional information or have any ctornqvi@4563: * questions. ctornqvi@4563: */ ctornqvi@4563: ctornqvi@4563: /* ctornqvi@4563: * @test ctornqvi@4563: * @bug 8006298 ctornqvi@4563: * @summary Setting a flag to an invalid value should print a useful error message ctornqvi@4563: * @library /testlibrary ctornqvi@4563: */ ctornqvi@4563: ctornqvi@4563: import com.oracle.java.testlibrary.*; ctornqvi@4563: ctornqvi@4563: public class FlagWithInvalidValue { ctornqvi@4563: public static void main(String[] args) throws Exception { ctornqvi@4563: ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( ctornqvi@4807: "-XX:MaxRAMFraction=v", "-version"); ctornqvi@4563: ctornqvi@4563: OutputAnalyzer output = new OutputAnalyzer(pb.start()); ctornqvi@4807: output.shouldContain("Improperly specified VM option 'MaxRAMFraction=v'"); ctornqvi@4563: output.shouldHaveExitValue(1); ctornqvi@4563: } ctornqvi@4563: }