63N/A/*
797N/A * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
63N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
63N/A *
63N/A * This code is free software; you can redistribute it and/or modify it
63N/A * under the terms of the GNU General Public License version 2 only, as
63N/A * published by the Free Software Foundation.
63N/A *
63N/A * This code is distributed in the hope that it will be useful, but WITHOUT
63N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
63N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
63N/A * version 2 for more details (a copy is included in the LICENSE file that
63N/A * accompanied this code).
63N/A *
63N/A * You should have received a copy of the GNU General Public License version
63N/A * 2 along with this work; if not, write to the Free Software Foundation,
63N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
63N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
63N/A */
63N/A
63N/Aimport java.io.*;
63N/Aimport java.util.*;
63N/A
63N/A/*
63N/A * @test
63N/A * @bug 6715251
63N/A * @summary javap should be consistent with javac and return 2 if given no arguments
63N/A */
63N/A
63N/Apublic class T6715251 {
63N/A public static void main(String... args) throws Exception {
63N/A new T6715251().run();
63N/A }
63N/A
63N/A void run() throws Exception {
63N/A String testClasses = System.getProperty("test.classes", ".");
63N/A
63N/A test(2);
63N/A test(0, "-help");
63N/A test(0, "-version");
63N/A test(0, "-fullversion");
63N/A test(0, "-classpath", testClasses, "T6715251");
63N/A
63N/A if (errors > 0)
63N/A throw new Exception(errors + " errors received");
63N/A }
63N/A
63N/A void test(int expect, String ... args) {
63N/A int rc = javap(args);
63N/A if (rc != expect)
63N/A error("bad result: expected: " + expect + ", found " + rc + "\n"
63N/A + log);
63N/A
63N/A }
63N/A
63N/A int javap(String... args) {
63N/A StringWriter sw = new StringWriter();
63N/A PrintWriter pw = new PrintWriter(sw);
63N/A int rc = com.sun.tools.javap.Main.run(args, pw);
63N/A log = sw.toString();
63N/A return rc;
63N/A }
63N/A
63N/A void error(String msg) {
63N/A System.err.println(msg);
63N/A errors++;
63N/A }
63N/A
63N/A String log;
63N/A int errors;
524N/A}