Fri, 05 Aug 2011 15:57:59 -0700
7074189: some javac tests fail with latest jtreg 4.1 b03
Reviewed-by: darcy
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/lib/CompileFail.java Fri Aug 05 15:57:59 2011 -0700 1.3 @@ -0,0 +1,89 @@ 1.4 +/* 1.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + */ 1.26 + 1.27 +import java.io.*; 1.28 +import java.util.*; 1.29 + 1.30 +/* 1.31 + * Utility class to emulate jtreg @compile/fail, but also checking the specific 1.32 + * exit code, given as the first arg. 1.33 + */ 1.34 +public class CompileFail { 1.35 + public static void main(String... args) { 1.36 + if (args.length < 2) 1.37 + throw new IllegalArgumentException("insufficient args"); 1.38 + int expected_rc = getReturnCode(args[0]); 1.39 + 1.40 + List<String> javacArgs = new ArrayList<>(); 1.41 + javacArgs.addAll(Arrays.asList( 1.42 + "-bootclasspath", System.getProperty("sun.boot.class.path"), 1.43 + "-d", "." 1.44 + )); 1.45 + 1.46 + File testSrc = new File(System.getProperty("test.src")); 1.47 + for (int i = 1; i < args.length; i++) { // skip first arg 1.48 + String arg = args[i]; 1.49 + if (arg.endsWith(".java")) 1.50 + javacArgs.add(new File(testSrc, arg).getPath()); 1.51 + else 1.52 + javacArgs.add(arg); 1.53 + } 1.54 + 1.55 + int rc = com.sun.tools.javac.Main.compile( 1.56 + javacArgs.toArray(new String[javacArgs.size()])); 1.57 + 1.58 + if (rc != expected_rc) 1.59 + throw new Error("unexpected exit code: " + rc 1.60 + + ", expected: " + expected_rc); 1.61 + } 1.62 + 1.63 + static int getReturnCode(String name) { 1.64 + switch (name) { 1.65 + case "OK": 1.66 + return EXIT_OK; 1.67 + 1.68 + case "ERROR": 1.69 + return EXIT_ERROR; 1.70 + 1.71 + case "CMDERR": 1.72 + return EXIT_CMDERR; 1.73 + 1.74 + case "SYSERR": 1.75 + return EXIT_SYSERR; 1.76 + 1.77 + case "ABNORMAL": 1.78 + return EXIT_ABNORMAL; 1.79 + 1.80 + default: 1.81 + throw new IllegalArgumentException(name); 1.82 + } 1.83 + } 1.84 + 1.85 + // The following is cut-n-paste from com.sun.tools.javac.main.Main 1.86 + static final int 1.87 + EXIT_OK = 0, // Compilation completed with no errors. 1.88 + EXIT_ERROR = 1, // Completed but reported errors. 1.89 + EXIT_CMDERR = 2, // Bad command-line arguments 1.90 + EXIT_SYSERR = 3, // System error or resource exhaustion. 1.91 + EXIT_ABNORMAL = 4; // Compiler terminated abnormally 1.92 +}
2.1 --- a/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java Thu Aug 04 11:15:37 2011 -0700 2.2 +++ b/test/tools/javac/processing/errors/TestOptionSyntaxErrors.java Fri Aug 05 15:57:59 2011 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -27,14 +27,14 @@ 2.11 * @summary Test that annotation processor options with illegal syntax are rejected 2.12 * @author Joseph D. Darcy 2.13 * @library ../../lib 2.14 - * @build JavacTestingAbstractProcessor 2.15 + * @build JavacTestingAbstractProcessor CompileFail 2.16 * @compile TestOptionSyntaxErrors.java 2.17 - * @compile/fail -A TestOptionSyntaxErrors.java 2.18 - * @compile/fail -A8adOption TestOptionSyntaxErrors.java 2.19 - * @compile/fail -A8adOption=1worseOption TestOptionSyntaxErrors.java 2.20 - * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A TestOptionSyntaxErrors.java 2.21 - * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A8adOption TestOptionSyntaxErrors.java 2.22 - * @compile/fail -processor TestOptionSyntaxErrors -proc:only -A8adOption=1worseOption TestOptionSyntaxErrors.java 2.23 + * @run main CompileFail CMDERR -A TestOptionSyntaxErrors.java 2.24 + * @run main CompileFail CMDERR -A8adOption TestOptionSyntaxErrors.java 2.25 + * @run main CompileFail CMDERR -A8adOption=1worseOption TestOptionSyntaxErrors.java 2.26 + * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A TestOptionSyntaxErrors.java 2.27 + * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A8adOption TestOptionSyntaxErrors.java 2.28 + * @run main CompileFail CMDERR -processor TestOptionSyntaxErrors -proc:only -A8adOption=1worseOption TestOptionSyntaxErrors.java 2.29 */ 2.30 2.31 import java.util.Set;
3.1 --- a/test/tools/javac/processing/errors/TestReturnCode.java Thu Aug 04 11:15:37 2011 -0700 3.2 +++ b/test/tools/javac/processing/errors/TestReturnCode.java Fri Aug 05 15:57:59 2011 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 /* 3.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 3.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 3.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 * 3.9 * This code is free software; you can redistribute it and/or modify it 3.10 @@ -27,25 +27,25 @@ 3.11 * @summary Test that an erroneous return code results from raising an error. 3.12 * @author Joseph D. Darcy 3.13 * @library ../../lib 3.14 - * @build JavacTestingAbstractProcessor 3.15 + * @build JavacTestingAbstractProcessor CompileFail 3.16 * @compile TestReturnCode.java 3.17 * 3.18 - * @compile -processor TestReturnCode -proc:only Foo.java 3.19 - * @compile/fail -processor TestReturnCode -proc:only -AErrorOnFirst Foo.java 3.20 - * @compile/fail -processor TestReturnCode -proc:only -AErrorOnLast Foo.java 3.21 - * @compile/fail -processor TestReturnCode -proc:only -AErrorOnLast -AErrorOnFirst Foo.java 3.22 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnFirst Foo.java 3.23 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnFirst Foo.java 3.24 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnLast Foo.java 3.25 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java 3.26 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast Foo.java 3.27 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnFirst Foo.java 3.28 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnLast Foo.java 3.29 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnLast -AErrorOnFirst Foo.java 3.30 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst Foo.java 3.31 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnFirst Foo.java 3.32 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast Foo.java 3.33 - * @compile/fail -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java 3.34 + * @compile -processor TestReturnCode -proc:only Foo.java 3.35 + * @run main CompileFail ERROR -processor TestReturnCode -proc:only -AErrorOnFirst Foo.java 3.36 + * @run main CompileFail ERROR -processor TestReturnCode -proc:only -AErrorOnLast Foo.java 3.37 + * @run main CompileFail ERROR -processor TestReturnCode -proc:only -AErrorOnLast -AErrorOnFirst Foo.java 3.38 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnFirst Foo.java 3.39 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnFirst Foo.java 3.40 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnLast Foo.java 3.41 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java 3.42 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast Foo.java 3.43 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnFirst Foo.java 3.44 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnLast Foo.java 3.45 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AErrorOnLast -AErrorOnFirst Foo.java 3.46 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst Foo.java 3.47 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnFirst Foo.java 3.48 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast Foo.java 3.49 + * @run main CompileFail SYSERR -processor TestReturnCode -proc:only -AExceptionOnLast -AExceptionOnFirst -AErrorOnLast -AErrorOnFirst Foo.java 3.50 */ 3.51 3.52 import java.util.Set;
4.1 --- a/test/tools/javac/warnings/Serial.java Thu Aug 04 11:15:37 2011 -0700 4.2 +++ b/test/tools/javac/warnings/Serial.java Fri Aug 05 15:57:59 2011 -0700 4.3 @@ -29,7 +29,6 @@ 4.4 * @compile -Xlint:all Serial.java 4.5 * @compile -Werror Serial.java 4.6 * @compile/fail -Werror -Xlint:serial Serial.java 4.7 - * @compile/fail -Werror -Xlint:all,-path T4994049/ Serial.java 4.8 */ 4.9 4.10 import java.io.Serializable;