Tue, 21 May 2013 13:50:56 +0100
8005207: test has 2 @bug tags
Reviewed-by: mcimadamore
jjg@535 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
jjg@535 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@535 | 4 | * |
jjg@535 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@535 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@535 | 7 | * published by the Free Software Foundation. |
jjg@535 | 8 | * |
jjg@535 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@535 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@535 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@535 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@535 | 13 | * accompanied this code). |
jjg@535 | 14 | * |
jjg@535 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@535 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@535 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@535 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
jjg@535 | 22 | */ |
jjg@535 | 23 | |
jjg@535 | 24 | |
jjg@535 | 25 | /* |
jjg@535 | 26 | * @test |
jjg@535 | 27 | * @bug 6942649 |
jjg@535 | 28 | * @summary add hidden option to identify location and version of javac classes |
jjg@535 | 29 | */ |
jjg@535 | 30 | |
jjg@535 | 31 | import java.io.*; |
jjg@535 | 32 | |
jjg@535 | 33 | public class T6942649 { |
jjg@535 | 34 | public static void main(String... args) throws Exception { |
jjg@535 | 35 | new T6942649().run(); |
jjg@535 | 36 | } |
jjg@535 | 37 | |
jjg@535 | 38 | void run() throws Exception { |
jjg@535 | 39 | test("-XDshowClass", "com.sun.tools.javac.Main"); |
jjg@535 | 40 | test("-XDshowClass=com.sun.tools.javac.util.Log", "com.sun.tools.javac.util.Log"); |
jjg@535 | 41 | } |
jjg@535 | 42 | |
jjg@535 | 43 | void test(String opt, String clazz) throws Exception { |
jjg@535 | 44 | System.err.println("test " + opt); |
jjg@535 | 45 | StringWriter sw = new StringWriter(); |
jjg@535 | 46 | PrintWriter pw = new PrintWriter(sw); |
jjg@535 | 47 | int rc = com.sun.tools.javac.Main.compile(new String[] { opt }, pw); |
jjg@535 | 48 | pw.close(); |
jjg@535 | 49 | String out = sw.toString(); |
jjg@535 | 50 | System.err.println("javac rc=" + rc + "\n" + out); |
jjg@535 | 51 | if (!out.contains(clazz)) |
jjg@535 | 52 | throw new Exception("class name not found in output"); |
jjg@535 | 53 | int lastDot = clazz.lastIndexOf("."); |
jjg@535 | 54 | if (!out.contains(clazz.substring(lastDot + 1) + ".class")) |
jjg@535 | 55 | throw new Exception("location of class not found in output"); |
jjg@535 | 56 | if (!out.contains("MD5 checksum: ")) |
jjg@535 | 57 | throw new Exception("checksum not found in output"); |
jjg@535 | 58 | } |
jjg@535 | 59 | } |