8046824: class SJavacTestUtil and *Wrapper are redundant and should be removed

Reviewed-by: ksrini
This commit is contained in:
Jonathan Gibbons 2014-07-14 11:46:31 -07:00
parent 1e87b47b2a
commit 6ec02aa50b
12 changed files with 64 additions and 205 deletions

View file

@ -23,6 +23,16 @@
* questions.
*/
/*
* @test
* @bug 8037085
* @summary Ensures that sjavac can handle various exclusion patterns.
*
* @build Wrapper
* @run main Wrapper ExclPattern
*/
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.charset.Charset;

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8037085
* @summary Ensures that sjavac can handle various exclusion patterns.
* @run main ExclPatternWrapper
*/
public class ExclPatternWrapper {
public static void main(String... args) throws Exception {
SJavacTestUtil.runSjavacTest("ExclPattern", args);
}
}

View file

@ -27,6 +27,9 @@
* @test
* @bug 8047183
* @summary JDK build fails with sjavac enabled
*
* @build Wrapper
* @run main Wrapper IgnoreSymbolFile
*/
import java.io.File;
@ -38,12 +41,8 @@ import java.util.Arrays;
public class IgnoreSymbolFile {
public static void main(String... args) throws Exception {
if (sjavacAvailable()) {
IgnoreSymbolFile test = new IgnoreSymbolFile();
test.run();
} else {
System.err.println("sjavac not available; test skipped");
}
}
void run() throws Exception {
@ -96,13 +95,4 @@ public class IgnoreSymbolFile {
}
int errors;
static boolean sjavacAvailable() {
try {
Class.forName("com.sun.tools.sjavac.Main");
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}

View file

@ -23,6 +23,15 @@
* questions.
*/
/*
* @test
* @bug 8035063
* @summary Tests the preparation of javac-arguments.
*
* @build Wrapper
* @run main Wrapper JavacOptionPrep
*/
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035063
* @summary Tests the preparation of javac-arguments.
* @run main JavacOptionPrepWrapper
*/
public class JavacOptionPrepWrapper {
public static void main(String... args) throws Exception {
SJavacTestUtil.runSjavacTest("JavacOptionPrep", args);
}
}

View file

@ -23,6 +23,15 @@
* questions.
*/
/*
* @test
* @bug 8035063
* @summary Tests decoding of String[] into Options.
*
* @build Wrapper
* @run main Wrapper OptionDecoding
*/
import static util.OptionTestUtil.assertEquals;
import static util.OptionTestUtil.checkFilesFound;

View file

@ -1,34 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035063
* @summary Tests decoding of String[] into Options.
* @run main OptionDecodingWrapper
*/
public class OptionDecodingWrapper {
public static void main(String... args) throws Exception {
SJavacTestUtil.runSjavacTest("OptionDecoding", args);
}
}

View file

@ -21,6 +21,16 @@
* questions.
*/
/*
* @test
* @summary Test all aspects of sjavac.
* @bug 8004658 8042441 8042699
*
* @build Wrapper
* @run main Wrapper SJavac
*/
import java.util.*;
import java.io.*;
import java.nio.file.*;
@ -29,8 +39,7 @@ import java.nio.charset.*;
import com.sun.tools.sjavac.Main;
public
class SJavac {
public class SJavac {
public static void main(String... args) throws Exception {
try {

View file

@ -1,40 +0,0 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @summary Test all aspects of sjavac.
*
* @bug 8004658
* @bug 8042441
* @bug 8042699
* @summary Add internal smart javac wrapper to solve JEP 139
*
* @run main SJavacWrapper
*/
public class SJavacWrapper {
public static void main(String... args) throws Exception {
SJavacTestUtil.runSjavacTest("SJavac", args);
}
}

View file

@ -21,6 +21,18 @@
* questions.
*/
/*
* @test
* @bug 8035063
*
* @summary Tests serialization of options. The options needs to be serialized
* and saved in the state file since the files need to be recompiled
* if new options are provided.
*
* @build Wrapper
* @run main Wrapper Serialization
*/
import static util.OptionTestUtil.assertEquals;
import java.io.IOException;

View file

@ -1,38 +0,0 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8035063
*
* @summary Tests serialization of options. The options needs to be serialized
* and saved in the state file since the files need to be recompiled
* if new options are provided.
*
* @run main SerializationWrapper
*/
public class SerializationWrapper {
public static void main(String... args) throws Exception {
SJavacTestUtil.runSjavacTest("Serialization", args);
}
}

View file

@ -25,18 +25,19 @@
import java.io.File;
import java.lang.reflect.Method;
import java.util.Arrays;
public class SJavacTestUtil {
public static void runSjavacTest(String testClassName, String[] args)
throws Exception {
public class Wrapper {
public static void main(String... args) throws Exception {
if (!isSJavacOnClassPath()) {
System.out.println("sjavac not available: pass by default");
return;
}
String testClassName = args[0];
String[] testArgs = Arrays.copyOfRange(args, 1, args.length);
File srcDir = new File(System.getProperty("test.src"));
File clsDir = new File(System.getProperty("test.classes"));
@ -53,12 +54,11 @@ public class SJavacTestUtil {
Class<?> sjavac = Class.forName(testClassName);
Method main = sjavac.getMethod("main", String[].class);
main.invoke(null, new Object[] { args });
main.invoke(null, new Object[] { testArgs });
}
private static boolean isSJavacOnClassPath() {
String cls = "com/sun/tools/sjavac/Main.class";
return SJavacTestUtil.class.getClassLoader().getResource(cls) != null;
return Wrapper.class.getClassLoader().getResource(cls) != null;
}
}