# HG changeset patch # User Doug Simon # Date 1434661571 -7200 # Node ID 36a7ec14279d2f950f3f5462b023659974591934 # Parent 07cfd3d7072bcc7d53d07c5e543a3d4e0983414f moved unit test support from mx_graal.py to mx.py diff -r 07cfd3d7072b -r 36a7ec14279d .hgignore --- a/.hgignore Wed Jun 17 15:31:28 2015 +0200 +++ b/.hgignore Thu Jun 18 23:06:11 2015 +0200 @@ -1,14 +1,3 @@ -^mx.graal/env -^mx.graal/checkstyle-timestamps -^mx.graal/eclipse-config.zip -^mx.graal/eclipse-config-libs.zip -^mx.graal/netbeans-config.zip -^mx.graal/netbeans-config-libs.zip -^mx.graal/eclipse-launches -^mx.graal/jmh -^mx.graal/currentAnnotationProcessors -^mx.graal/ecj.jar -^mx.graal/includes ^build/ ^build-nograal/ ^build-nojvmci/ @@ -42,11 +31,6 @@ \.hprof$ \javafilelist.txt$ \.hprof\.txt$ -^graal/.*/build.xml -^jvmci/.*/build.xml -^graal/.*/nbproject/ -^jvmci/.*/nbproject/ -dist ^doc/.*/dot_temp_ ^doc/doxygen/.*$ \.orig$ @@ -76,7 +60,21 @@ .idea/ ^cscope.out ^tags + syntax: glob +currentAnnotationProcessors +ecj.jar +jmh +env +nbproject +dist +build.xml +checkstyle-timestamps +eclipse-config.zip +eclipse-config-libs.zip +netbeans-config.zip +netbeans-config-libs.zip +eclipse-launches *.bgv core.* *.jar diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/AnsiTerminalDecorator.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/AnsiTerminalDecorator.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import static com.oracle.jvmci.debug.AnsiColor.*; - -import org.junit.runner.*; -import org.junit.runner.notification.*; - -/** - * Color support for JUnit test output using ANSI escapes codes. - */ -public class AnsiTerminalDecorator extends GraalJUnitRunListenerDecorator { - - public AnsiTerminalDecorator(GraalJUnitRunListener l) { - super(l); - } - - @Override - public void testSucceeded(Description description) { - getWriter().print(GREEN); - super.testSucceeded(description); - getWriter().print(RESET); - } - - @Override - public void testAssumptionFailure(Failure failure) { - getWriter().print(BLUE); - super.testAssumptionFailure(failure); - getWriter().print(RESET); - } - - @Override - public void testFailed(Failure failure) { - getWriter().print(RED); - super.testFailed(failure); - getWriter().print(RESET); - } - - @Override - public void testIgnored(Description description) { - getWriter().print(MAGENTA); - super.testIgnored(description); - getWriter().print(RESET); - } -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/EagerStackTraceDecorator.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/EagerStackTraceDecorator.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import org.junit.runner.notification.*; - -public class EagerStackTraceDecorator extends GraalJUnitRunListenerDecorator { - - public EagerStackTraceDecorator(GraalJUnitRunListener l) { - super(l); - } - - @Override - public void testFailed(Failure failure) { - super.testFailed(failure); - failure.getException().printStackTrace(getWriter()); - } - -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GCAfterTestDecorator.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GCAfterTestDecorator.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import org.junit.runner.*; - -public class GCAfterTestDecorator extends GraalJUnitRunListenerDecorator { - - public GCAfterTestDecorator(GraalJUnitRunListener l) { - super(l); - } - - @Override - public void testFinished(Description description) { - System.gc(); - super.testFinished(description); - } -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitCore.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,246 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import java.io.*; -import java.lang.reflect.Modifier; -import java.nio.file.*; -import java.util.*; - -import junit.runner.*; - -import org.junit.internal.*; -import org.junit.runner.*; -import org.junit.runner.notification.*; -import org.junit.runners.*; -import org.junit.runners.model.*; - -public class GraalJUnitCore { - - /** - * Run the tests contained in the classes named in the args. A single test method - * can be specified by adding #method after the class name. Only a single test can be run in - * this way. If all tests run successfully, exit with a status of 0. Otherwise exit with a - * status of 1. Write feedback while tests are running and write stack traces for all failed - * tests after the tests all complete. - * - * @param args names of classes in which to find tests to run - */ - public static void main(String... args) { - JUnitSystem system = new RealSystem(); - JUnitCore junitCore = new JUnitCore(); - system.out().println("GraalJUnitCore"); - system.out().println("JUnit version " + Version.id()); - List> classes = new ArrayList<>(); - String methodName = null; - List missingClasses = new ArrayList<>(); - boolean verbose = false; - boolean enableTiming = false; - boolean failFast = false; - boolean color = false; - boolean eagerStackTrace = false; - boolean gcAfterTest = false; - - String[] expandedArgs = expandArgs(args); - for (int i = 0; i < expandedArgs.length; i++) { - String each = expandedArgs[i]; - if (each.charAt(0) == '-') { - // command line arguments - if (each.contentEquals("-JUnitVerbose")) { - verbose = true; - } else if (each.contentEquals("-JUnitFailFast")) { - failFast = true; - } else if (each.contentEquals("-JUnitEnableTiming")) { - enableTiming = true; - } else if (each.contentEquals("-JUnitColor")) { - color = true; - } else if (each.contentEquals("-JUnitEagerStackTrace")) { - eagerStackTrace = true; - } else if (each.contentEquals("-JUnitGCAfterTest")) { - gcAfterTest = true; - } else { - system.out().println("Unknown command line argument: " + each); - } - - } else { - /* - * Entries of the form class#method are handled specially. Only one can be specified - * on the command line as there's no obvious way to build a runner for multiple - * ones. - */ - if (methodName != null) { - system.out().println("Only a single class and method can be specified: " + each); - System.exit(1); - } else if (each.contains("#")) { - String[] pair = each.split("#"); - if (pair.length != 2) { - system.out().println("Malformed class and method request: " + each); - System.exit(1); - } else if (classes.size() != 0) { - system.out().println("Only a single class and method can be specified: " + each); - System.exit(1); - } else { - methodName = pair[1]; - each = pair[0]; - } - } - try { - Class cls = Class.forName(each, false, GraalJUnitCore.class.getClassLoader()); - if ((cls.getModifiers() & Modifier.ABSTRACT) == 0) { - classes.add(cls); - } - } catch (ClassNotFoundException e) { - system.out().println("Could not find class: " + each); - Description description = Description.createSuiteDescription(each); - Failure failure = new Failure(description, e); - missingClasses.add(failure); - } - } - } - final GraalTextListener textListener; - if (!verbose) { - textListener = new GraalTextListener(system); - } else { - textListener = new GraalVerboseTextListener(system); - } - GraalJUnitRunListener graalListener = textListener; - if (enableTiming) { - graalListener = new TimingDecorator(graalListener); - } - if (color) { - graalListener = new AnsiTerminalDecorator(graalListener); - } - if (eagerStackTrace) { - graalListener = new EagerStackTraceDecorator(graalListener); - } - if (gcAfterTest) { - graalListener = new GCAfterTestDecorator(graalListener); - } - junitCore.addListener(GraalTextListener.createRunListener(graalListener)); - Request request; - if (methodName == null) { - request = Request.classes(classes.toArray(new Class[0])); - if (failFast) { - Runner runner = request.getRunner(); - if (runner instanceof ParentRunner) { - ParentRunner parentRunner = (ParentRunner) runner; - parentRunner.setScheduler(new RunnerScheduler() { - public void schedule(Runnable childStatement) { - if (textListener.getLastFailure() == null) { - childStatement.run(); - } - } - - public void finished() { - } - }); - } else { - system.out().println("Unexpected Runner subclass " + runner.getClass().getName() + " - fail fast not supported"); - } - } - } else { - if (failFast) { - system.out().println("Single method selected - fail fast not supported"); - } - request = Request.method(classes.get(0), methodName); - } - Result result = junitCore.run(request); - for (Failure each : missingClasses) { - result.getFailures().add(each); - } - System.exit(result.wasSuccessful() ? 0 : 1); - } - - /** - * Gets the command line for the current process. - * - * @return the command line arguments for the current process or {@code null} if they are not - * available - */ - public static List getProcessCommandLine() { - String processArgsFile = System.getenv().get("MX_SUBPROCESS_COMMAND_FILE"); - if (processArgsFile != null) { - try { - return Files.readAllLines(new File(processArgsFile).toPath()); - } catch (IOException e) { - } - } - return null; - } - - /** - * Expand any arguments starting with @ and return the resulting argument array. - * - * @param args - * @return the expanded argument array - */ - private static String[] expandArgs(String[] args) { - List result = null; - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.length() > 0 && arg.charAt(0) == '@') { - if (result == null) { - result = new ArrayList<>(); - for (int j = 0; j < i; j++) { - result.add(args[j]); - } - expandArg(arg.substring(1), result); - } - } else if (result != null) { - result.add(arg); - } - } - return result != null ? result.toArray(new String[0]) : args; - } - - /** - * Add each line from {@code filename} to the list {@code args}. - * - * @param filename - * @param args - */ - private static void expandArg(String filename, List args) { - BufferedReader br = null; - try { - br = new BufferedReader(new FileReader(filename)); - - String buf; - while ((buf = br.readLine()) != null) { - args.add(buf); - } - br.close(); - } catch (IOException ioe) { - ioe.printStackTrace(); - System.exit(2); - } finally { - try { - if (br != null) { - br.close(); - } - } catch (IOException ioe) { - ioe.printStackTrace(); - System.exit(3); - } - } - } -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListener.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListener.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import java.io.*; - -import org.junit.internal.*; -import org.junit.runner.*; -import org.junit.runner.notification.*; - -public interface GraalJUnitRunListener { - - /** - * Called before any tests have been run. - * - * @param description describes the tests to be run - */ - void testRunStarted(Description description); - - /** - * Called when all tests have finished. - * - * @param result the summary of the test run, including all the tests that failed - */ - void testRunFinished(Result result); - - /** - * Called when a test class is about to be started. - * - * @param clazz the test class - */ - void testClassStarted(Class clazz); - - /** - * Called when all tests of a test class have finished. - * - * @param clazz the test class - */ - void testClassFinished(Class clazz); - - /** - * Called when an atomic test is about to be started. This is also called for ignored tests. - * - * @param description the description of the test that is about to be run (generally a class and - * method name) - */ - void testStarted(Description description); - - /** - * Called when an atomic test has finished, whether the test succeeds, fails or is ignored. - * - * @param description the description of the test that just ran - */ - void testFinished(Description description); - - /** - * Called when an atomic test fails. - * - * @param failure describes the test that failed and the exception that was thrown - */ - void testFailed(Failure failure); - - /** - * Called when a test will not be run, generally because a test method is annotated with - * {@link org.junit.Ignore}. - * - * @param description describes the test that will not be run - */ - void testIgnored(Description description); - - /** - * Called when an atomic test succeeds. - * - * @param description describes the test that will not be run - */ - void testSucceeded(Description description); - - /** - * Called when an atomic test flags that it assumes a condition that is false. - * - * @param failure describes the test that failed and the {@link AssumptionViolatedException} - * that was thrown - */ - void testAssumptionFailure(Failure failure); - - /** - * Called after {@link #testClassFinished(Class)}. - */ - void testClassFinishedDelimiter(); - - /** - * Called after {@link #testClassStarted(Class)}. - */ - void testClassStartedDelimiter(); - - /** - * Called after {@link #testStarted(Description)}. - */ - void testStartedDelimiter(); - - /** - * Called after {@link #testFailed(Failure)}. - */ - void testFinishedDelimiter(); - - PrintStream getWriter(); - -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListenerDecorator.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalJUnitRunListenerDecorator.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import java.io.*; - -import org.junit.runner.*; -import org.junit.runner.notification.*; - -public class GraalJUnitRunListenerDecorator implements GraalJUnitRunListener { - - private final GraalJUnitRunListener l; - - public GraalJUnitRunListenerDecorator(GraalJUnitRunListener l) { - this.l = l; - } - - @Override - public void testRunStarted(Description description) { - l.testRunStarted(description); - } - - @Override - public void testRunFinished(Result result) { - l.testRunFinished(result); - } - - @Override - public void testAssumptionFailure(Failure failure) { - l.testAssumptionFailure(failure); - } - - @Override - public void testIgnored(Description description) { - l.testIgnored(description); - } - - @Override - public void testClassStarted(Class clazz) { - l.testClassStarted(clazz); - } - - @Override - public void testClassFinished(Class clazz) { - l.testClassFinished(clazz); - } - - @Override - public void testStarted(Description description) { - l.testStarted(description); - } - - @Override - public void testFinished(Description description) { - l.testFinished(description); - } - - @Override - public void testFailed(Failure failure) { - l.testFailed(failure); - } - - @Override - public void testSucceeded(Description description) { - l.testSucceeded(description); - } - - @Override - public PrintStream getWriter() { - return l.getWriter(); - } - - public void testClassFinishedDelimiter() { - l.testClassFinishedDelimiter(); - } - - public void testClassStartedDelimiter() { - l.testClassStartedDelimiter(); - } - - public void testStartedDelimiter() { - l.testStartedDelimiter(); - } - - public void testFinishedDelimiter() { - l.testFinishedDelimiter(); - } - -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTextListener.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalTextListener.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import java.io.*; - -import org.junit.internal.*; -import org.junit.runner.*; -import org.junit.runner.notification.*; - -public class GraalTextListener implements GraalJUnitRunListener { - - private final PrintStream fWriter; - protected Failure lastFailure; - - public GraalTextListener(JUnitSystem system) { - this(system.out()); - } - - public GraalTextListener(PrintStream writer) { - fWriter = writer; - } - - @Override - public PrintStream getWriter() { - return fWriter; - } - - public Failure getLastFailure() { - return lastFailure; - } - - @Override - public void testRunStarted(Description description) { - } - - @Override - public void testRunFinished(Result result) { - } - - @Override - public void testAssumptionFailure(Failure failure) { - } - - @Override - public void testClassStarted(Class clazz) { - } - - @Override - public void testClassFinished(Class clazz) { - } - - @Override - public void testStarted(Description description) { - getWriter().print('.'); - } - - @Override - public void testFinished(Description description) { - } - - @Override - public void testFailed(Failure failure) { - getWriter().print('E'); - lastFailure = failure; - } - - @Override - public void testSucceeded(Description description) { - } - - @Override - public void testIgnored(Description description) { - getWriter().print('I'); - } - - @Override - public void testClassFinishedDelimiter() { - } - - @Override - public void testClassStartedDelimiter() { - } - - @Override - public void testStartedDelimiter() { - } - - @Override - public void testFinishedDelimiter() { - } - - public static RunListener createRunListener(GraalJUnitRunListener l) { - return new TextListener(l.getWriter()) { - private Class lastClass; - private boolean failed; - - @Override - public final void testStarted(Description description) { - Class currentClass = description.getTestClass(); - if (currentClass != lastClass) { - if (lastClass != null) { - l.testClassFinished(lastClass); - l.testClassFinishedDelimiter(); - } - lastClass = currentClass; - l.testClassStarted(currentClass); - l.testClassStartedDelimiter(); - } - failed = false; - l.testStarted(description); - l.testStartedDelimiter(); - } - - @Override - public final void testFailure(Failure failure) { - failed = true; - l.testFailed(failure); - } - - @Override - public final void testFinished(Description description) { - // we have to do this because there is no callback for successful tests - if (!failed) { - l.testSucceeded(description); - } - l.testFinished(description); - l.testFinishedDelimiter(); - } - - @Override - public void testIgnored(Description description) { - l.testStarted(description); - l.testStartedDelimiter(); - l.testIgnored(description); - l.testFinished(description); - l.testFinishedDelimiter(); - } - - @Override - public void testRunStarted(Description description) { - l.testRunStarted(description); - } - - @Override - public void testRunFinished(Result result) { - if (lastClass != null) { - l.testClassFinished(lastClass); - } - l.testRunFinished(result); - super.testRunFinished(result); - } - - @Override - public void testAssumptionFailure(Failure failure) { - l.testAssumptionFailure(failure); - } - - }; - } - -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/GraalVerboseTextListener.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import java.io.*; - -import org.junit.internal.*; -import org.junit.runner.*; -import org.junit.runner.notification.*; - -public class GraalVerboseTextListener extends GraalTextListener { - - public GraalVerboseTextListener(JUnitSystem system) { - this(system.out()); - } - - public GraalVerboseTextListener(PrintStream writer) { - super(writer); - } - - @Override - public void testClassStarted(Class clazz) { - getWriter().print(clazz.getName() + " started"); - } - - @Override - public void testClassFinished(Class clazz) { - getWriter().print(clazz.getName() + " finished"); - } - - @Override - public void testStarted(Description description) { - getWriter().print(" " + description.getMethodName() + ": "); - } - - @Override - public void testIgnored(Description description) { - getWriter().print("Ignored"); - } - - @Override - public void testSucceeded(Description description) { - getWriter().print("Passed"); - } - - @Override - public void testAssumptionFailure(Failure failure) { - getWriter().printf("(%s) ", failure.getMessage()); - } - - @Override - public void testFailed(Failure failure) { - getWriter().print("FAILED"); - lastFailure = failure; - } - - @Override - public void testClassFinishedDelimiter() { - getWriter().println(); - } - - @Override - public void testClassStartedDelimiter() { - getWriter().println(); - } - - @Override - public void testFinishedDelimiter() { - getWriter().println(); - } - -} diff -r 07cfd3d7072b -r 36a7ec14279d graal/com.oracle.graal.test/src/com/oracle/graal/test/TimingDecorator.java --- a/graal/com.oracle.graal.test/src/com/oracle/graal/test/TimingDecorator.java Wed Jun 17 15:31:28 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014, 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. - */ -package com.oracle.graal.test; - -import org.junit.runner.*; - -/** - * Timing support for JUnit test runs. - */ -public class TimingDecorator extends GraalJUnitRunListenerDecorator { - - private long startTime; - private long classStartTime; - - public TimingDecorator(GraalJUnitRunListener l) { - super(l); - } - - @Override - public void testClassStarted(Class clazz) { - classStartTime = System.nanoTime(); - super.testClassStarted(clazz); - } - - @Override - public void testClassFinished(Class clazz) { - long totalTime = System.nanoTime() - classStartTime; - super.testClassFinished(clazz); - getWriter().print(' ' + valueToString(totalTime)); - } - - @Override - public void testStarted(Description description) { - startTime = System.nanoTime(); - super.testStarted(description); - } - - @Override - public void testFinished(Description description) { - long totalTime = System.nanoTime() - startTime; - super.testFinished(description); - getWriter().print(" " + valueToString(totalTime)); - } - - private static String valueToString(long value) { - return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10); - } - -} diff -r 07cfd3d7072b -r 36a7ec14279d mx.graal/mx_graal.py --- a/mx.graal/mx_graal.py Wed Jun 17 15:31:28 2015 +0200 +++ b/mx.graal/mx_graal.py Thu Jun 18 23:06:11 2015 +0200 @@ -28,14 +28,14 @@ import os, stat, errno, sys, shutil, zipfile, tarfile, tempfile, re, time, datetime, platform, subprocess, StringIO, socket from os.path import join, exists, dirname, basename -from argparse import ArgumentParser, RawDescriptionHelpFormatter, REMAINDER +from argparse import ArgumentParser, REMAINDER from outputparser import OutputParser, ValuesMatcher import mx +import mx_unittest import xml.dom.minidom import sanitycheck import itertools import json, textwrap -import fnmatch import mx_graal_makefile _suite = mx.suite('graal') @@ -318,7 +318,7 @@ def _run_benchmark(args, availableBenchmarks, runBenchmark): - vmOpts, benchmarksAndOptions = _extract_VM_args(args, useDoubleDash=availableBenchmarks is None) + vmOpts, benchmarksAndOptions = mx.extract_VM_args(args, useDoubleDash=availableBenchmarks is None) if availableBenchmarks is None: harnessArgs = benchmarksAndOptions @@ -1123,268 +1123,42 @@ matches = lambda line: len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) -def _extract_VM_args(args, allowClasspath=False, useDoubleDash=False, defaultAllVMArgs=True): - """ - Partitions a command line into a leading sequence of HotSpot VM options and the rest. - """ - for i in range(0, len(args)): - if useDoubleDash: - if args[i] == '--': - vmArgs = args[:i] - remainder = args[i + 1:] - return vmArgs, remainder - else: - if not args[i].startswith('-'): - if i != 0 and (args[i - 1] == '-cp' or args[i - 1] == '-classpath'): - if not allowClasspath: - mx.abort('Cannot supply explicit class path option') - else: - continue - vmArgs = args[:i] - remainder = args[i:] - return vmArgs, remainder - - if defaultAllVMArgs: - return args, [] - else: - return [], args - -def _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex): - - - vmArgs, tests = _extract_VM_args(args) - for t in tests: - if t.startswith('-'): - mx.abort('VM option ' + t + ' must precede ' + tests[0]) - - candidates = {} - for p in mx.projects_opt_limit_to_suites(): - if mx.java().javaCompliance < p.javaCompliance: - continue - for c in _find_classes_with_annotations(p, None, annotations).keys(): - candidates[c] = p - - classes = [] - if len(tests) == 0: - classes = candidates.keys() - projectsCp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) - else: - projs = set() - found = False - if len(tests) == 1 and '#' in tests[0]: - words = tests[0].split('#') - if len(words) != 2: - mx.abort("Method specification is class#method: " + tests[0]) - t, method = words - - for c, p in candidates.iteritems(): - # prefer exact matches first - if t == c: - found = True - classes.append(c) - projs.add(p.name) - if not found: - for c, p in candidates.iteritems(): - if t in c: - found = True - classes.append(c) - projs.add(p.name) - if not found: - mx.log('warning: no tests matched by substring "' + t) - elif len(classes) != 1: - mx.abort('More than one test matches substring {0} {1}'.format(t, classes)) +def _find_classpath_arg(vmArgs): + for index in range(len(vmArgs)): + if vmArgs[index] in ['-cp', '-classpath']: + return index + 1, vmArgs[index + 1] - classes = [c + "#" + method for c in classes] - else: - for t in tests: - if '#' in t: - mx.abort('Method specifications can only be used in a single test: ' + t) - for c, p in candidates.iteritems(): - if t in c: - found = True - classes.append(c) - projs.add(p.name) - if not found: - mx.log('warning: no tests matched by substring "' + t) - projectsCp = mx.classpath(projs) - - if blacklist: - classes = [c for c in classes if not any((glob.match(c) for glob in blacklist))] - - if whitelist: - classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] - - if regex: - classes = [c for c in classes if re.search(regex, c)] - - if len(classes) != 0: - f_testfile = open(testfile, 'w') - for c in classes: - f_testfile.write(c + '\n') - f_testfile.close() - harness(projectsCp, vmArgs) - -def _unittest(args, annotations, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): - testfile = os.environ.get('MX_TESTFILE', None) - if testfile is None: - (_, testfile) = tempfile.mkstemp(".testclasses", "graal") - os.close(_) +def unittest(args): + def vmLauncher(vmArgs, mainClass, mainClassArgs): + if isJVMCIEnabled(_get_vm()): + # Remove entries from class path that are in JVMCI loaded jars + cpIndex, cp = _find_classpath_arg(vmArgs) + if cp: + excluded = set() + for jdkDist in _jdkDeployedDists: + dist = mx.distribution(jdkDist.name) + excluded.update([d.output_dir() for d in dist.sorted_deps()]) + print 'before:', len(cp) + cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) + print 'after:', len(cp) + vmArgs[cpIndex] = cp - coreCp = mx.classpath(['com.oracle.graal.test', 'HCFDIS']) - - coreArgs = [] - if verbose: - coreArgs.append('-JUnitVerbose') - if fail_fast: - coreArgs.append('-JUnitFailFast') - if enable_timing: - coreArgs.append('-JUnitEnableTiming') - if color: - coreArgs.append('-JUnitColor') - if eager_stacktrace: - coreArgs.append('-JUnitEagerStackTrace') - if gc_after_test: - coreArgs.append('-JUnitGCAfterTest') - - - def harness(projectsCp, vmArgs): - if _get_vm() != 'jvmci': - prefixArgs = ['-esa', '-ea'] - else: - prefixArgs = ['-XX:-BootstrapJVMCI', '-esa', '-ea'] - if gc_after_test: - prefixArgs.append('-XX:-DisableExplicitGC') - with open(testfile) as fp: - testclasses = [l.rstrip() for l in fp.readlines()] - - # Remove entries from class path that are in graal.jar and - # run the VM in a mode where application/test classes can - # access core Graal classes. - cp = prefixCp + coreCp + os.pathsep + projectsCp - if isJVMCIEnabled(_get_vm()): - excluded = set() - for jdkDist in _jdkDeployedDists: - dist = mx.distribution(jdkDist.name) - excluded.update([d.output_dir() for d in dist.sorted_deps()]) - cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in excluded]) + # Run the VM in a mode where application/test classes can + # access JVMCI loaded classes. vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs - # suppress menubar and dock when running on Mac - vmArgs = ['-Djava.awt.headless=true'] + vmArgs - - if len(testclasses) == 1: - # Execute Junit directly when one test is being run. This simplifies - # replaying the VM execution in a native debugger (e.g., gdb). - vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + testclasses) - else: - vm(prefixArgs + vmArgs + ['-cp', mx._separatedCygpathU2W(cp), 'com.oracle.graal.test.GraalJUnitCore'] + coreArgs + ['@' + mx._cygpathU2W(testfile)]) - - try: - _run_tests(args, harness, annotations, testfile, blacklist, whitelist, regex) - finally: - if os.environ.get('MX_TESTFILE') is None: - os.remove(testfile) - -_unittestHelpSuffix = """ - Unittest options: - - --blacklist run all testcases not specified in the blacklist - --whitelist run only testcases which are included - in the given whitelist - --verbose enable verbose JUnit output - --fail-fast stop after first JUnit test class that has a failure - --enable-timing enable JUnit test timing - --regex run only testcases matching a regular expression - --color enable colors output - --eager-stacktrace print stacktrace eagerly - --gc-after-test force a GC after each test - - To avoid conflicts with VM options '--' can be used as delimiter. - - If filters are supplied, only tests whose fully qualified name - includes a filter as a substring are run. - - For example, this command line: - - mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload - - will run all JUnit test classes that contain 'BC_aload' in their - fully qualified name and will pass these options to the VM: - - -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG - - To get around command line length limitations on some OSes, the - JUnit class names to be executed are written to a file that a - custom JUnit wrapper reads and passes onto JUnit proper. The - MX_TESTFILE environment variable can be set to specify a - file which will not be deleted once the unittests are done - (unlike the temporary file otherwise used). - - As with all other commands, using the global '-v' before 'unittest' - command will cause mx to show the complete command line - it uses to run the VM. -""" - -def unittest(args): - """run the JUnit tests (all testcases){0}""" - - parser = ArgumentParser(prog='mx unittest', - description='run the JUnit tests', - add_help=False, - formatter_class=RawDescriptionHelpFormatter, - epilog=_unittestHelpSuffix, - ) - parser.add_argument('--blacklist', help='run all testcases not specified in the blacklist', metavar='') - parser.add_argument('--whitelist', help='run testcases specified in whitelist only', metavar='') - parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true') - parser.add_argument('--fail-fast', help='stop after first JUnit test class that has a failure', action='store_true') - parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true') - parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='') - parser.add_argument('--color', help='enable color output', action='store_true') - parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true') - parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true') - - ut_args = [] - delimiter = False - # check for delimiter - while len(args) > 0: - arg = args.pop(0) - if arg == '--': - delimiter = True - break - ut_args.append(arg) - - if delimiter: - # all arguments before '--' must be recognized - parsed_args = parser.parse_args(ut_args) - else: - # parse all know arguments - parsed_args, args = parser.parse_known_args(ut_args) - - if parsed_args.whitelist: - try: - with open(join(_graal_home, parsed_args.whitelist)) as fp: - parsed_args.whitelist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] - except IOError: - mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) - if parsed_args.blacklist: - try: - with open(join(_graal_home, parsed_args.blacklist)) as fp: - parsed_args.blacklist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] - except IOError: - mx.log('warning: could not read blacklist: ' + parsed_args.blacklist) - - _unittest(args, ['@Test', '@Parameters'], **parsed_args.__dict__) + vm(vmArgs + [mainClass] + mainClassArgs) + mx_unittest.unittest(args, vmLauncher=vmLauncher) def shortunittest(args): - """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'{0}""" + """alias for 'unittest --whitelist test/whitelist_shortunittest.txt'""" args = ['--whitelist', 'test/whitelist_shortunittest.txt'] + args unittest(args) def microbench(args): """run JMH microbenchmark projects""" - vmArgs, jmhArgs = _extract_VM_args(args, useDoubleDash=True) + vmArgs, jmhArgs = mx.extract_VM_args(args, useDoubleDash=True) # look for -f in JMH arguments containsF = False @@ -2107,7 +1881,7 @@ mx.help_(['jmh']) mx.abort(1) - vmArgs, benchmarksAndJsons = _extract_VM_args(args) + vmArgs, benchmarksAndJsons = mx.extract_VM_args(args) if isJVMCIEnabled(_get_vm()) and '-XX:-UseJVMCIClassLoader' not in vmArgs: vmArgs = ['-XX:-UseJVMCIClassLoader'] + vmArgs @@ -2337,12 +2111,12 @@ def sl(args): """run an SL program""" - vmArgs, slArgs = _extract_VM_args(args) + vmArgs, slArgs = mx.extract_VM_args(args) vm(vmArgs + ['-cp', mx.classpath(["TRUFFLE", "com.oracle.truffle.sl"]), "com.oracle.truffle.sl.SLLanguage"] + slArgs) def sldebug(args): """run a simple command line debugger for the Simple Language""" - vmArgs, slArgs = _extract_VM_args(args, useDoubleDash=True) + vmArgs, slArgs = mx.extract_VM_args(args, useDoubleDash=True) vm(vmArgs + ['-cp', mx.classpath("com.oracle.truffle.sl.tools"), "com.oracle.truffle.sl.tools.debug.SLREPLServer"] + slArgs) def isJVMCIEnabled(vm): @@ -2534,6 +2308,9 @@ continue csConfig = join(mx.project(p.checkstyleProj).dir, '.checkstyle_checks.xml') + if not exists(csConfig): + mx.log('Cannot check headers for ' + p.name + ' - ' + csConfig + ' does not exist') + continue dom = xml.dom.minidom.parse(csConfig) for module in dom.getElementsByTagName('module'): if module.getAttribute('name') == 'RegexpHeader': @@ -2581,9 +2358,9 @@ 'gate' : [gate, '[-options]'], 'bench' : [bench, '[-resultfile file] [all(default)|dacapo|specjvm2008|bootstrap]'], 'microbench' : [microbench, '[VM options] [-- [JMH options]]'], - 'unittest' : [unittest, '[unittest options] [--] [VM options] [filters...]', _unittestHelpSuffix], 'makejmhdeps' : [makejmhdeps, ''], - 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', _unittestHelpSuffix], + 'unittest' : [unittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], + 'shortunittest' : [shortunittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], 'jacocoreport' : [jacocoreport, '[output directory]'], 'site' : [site, '[-options]'], 'vm': [vm, '[-options] class [args...]'], diff -r 07cfd3d7072b -r 36a7ec14279d mx.graal/suite.py --- a/mx.graal/suite.py Wed Jun 17 15:31:28 2015 +0200 +++ b/mx.graal/suite.py Thu Jun 18 23:06:11 2015 +0200 @@ -686,6 +686,7 @@ "dependencies" : [ "com.oracle.graal.code", "com.oracle.graal.test", + "com.oracle.jvmci.debug", "com.oracle.jvmci.runtime", ], "checkstyle" : "com.oracle.graal.graph", @@ -1062,7 +1063,6 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.jvmci.debug", "JUNIT", ], "checkstyle" : "com.oracle.graal.graph", diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/.checkstyle_checks.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/.checkstyle_checks.xml Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.core.resources.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.core.resources.prefs Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.jdt.core.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.jdt.core.prefs Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,417 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=ignore +org.eclipse.jdt.core.compiler.problem.forbiddenReference=ignore +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=disabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.processAnnotations=enabled +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled +org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL +org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=48 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=48 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=100 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=true +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=4 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=4 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=true +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=200 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=space +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=false +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.jdt.ui.prefs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/.settings/org.eclipse.jdt.ui.prefs Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,123 @@ +cleanup.add_default_serial_version_id=false +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=false +cleanup.add_missing_deprecated_annotations=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=false +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=false +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=false +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_to_enhanced_for_loop=false +cleanup.format_source_code=false +cleanup.make_local_variable_final=false +cleanup.make_parameters_final=false +cleanup.make_private_fields_final=true +cleanup.make_variable_declarations_final=false +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=false +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false +cleanup.qualify_static_member_accesses_with_declaring_class=false +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=false +cleanup.remove_trailing_whitespaces=false +cleanup.remove_trailing_whitespaces_all=false +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=false +cleanup.remove_unnecessary_nls_tags=false +cleanup.remove_unused_imports=false +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=false +cleanup.remove_unused_private_members=false +cleanup.remove_unused_private_methods=false +cleanup.remove_unused_private_types=false +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_blocks=false +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_parentheses_in_expressions=false +cleanup.use_this_for_non_static_field_access=false +cleanup.use_this_for_non_static_field_access_only_if_necessary=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=false +cleanup_profile=_CleanUpAgitarTests +cleanup_settings_version=2 +comment_clear_blank_lines=false +comment_format_comments=true +comment_format_header=false +comment_format_html=true +comment_format_source_code=true +comment_indent_parameter_description=true +comment_indent_root_tags=true +comment_line_length=120 +comment_new_line_for_parameter=true +comment_separate_root_tags=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Graal +formatter_settings_version=12 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=true +org.eclipse.jdt.ui.ignorelowercasenames=true +org.eclipse.jdt.ui.importorder=java;javax;org;com; +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.ondemandthreshold=0 +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.staticondemandthreshold=0 +sp_cleanup.add_default_serial_version_id=false +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=false +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=false +sp_cleanup.add_missing_override_annotations_interface_methods=false +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=false +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=false +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=false +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=false +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=false +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=false +sp_cleanup.remove_unused_private_types=false +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=false diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/AnsiTerminalDecorator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/AnsiTerminalDecorator.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import org.junit.runner.*; +import org.junit.runner.notification.*; + +/** + * Color support for JUnit test output using ANSI escapes codes. + */ +public class AnsiTerminalDecorator extends MxRunListenerDecorator { + + /** Foreground black. */ + public static final String BLACK = "\u001b[30m"; + /** Foreground red. */ + public static final String RED = "\u001b[31m"; + /** Foreground green. */ + public static final String GREEN = "\u001b[32m"; + /** Foreground yellow. */ + public static final String YELLOW = "\u001b[33m"; + /** Foreground blue. */ + public static final String BLUE = "\u001b[34m"; + /** Foreground magenta. */ + public static final String MAGENTA = "\u001b[35m"; + /** Foreground cyan. */ + public static final String CYAN = "\u001b[36m"; + /** Foreground white. */ + public static final String WHITE = "\u001b[37m"; + + /** Foreground bold black. */ + public static final String BOLD_BLACK = "\u001b[30;1m"; + /** Foreground bold red. */ + public static final String BOLD_RED = "\u001b[31;1m"; + /** Foreground bold green. */ + public static final String BOLD_GREEN = "\u001b[32;1m"; + /** Foreground bold yellow. */ + public static final String BOLD_YELLOW = "\u001b[33;1m"; + /** Foreground bold blue. */ + public static final String BOLD_BLUE = "\u001b[34;1m"; + /** Foreground bold magenta. */ + public static final String BOLD_MAGENTA = "\u001b[35;1m"; + /** Foreground bold cyan. */ + public static final String BOLD_CYAN = "\u001b[36;1m"; + /** Foreground bold white. */ + public static final String BOLD_WHITE = "\u001b[37;1m"; + + /** Background black. */ + public static final String BG_BLACK = "\u001b[40m"; + /** Background red. */ + public static final String BG_RED = "\u001b[41m"; + /** Background green. */ + public static final String BG_GREEN = "\u001b[42m"; + /** Background yellow. */ + public static final String BG_YELLOW = "\u001b[43m"; + /** Background blue. */ + public static final String BG_BLUE = "\u001b[44m"; + /** Background magenta. */ + public static final String BG_MAGENTA = "\u001b[45m"; + /** Background cyan. */ + public static final String BG_CYAN = "\u001b[46m"; + /** Background white. */ + public static final String BG_WHITE = "\u001b[47m"; + + /** Reset. */ + public static final String RESET = "\u001b[0m"; + /** Underline. */ + public static final String UNDERLINED = "\u001b[4m"; + + public AnsiTerminalDecorator(MxRunListener l) { + super(l); + } + + @Override + public void testSucceeded(Description description) { + getWriter().print(GREEN); + super.testSucceeded(description); + getWriter().print(RESET); + } + + @Override + public void testAssumptionFailure(Failure failure) { + getWriter().print(BLUE); + super.testAssumptionFailure(failure); + getWriter().print(RESET); + } + + @Override + public void testFailed(Failure failure) { + getWriter().print(RED); + super.testFailed(failure); + getWriter().print(RESET); + } + + @Override + public void testIgnored(Description description) { + getWriter().print(MAGENTA); + super.testIgnored(description); + getWriter().print(RESET); + } +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/EagerStackTraceDecorator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/EagerStackTraceDecorator.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import org.junit.runner.notification.*; + +public class EagerStackTraceDecorator extends MxRunListenerDecorator { + + public EagerStackTraceDecorator(MxRunListener l) { + super(l); + } + + @Override + public void testFailed(Failure failure) { + super.testFailed(failure); + failure.getException().printStackTrace(getWriter()); + } + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/GCAfterTestDecorator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/GCAfterTestDecorator.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import org.junit.runner.*; + +public class GCAfterTestDecorator extends MxRunListenerDecorator { + + public GCAfterTestDecorator(MxRunListener l) { + super(l); + } + + @Override + public void testFinished(Description description) { + System.gc(); + super.testFinished(description); + } +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxJUnitWrapper.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,246 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import java.io.*; +import java.lang.reflect.Modifier; +import java.nio.file.*; +import java.util.*; + +import junit.runner.*; + +import org.junit.internal.*; +import org.junit.runner.*; +import org.junit.runner.notification.*; +import org.junit.runners.*; +import org.junit.runners.model.*; + +public class MxJUnitWrapper { + + /** + * Run the tests contained in the classes named in the args. A single test method + * can be specified by adding #method after the class name. Only a single test can be run in + * this way. If all tests run successfully, exit with a status of 0. Otherwise exit with a + * status of 1. Write feedback while tests are running and write stack traces for all failed + * tests after the tests all complete. + * + * @param args names of classes in which to find tests to run + */ + public static void main(String... args) { + JUnitSystem system = new RealSystem(); + JUnitCore junitCore = new JUnitCore(); + system.out().println("MxJUnitCore"); + system.out().println("JUnit version " + Version.id()); + List> classes = new ArrayList<>(); + String methodName = null; + List missingClasses = new ArrayList<>(); + boolean verbose = false; + boolean enableTiming = false; + boolean failFast = false; + boolean color = false; + boolean eagerStackTrace = false; + boolean gcAfterTest = false; + + String[] expandedArgs = expandArgs(args); + for (int i = 0; i < expandedArgs.length; i++) { + String each = expandedArgs[i]; + if (each.charAt(0) == '-') { + // command line arguments + if (each.contentEquals("-JUnitVerbose")) { + verbose = true; + } else if (each.contentEquals("-JUnitFailFast")) { + failFast = true; + } else if (each.contentEquals("-JUnitEnableTiming")) { + enableTiming = true; + } else if (each.contentEquals("-JUnitColor")) { + color = true; + } else if (each.contentEquals("-JUnitEagerStackTrace")) { + eagerStackTrace = true; + } else if (each.contentEquals("-JUnitGCAfterTest")) { + gcAfterTest = true; + } else { + system.out().println("Unknown command line argument: " + each); + } + + } else { + /* + * Entries of the form class#method are handled specially. Only one can be specified + * on the command line as there's no obvious way to build a runner for multiple + * ones. + */ + if (methodName != null) { + system.out().println("Only a single class and method can be specified: " + each); + System.exit(1); + } else if (each.contains("#")) { + String[] pair = each.split("#"); + if (pair.length != 2) { + system.out().println("Malformed class and method request: " + each); + System.exit(1); + } else if (classes.size() != 0) { + system.out().println("Only a single class and method can be specified: " + each); + System.exit(1); + } else { + methodName = pair[1]; + each = pair[0]; + } + } + try { + Class cls = Class.forName(each, false, MxJUnitWrapper.class.getClassLoader()); + if ((cls.getModifiers() & Modifier.ABSTRACT) == 0) { + classes.add(cls); + } + } catch (ClassNotFoundException e) { + system.out().println("Could not find class: " + each); + Description description = Description.createSuiteDescription(each); + Failure failure = new Failure(description, e); + missingClasses.add(failure); + } + } + } + final TextRunListener textListener; + if (!verbose) { + textListener = new TextRunListener(system); + } else { + textListener = new VerboseTextListener(system); + } + MxRunListener mxListener = textListener; + if (enableTiming) { + mxListener = new TimingDecorator(mxListener); + } + if (color) { + mxListener = new AnsiTerminalDecorator(mxListener); + } + if (eagerStackTrace) { + mxListener = new EagerStackTraceDecorator(mxListener); + } + if (gcAfterTest) { + mxListener = new GCAfterTestDecorator(mxListener); + } + junitCore.addListener(TextRunListener.createRunListener(mxListener)); + Request request; + if (methodName == null) { + request = Request.classes(classes.toArray(new Class[0])); + if (failFast) { + Runner runner = request.getRunner(); + if (runner instanceof ParentRunner) { + ParentRunner parentRunner = (ParentRunner) runner; + parentRunner.setScheduler(new RunnerScheduler() { + public void schedule(Runnable childStatement) { + if (textListener.getLastFailure() == null) { + childStatement.run(); + } + } + + public void finished() { + } + }); + } else { + system.out().println("Unexpected Runner subclass " + runner.getClass().getName() + " - fail fast not supported"); + } + } + } else { + if (failFast) { + system.out().println("Single method selected - fail fast not supported"); + } + request = Request.method(classes.get(0), methodName); + } + Result result = junitCore.run(request); + for (Failure each : missingClasses) { + result.getFailures().add(each); + } + System.exit(result.wasSuccessful() ? 0 : 1); + } + + /** + * Gets the command line for the current process. + * + * @return the command line arguments for the current process or {@code null} if they are not + * available + */ + public static List getProcessCommandLine() { + String processArgsFile = System.getenv().get("MX_SUBPROCESS_COMMAND_FILE"); + if (processArgsFile != null) { + try { + return Files.readAllLines(new File(processArgsFile).toPath()); + } catch (IOException e) { + } + } + return null; + } + + /** + * Expand any arguments starting with @ and return the resulting argument array. + * + * @param args + * @return the expanded argument array + */ + private static String[] expandArgs(String[] args) { + List result = null; + for (int i = 0; i < args.length; i++) { + String arg = args[i]; + if (arg.length() > 0 && arg.charAt(0) == '@') { + if (result == null) { + result = new ArrayList<>(); + for (int j = 0; j < i; j++) { + result.add(args[j]); + } + expandArg(arg.substring(1), result); + } + } else if (result != null) { + result.add(arg); + } + } + return result != null ? result.toArray(new String[0]) : args; + } + + /** + * Add each line from {@code filename} to the list {@code args}. + * + * @param filename + * @param args + */ + private static void expandArg(String filename, List args) { + BufferedReader br = null; + try { + br = new BufferedReader(new FileReader(filename)); + + String buf; + while ((buf = br.readLine()) != null) { + args.add(buf); + } + br.close(); + } catch (IOException ioe) { + ioe.printStackTrace(); + System.exit(2); + } finally { + try { + if (br != null) { + br.close(); + } + } catch (IOException ioe) { + ioe.printStackTrace(); + System.exit(3); + } + } + } +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxRunListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxRunListener.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import java.io.*; + +import org.junit.internal.*; +import org.junit.runner.*; +import org.junit.runner.notification.*; + +public interface MxRunListener { + + /** + * Called before any tests have been run. + * + * @param description describes the tests to be run + */ + void testRunStarted(Description description); + + /** + * Called when all tests have finished. + * + * @param result the summary of the test run, including all the tests that failed + */ + void testRunFinished(Result result); + + /** + * Called when a test class is about to be started. + * + * @param clazz the test class + */ + void testClassStarted(Class clazz); + + /** + * Called when all tests of a test class have finished. + * + * @param clazz the test class + */ + void testClassFinished(Class clazz); + + /** + * Called when an atomic test is about to be started. This is also called for ignored tests. + * + * @param description the description of the test that is about to be run (generally a class and + * method name) + */ + void testStarted(Description description); + + /** + * Called when an atomic test has finished, whether the test succeeds, fails or is ignored. + * + * @param description the description of the test that just ran + */ + void testFinished(Description description); + + /** + * Called when an atomic test fails. + * + * @param failure describes the test that failed and the exception that was thrown + */ + void testFailed(Failure failure); + + /** + * Called when a test will not be run, generally because a test method is annotated with + * {@link org.junit.Ignore}. + * + * @param description describes the test that will not be run + */ + void testIgnored(Description description); + + /** + * Called when an atomic test succeeds. + * + * @param description describes the test that will not be run + */ + void testSucceeded(Description description); + + /** + * Called when an atomic test flags that it assumes a condition that is false. + * + * @param failure describes the test that failed and the {@link AssumptionViolatedException} + * that was thrown + */ + void testAssumptionFailure(Failure failure); + + /** + * Called after {@link #testClassFinished(Class)}. + */ + void testClassFinishedDelimiter(); + + /** + * Called after {@link #testClassStarted(Class)}. + */ + void testClassStartedDelimiter(); + + /** + * Called after {@link #testStarted(Description)}. + */ + void testStartedDelimiter(); + + /** + * Called after {@link #testFailed(Failure)}. + */ + void testFinishedDelimiter(); + + PrintStream getWriter(); + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxRunListenerDecorator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/MxRunListenerDecorator.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import java.io.*; + +import org.junit.runner.*; +import org.junit.runner.notification.*; + +public class MxRunListenerDecorator implements MxRunListener { + + private final MxRunListener l; + + public MxRunListenerDecorator(MxRunListener l) { + this.l = l; + } + + @Override + public void testRunStarted(Description description) { + l.testRunStarted(description); + } + + @Override + public void testRunFinished(Result result) { + l.testRunFinished(result); + } + + @Override + public void testAssumptionFailure(Failure failure) { + l.testAssumptionFailure(failure); + } + + @Override + public void testIgnored(Description description) { + l.testIgnored(description); + } + + @Override + public void testClassStarted(Class clazz) { + l.testClassStarted(clazz); + } + + @Override + public void testClassFinished(Class clazz) { + l.testClassFinished(clazz); + } + + @Override + public void testStarted(Description description) { + l.testStarted(description); + } + + @Override + public void testFinished(Description description) { + l.testFinished(description); + } + + @Override + public void testFailed(Failure failure) { + l.testFailed(failure); + } + + @Override + public void testSucceeded(Description description) { + l.testSucceeded(description); + } + + @Override + public PrintStream getWriter() { + return l.getWriter(); + } + + public void testClassFinishedDelimiter() { + l.testClassFinishedDelimiter(); + } + + public void testClassStartedDelimiter() { + l.testClassStartedDelimiter(); + } + + public void testStartedDelimiter() { + l.testStartedDelimiter(); + } + + public void testFinishedDelimiter() { + l.testFinishedDelimiter(); + } + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/TextRunListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/TextRunListener.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import java.io.*; + +import org.junit.internal.*; +import org.junit.runner.*; +import org.junit.runner.notification.*; + +public class TextRunListener implements MxRunListener { + + private final PrintStream fWriter; + protected Failure lastFailure; + + public TextRunListener(JUnitSystem system) { + this(system.out()); + } + + public TextRunListener(PrintStream writer) { + fWriter = writer; + } + + @Override + public PrintStream getWriter() { + return fWriter; + } + + public Failure getLastFailure() { + return lastFailure; + } + + @Override + public void testRunStarted(Description description) { + } + + @Override + public void testRunFinished(Result result) { + } + + @Override + public void testAssumptionFailure(Failure failure) { + } + + @Override + public void testClassStarted(Class clazz) { + } + + @Override + public void testClassFinished(Class clazz) { + } + + @Override + public void testStarted(Description description) { + getWriter().print('.'); + } + + @Override + public void testFinished(Description description) { + } + + @Override + public void testFailed(Failure failure) { + getWriter().print('E'); + lastFailure = failure; + } + + @Override + public void testSucceeded(Description description) { + } + + @Override + public void testIgnored(Description description) { + getWriter().print('I'); + } + + @Override + public void testClassFinishedDelimiter() { + } + + @Override + public void testClassStartedDelimiter() { + } + + @Override + public void testStartedDelimiter() { + } + + @Override + public void testFinishedDelimiter() { + } + + public static RunListener createRunListener(MxRunListener l) { + return new TextListener(l.getWriter()) { + private Class lastClass; + private boolean failed; + + @Override + public final void testStarted(Description description) { + Class currentClass = description.getTestClass(); + if (currentClass != lastClass) { + if (lastClass != null) { + l.testClassFinished(lastClass); + l.testClassFinishedDelimiter(); + } + lastClass = currentClass; + l.testClassStarted(currentClass); + l.testClassStartedDelimiter(); + } + failed = false; + l.testStarted(description); + l.testStartedDelimiter(); + } + + @Override + public final void testFailure(Failure failure) { + failed = true; + l.testFailed(failure); + } + + @Override + public final void testFinished(Description description) { + // we have to do this because there is no callback for successful tests + if (!failed) { + l.testSucceeded(description); + } + l.testFinished(description); + l.testFinishedDelimiter(); + } + + @Override + public void testIgnored(Description description) { + l.testStarted(description); + l.testStartedDelimiter(); + l.testIgnored(description); + l.testFinished(description); + l.testFinishedDelimiter(); + } + + @Override + public void testRunStarted(Description description) { + l.testRunStarted(description); + } + + @Override + public void testRunFinished(Result result) { + if (lastClass != null) { + l.testClassFinished(lastClass); + } + l.testRunFinished(result); + super.testRunFinished(result); + } + + @Override + public void testAssumptionFailure(Failure failure) { + l.testAssumptionFailure(failure); + } + + }; + } + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/TimingDecorator.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/TimingDecorator.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import org.junit.runner.*; + +/** + * Timing support for JUnit test runs. + */ +public class TimingDecorator extends MxRunListenerDecorator { + + private long startTime; + private long classStartTime; + + public TimingDecorator(MxRunListener l) { + super(l); + } + + @Override + public void testClassStarted(Class clazz) { + classStartTime = System.nanoTime(); + super.testClassStarted(clazz); + } + + @Override + public void testClassFinished(Class clazz) { + long totalTime = System.nanoTime() - classStartTime; + super.testClassFinished(clazz); + getWriter().print(' ' + valueToString(totalTime)); + } + + @Override + public void testStarted(Description description) { + startTime = System.nanoTime(); + super.testStarted(description); + } + + @Override + public void testFinished(Description description) { + long totalTime = System.nanoTime() - startTime; + super.testFinished(description); + getWriter().print(" " + valueToString(totalTime)); + } + + private static String valueToString(long value) { + return String.format("%d.%d ms", value / 1000000, (value / 100000) % 10); + } + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/VerboseTextListener.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/java/com.oracle.mxtool.junit/src/com/oracle/mxtool/junit/VerboseTextListener.java Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014, 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. + */ +package com.oracle.mxtool.junit; + +import java.io.*; + +import org.junit.internal.*; +import org.junit.runner.*; +import org.junit.runner.notification.*; + +public class VerboseTextListener extends TextRunListener { + + public VerboseTextListener(JUnitSystem system) { + this(system.out()); + } + + public VerboseTextListener(PrintStream writer) { + super(writer); + } + + @Override + public void testClassStarted(Class clazz) { + getWriter().print(clazz.getName() + " started"); + } + + @Override + public void testClassFinished(Class clazz) { + getWriter().print(clazz.getName() + " finished"); + } + + @Override + public void testStarted(Description description) { + getWriter().print(" " + description.getMethodName() + ": "); + } + + @Override + public void testIgnored(Description description) { + getWriter().print("Ignored"); + } + + @Override + public void testSucceeded(Description description) { + getWriter().print("Passed"); + } + + @Override + public void testAssumptionFailure(Failure failure) { + getWriter().printf("(%s) ", failure.getMessage()); + } + + @Override + public void testFailed(Failure failure) { + getWriter().print("FAILED"); + lastFailure = failure; + } + + @Override + public void testClassFinishedDelimiter() { + getWriter().println(); + } + + @Override + public void testClassStartedDelimiter() { + getWriter().println(); + } + + @Override + public void testFinishedDelimiter() { + getWriter().println(); + } + +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/mx.mx/suite.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/mx.mx/suite.py Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,61 @@ +suite = { + "mxversion" : "1.0", + "name" : "mx", + "libraries" : { + + # ------------- Libraries ------------- + + "MX_JUNIT" : { + "path" : "lib/junit-4.11.jar", + "urls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/junit-4.11.jar", + "https://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11.jar", + ], + "sha1" : "4e031bb61df09069aeb2bffb4019e7a5034a4ee0", + "eclipse.container" : "org.eclipse.jdt.junit.JUNIT_CONTAINER/4", + "sourcePath" : "lib/junit-4.11-sources.jar", + "sourceUrls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/junit-4.11-sources.jar", + "https://search.maven.org/remotecontent?filepath=junit/junit/4.11/junit-4.11-sources.jar", + ], + "sourceSha1" : "28e0ad201304e4a4abf999ca0570b7cffc352c3c", + "dependencies" : ["MX_HAMCREST"], + }, + + "MX_CHECKSTYLE" : { + "path" : "lib/checkstyle-6.0-all.jar", + "urls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/checkstyle-6.0-all.jar", + "jar:http://sourceforge.net/projects/checkstyle/files/checkstyle/6.0/checkstyle-6.0-bin.zip/download!/checkstyle-6.0/checkstyle-6.0-all.jar", + ], + "sha1" : "2bedc7feded58b5fd65595323bfaf7b9bb6a3c7a", + }, + + "MX_HAMCREST" : { + "path" : "lib/hamcrest-core-1.3.jar", + "urls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/hamcrest-core-1.3.jar", + "https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar", + ], + "sha1" : "42a25dc3219429f0e5d060061f71acb49bf010a0", + "sourcePath" : "lib/hamcrest-core-1.3-sources.jar", + "sourceUrls" : [ + "http://lafo.ssw.uni-linz.ac.at/graal-external-deps/hamcrest-core-1.3-sources.jar", + "https://search.maven.org/remotecontent?filepath=org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3-sources.jar", + ], + "sourceSha1" : "1dc37250fbc78e23a65a67fbbaf71d2e9cbc3c0b", + }, + }, + + "projects" : { + + "com.oracle.mxtool.junit" : { + "subDir" : "java", + "sourceDirs" : ["src"], + "dependencies" : [ + "MX_JUNIT", + ], + "javaCompliance" : "1.8", + }, + }, +} diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/mx.py --- a/mxtool/mx.py Wed Jun 17 15:31:28 2015 +0200 +++ b/mxtool/mx.py Thu Jun 18 23:06:11 2015 +0200 @@ -33,7 +33,12 @@ Full documentation can be found at https://wiki.openjdk.java.net/display/Graal/The+mx+Tool """ -import sys, os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, fnmatch, platform +import sys +if __name__ == '__main__': + # Rename this module as 'mx' so it is not re-executed when imported by other modules. + sys.modules['mx'] = sys.modules.pop('__main__') + +import os, errno, time, subprocess, shlex, types, StringIO, zipfile, signal, xml.sax.saxutils, tempfile, platform import textwrap import socket import tarfile @@ -42,6 +47,7 @@ import shutil, re, xml.dom.minidom import pipes import difflib +import mx_unittest from collections import Callable from threading import Thread from argparse import ArgumentParser, REMAINDER @@ -99,6 +105,7 @@ _dists = dict() _suites = dict() _annotationProcessors = None +_mx_suite = None _primary_suite_path = None _primary_suite = None _opts = None @@ -1039,10 +1046,10 @@ except AssertionError as ae: abort('Exception while parsing "mxversion" in project file: ' + str(ae)) - libsMap = suiteDict['libraries'] - jreLibsMap = suiteDict['jrelibraries'] - projsMap = suiteDict['projects'] - distsMap = suiteDict['distributions'] + libsMap = suiteDict.get('libraries', {}) + jreLibsMap = suiteDict.get('jrelibraries', {}) + projsMap = suiteDict.get('projects', {}) + distsMap = suiteDict.get('distributions', {}) def pop_list(attrs, name, context): v = attrs.pop(name, None) @@ -1705,6 +1712,31 @@ p.all_deps(deps, includeLibs=includeLibs, includeJreLibs=includeJreLibs, includeAnnotationProcessors=includeAnnotationProcessors) return deps +def extract_VM_args(args, useDoubleDash=False, allowClasspath=False): + """ + Partitions 'args' into a leading sequence of HotSpot VM options and the rest. If + 'useDoubleDash' then 'args' is partititioned by the first instance of "--". If + not 'allowClasspath' then mx aborts if "-cp" or "-classpath" is in 'args'. + + """ + for i in range(len(args)): + if useDoubleDash: + if args[i] == '--': + vmArgs = args[:i] + remainder = args[i + 1:] + return vmArgs, remainder + else: + if not args[i].startswith('-'): + if i != 0 and (args[i - 1] == '-cp' or args[i - 1] == '-classpath'): + if not allowClasspath: + abort('Cannot supply explicit class path option') + else: + continue + vmArgs = args[:i] + remainder = args[i:] + return vmArgs, remainder + return args, [] + class ArgParser(ArgumentParser): # Override parent to append the list of available commands def format_help(self): @@ -2054,7 +2086,6 @@ return filtered[0] return None - def run_java(args, nonZeroIsFatal=True, out=None, err=None, cwd=None, addDefaultArgs=True, javaConfig=None): if not javaConfig: javaConfig = java() @@ -5003,18 +5034,18 @@ log('fsckprojects command must be run in an interactive shell') return hg = HgConfig() + projectDirs = [p.dir for suite in suites() for p in suite.projects] + distIdeDirs = [d.get_ide_project_dir() for suite in suites() for d in suite.dists if d.get_ide_project_dir() is not None] for suite in suites(True): - projectDirs = [p.dir for p in suite.projects] - distIdeDirs = [d.get_ide_project_dir() for d in suite.dists if d.get_ide_project_dir() is not None] for dirpath, dirnames, files in os.walk(suite.dir): if dirpath == suite.dir: # no point in traversing .hg, lib, or .workspace dirnames[:] = [d for d in dirnames if d not in ['.hg', 'lib', '.workspace']] elif dirpath in projectDirs: - # don't traverse subdirs of an existing project in this suite + # don't traverse subdirs of an existing project dirnames[:] = [] elif dirpath in distIdeDirs: - # don't traverse subdirs of an existing distributions in this suite + # don't traverse subdirs of an existing distribution dirnames[:] = [] else: projectConfigFiles = frozenset(['.classpath', '.project', 'nbproject']) @@ -5024,7 +5055,7 @@ indicatorsInHg = hg.locate(suite.dir, indicators) # Only proceed if there are indicator files that are not under HG if len(indicators) > len(indicatorsInHg): - if not is_interactive() or ask_yes_no(dirpath + ' looks like a removed project -- delete it', 'n'): + if ask_yes_no(dirpath + ' looks like a removed project -- delete it', 'n'): shutil.rmtree(dirpath) log('Deleted ' + dirpath) @@ -5669,6 +5700,7 @@ 'netbeansinit': [netbeansinit, ''], 'suites': [show_suites, ''], 'projects': [show_projects, ''], + 'unittest' : [mx_unittest.unittest, '[unittest options] [--] [VM options] [filters...]', mx_unittest.unittestHelpSuffix], } _argParser = ArgParser() @@ -5727,6 +5759,11 @@ return _findPrimarySuiteMxDirFrom(dirname(__file__)) def main(): + mxMxDir = _is_suite_dir(dirname(__file__)) + assert mxMxDir + global _mx_suite + _mx_suite = _loadSuite(mxMxDir) + primarySuiteMxDir = _findPrimarySuiteMxDir() if primarySuiteMxDir: global _primary_suite @@ -5785,9 +5822,6 @@ currentUmask = None if __name__ == '__main__': - # rename this module as 'mx' so it is not imported twice by the commands.py modules - sys.modules['mx'] = sys.modules.pop('__main__') - # Capture the current umask since there's no way to query it without mutating it. currentUmask = os.umask(0) os.umask(currentUmask) diff -r 07cfd3d7072b -r 36a7ec14279d mxtool/mx_unittest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mxtool/mx_unittest.py Thu Jun 18 23:06:11 2015 +0200 @@ -0,0 +1,262 @@ +#!/usr/bin/env python2.7 +# +# ---------------------------------------------------------------------------------------------------- +# +# Copyright (c) 2007, 2015, 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. +# +# ---------------------------------------------------------------------------------------------------- +# + +import mx +import os +import re +import tempfile +import fnmatch +from argparse import ArgumentParser, RawDescriptionHelpFormatter + +def _find_classes_with_annotations(p, pkgRoot, annotations, includeInnerClasses=False): + """ + Scan the sources of project 'p' for Java source files containing a line starting with 'annotation' + (ignoring preceding whitespace) and return the fully qualified class name for each Java + source file matched in a list. + """ + + matches = lambda line: len([a for a in annotations if line == a or line.startswith(a + '(')]) != 0 + return p.find_classes_with_matching_source_line(pkgRoot, matches, includeInnerClasses) + +def _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex): + + + vmArgs, tests = mx.extract_VM_args(args) + for t in tests: + if t.startswith('-'): + mx.abort('VM option ' + t + ' must precede ' + tests[0]) + + candidates = {} + for p in mx.projects_opt_limit_to_suites(): + if mx.java().javaCompliance < p.javaCompliance: + continue + for c in _find_classes_with_annotations(p, None, annotations).keys(): + candidates[c] = p + + classes = [] + if len(tests) == 0: + classes = candidates.keys() + projectsCp = mx.classpath([pcp.name for pcp in mx.projects_opt_limit_to_suites() if pcp.javaCompliance <= mx.java().javaCompliance]) + else: + projs = set() + found = False + if len(tests) == 1 and '#' in tests[0]: + words = tests[0].split('#') + if len(words) != 2: + mx.abort("Method specification is class#method: " + tests[0]) + t, method = words + + for c, p in candidates.iteritems(): + # prefer exact matches first + if t == c: + found = True + classes.append(c) + projs.add(p.name) + if not found: + for c, p in candidates.iteritems(): + if t in c: + found = True + classes.append(c) + projs.add(p.name) + if not found: + mx.log('warning: no tests matched by substring "' + t) + elif len(classes) != 1: + mx.abort('More than one test matches substring {0} {1}'.format(t, classes)) + + classes = [c + "#" + method for c in classes] + else: + for t in tests: + if '#' in t: + mx.abort('Method specifications can only be used in a single test: ' + t) + for c, p in candidates.iteritems(): + if t in c: + found = True + classes.append(c) + projs.add(p.name) + if not found: + mx.log('warning: no tests matched by substring "' + t) + projectsCp = mx.classpath(projs) + + if blacklist: + classes = [c for c in classes if not any((glob.match(c) for glob in blacklist))] + + if whitelist: + classes = [c for c in classes if any((glob.match(c) for glob in whitelist))] + + if regex: + classes = [c for c in classes if re.search(regex, c)] + + if len(classes) != 0: + f_testfile = open(testfile, 'w') + for c in classes: + f_testfile.write(c + '\n') + f_testfile.close() + harness(projectsCp, vmLauncher, vmArgs) + +def _unittest(args, annotations, vmLauncher=None, prefixCp="", blacklist=None, whitelist=None, verbose=False, fail_fast=False, enable_timing=False, regex=None, color=False, eager_stacktrace=False, gc_after_test=False): + testfile = os.environ.get('MX_TESTFILE', None) + if testfile is None: + (_, testfile) = tempfile.mkstemp(".testclasses", "mxtool") + os.close(_) + + coreCp = mx.classpath(['com.oracle.mxtool.junit', 'HCFDIS']) + + coreArgs = [] + if verbose: + coreArgs.append('-JUnitVerbose') + if fail_fast: + coreArgs.append('-JUnitFailFast') + if enable_timing: + coreArgs.append('-JUnitEnableTiming') + if color: + coreArgs.append('-JUnitColor') + if eager_stacktrace: + coreArgs.append('-JUnitEagerStackTrace') + if gc_after_test: + coreArgs.append('-JUnitGCAfterTest') + + + def harness(projectsCp, vmLauncher, vmArgs): + prefixArgs = ['-esa', '-ea'] + if gc_after_test: + prefixArgs.append('-XX:-DisableExplicitGC') + with open(testfile) as fp: + testclasses = [l.rstrip() for l in fp.readlines()] + + # Run the VM in a mode where application/test classes can + # access classes normally hidden behind the JVMCI class loader + cp = prefixCp + coreCp + os.pathsep + projectsCp + + # suppress menubar and dock when running on Mac + vmArgs = prefixArgs + ['-Djava.awt.headless=true'] + vmArgs + ['-cp', mx._separatedCygpathU2W(cp)] + mainClass = 'com.oracle.mxtool.junit.MxJUnitWrapper' + # Execute Junit directly when one test is being run. This simplifies + # replaying the VM execution in a native debugger (e.g., gdb). + mainClassArgs = coreArgs + (testclasses if len(testclasses) == 1 else ['@' + mx._cygpathU2W(testfile)]) + + vmLauncher(vmArgs, mainClass, mainClassArgs) + + if vmLauncher is None: + vmLauncher = lambda vmArgs, mainClass, mainClassArgs: mx.run_java(vmArgs + [mainClass] + mainClassArgs) + + try: + _run_tests(args, harness, vmLauncher, annotations, testfile, blacklist, whitelist, regex) + finally: + if os.environ.get('MX_TESTFILE') is None: + os.remove(testfile) + +unittestHelpSuffix = """ + Unittest options: + + --blacklist run all testcases not specified in the blacklist + --whitelist run only testcases which are included + in the given whitelist + --verbose enable verbose JUnit output + --fail-fast stop after first JUnit test class that has a failure + --enable-timing enable JUnit test timing + --regex run only testcases matching a regular expression + --color enable colors output + --eager-stacktrace print stacktrace eagerly + --gc-after-test force a GC after each test + + To avoid conflicts with VM options '--' can be used as delimiter. + + If filters are supplied, only tests whose fully qualified name + includes a filter as a substring are run. + + For example, this command line: + + mx unittest -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG BC_aload + + will run all JUnit test classes that contain 'BC_aload' in their + fully qualified name and will pass these options to the VM: + + -G:Dump= -G:MethodFilter=BC_aload.* -G:+PrintCFG + + To get around command line length limitations on some OSes, the + JUnit class names to be executed are written to a file that a + custom JUnit wrapper reads and passes onto JUnit proper. The + MX_TESTFILE environment variable can be set to specify a + file which will not be deleted once the unittests are done + (unlike the temporary file otherwise used). + + As with all other commands, using the global '-v' before 'unittest' + command will cause mx to show the complete command line + it uses to run the VM. +""" + +def unittest(args, vmLauncher=None): + """run the JUnit tests (all testcases)""" + + parser = ArgumentParser(prog='mx unittest', + description='run the JUnit tests', + add_help=False, + formatter_class=RawDescriptionHelpFormatter, + epilog=unittestHelpSuffix, + ) + parser.add_argument('--blacklist', help='run all testcases not specified in ', metavar='') + parser.add_argument('--whitelist', help='run testcases specified in only', metavar='') + parser.add_argument('--verbose', help='enable verbose JUnit output', action='store_true') + parser.add_argument('--fail-fast', help='stop after first JUnit test class that has a failure', action='store_true') + parser.add_argument('--enable-timing', help='enable JUnit test timing', action='store_true') + parser.add_argument('--regex', help='run only testcases matching a regular expression', metavar='') + parser.add_argument('--color', help='enable color output', action='store_true') + parser.add_argument('--eager-stacktrace', help='print stacktrace eagerly', action='store_true') + parser.add_argument('--gc-after-test', help='force a GC after each test', action='store_true') + + ut_args = [] + delimiter = False + # check for delimiter + while len(args) > 0: + arg = args.pop(0) + if arg == '--': + delimiter = True + break + ut_args.append(arg) + + if delimiter: + # all arguments before '--' must be recognized + parsed_args = parser.parse_args(ut_args) + else: + # parse all know arguments + parsed_args, args = parser.parse_known_args(ut_args) + + if parsed_args.whitelist: + try: + with open(parsed_args.whitelist) as fp: + parsed_args.whitelist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] + except IOError: + mx.log('warning: could not read whitelist: ' + parsed_args.whitelist) + if parsed_args.blacklist: + try: + with open(parsed_args.blacklist) as fp: + parsed_args.blacklist = [re.compile(fnmatch.translate(l.rstrip())) for l in fp.readlines() if not l.startswith('#')] + except IOError: + mx.log('warning: could not read blacklist: ' + parsed_args.blacklist) + + _unittest(args, ['@Test', '@Parameters'], vmLauncher=vmLauncher, **parsed_args.__dict__)