# HG changeset patch # User Gilles Duboscq # Date 1364235723 -3600 # Node ID b2161263e9f2de7b8510f0780d9775ec870656b1 # Parent 149dee7367e0d07c30b36044ff0a958c0fc0d626 Cleanup unit tests : they should not print to stdout/stderr diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java --- a/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.api.meta.test/src/com/oracle/graal/api/meta/test/TestMetaAccessProvider.java Mon Mar 25 19:22:03 2013 +0100 @@ -116,10 +116,6 @@ } } - static { - System.out.println(classes.size() + " classes"); - } - public static final List constants = new ArrayList<>(); static { for (Field f : Constant.class.getDeclaredFields()) { @@ -149,10 +145,6 @@ constants.add(Constant.forObject(42)); } - static { - System.out.println(constants.size() + " constants"); - } - @Test public void lookupJavaTypeTest() { for (Class c : classes) { diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalAPITest.java --- a/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalAPITest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.api.test/src/com/oracle/graal/api/test/GraalAPITest.java Mon Mar 25 19:22:03 2013 +0100 @@ -33,12 +33,10 @@ @Test public void testRuntimeAvailable() { assertNotNull(Graal.getRuntime()); - System.out.println(Graal.getRuntime().getClass()); } @Test public void testRuntimeNamed() { assertNotNull(Graal.getRuntime().getName()); - System.out.println(Graal.getRuntime().getName()); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java --- a/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.compiler.ptx.test/src/com/oracle/graal/compiler/ptx/test/BasicPTXTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -61,7 +61,7 @@ return array[0]; } - private void test(String snippet) { + private CompilationResult test(String snippet) { StructuredGraph graph = parse(snippet); Debug.dump(graph, "Graph"); TargetDescription target = new TargetDescription(new PTX(), true, 1, 0, true); @@ -72,14 +72,13 @@ phasePlan.addPhase(PhasePosition.AFTER_PARSING, new PTXPhase()); new PTXPhase().apply(graph); CompilationResult result = GraalCompiler.compileMethod(runtime, ptxBackend, target, graph.method(), graph, null, phasePlan, OptimisticOptimizations.NONE, new SpeculationLog()); - System.out.println("result=" + result); + return result; } private static class PTXPhase extends Phase { @Override protected void run(StructuredGraph graph) { - System.out.println("PTX phase"); for (LocalNode local : graph.getNodes(LocalNode.class)) { if (local.kind() == Kind.Object) { local.setStamp(StampFactory.declaredNonNull(local.objectStamp().type())); @@ -88,4 +87,10 @@ } } + + public static void main(String[] args) { + BasicPTXTest basicPTXTest = new BasicPTXTest(); + System.out.println("testAddSnippet: \n" + new String(basicPTXTest.test("testAddSnippet").getTargetCode())); + System.out.println("testArraySnippet: \n" + new String(basicPTXTest.test("testArraySnippet").getTargetCode())); + } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java --- a/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.compiler.ptx/src/com/oracle/graal/compiler/ptx/PTXBackend.java Mon Mar 25 19:22:03 2013 +0100 @@ -86,7 +86,6 @@ Signature signature = method.getSignature(); for (int i = 0; i < signature.getParameterCount(false); i++) { - System.err.println(i + ": " + signature.getParameterKind(i)); String param = ".param .u32 param" + i; codeBuffer.emitString(param); } @@ -104,8 +103,5 @@ // Emit the epilogue codeBuffer.emitString0("}"); codeBuffer.emitString(""); - - byte[] data = codeBuffer.copyData(0, codeBuffer.position()); - System.err.println(new String(data)); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Except_Locals.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Except_Locals.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/except/Except_Locals.java Mon Mar 25 19:22:03 2013 +0100 @@ -37,7 +37,6 @@ x = 2; b.toString(); } catch (NullPointerException e) { - // System.out.println(x); return x; } return -1; diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_life.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_life.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotpath/HP_life.java Mon Mar 25 19:22:03 2013 +0100 @@ -41,7 +41,6 @@ for (int row = 0; row < rows; ++row) { for (int col = 0; col < cols; ++col) { boolean value = cell(row, col); - // System.out.print(value ? "1" : "0"); sum += (row * 15223242 + col * 21623234) ^ ((value ? 1 : 0) * 15323142); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6823354.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6823354.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/hotspot/Test6823354.java Mon Mar 25 19:22:03 2013 +0100 @@ -166,13 +166,11 @@ } static void check(int value, int result, int expected) { - //System.out.println(value + ": " + result + ", " + expected); if (result != expected) throw new InternalError(value + " failed: " + result + " != " + expected); } static void check(long value, long result, long expected) { - //System.out.println(value + ": " + result + ", " + expected); if (result != expected) throw new InternalError(value + " failed: " + result + " != " + expected); } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Thread_setName.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Thread_setName.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/Thread_setName.java Mon Mar 25 19:22:03 2013 +0100 @@ -37,10 +37,6 @@ return name2; } - public static void main(String[] args) throws Exception { - System.out.println(test("abc")); - } - @Test public void run0() throws Throwable { runTest("test", "abc"); diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/NCE_FlowSensitive05.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/NCE_FlowSensitive05.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/NCE_FlowSensitive05.java Mon Mar 25 19:22:03 2013 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.graal.jtt.optimize; +import java.io.*; + import com.oracle.graal.test.*; import com.oracle.graal.jtt.*; @@ -29,11 +31,13 @@ */ public class NCE_FlowSensitive05 extends JTTTest { + private static PrintStream ps = new PrintStream(new ByteArrayOutputStream()); + public static String test(Object arg) { // An artificial loop to trigger iterative NCE. while (arg != null) { - System.out.println(arg); + ps.println(arg); } // The upcast must still include the null check. diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/TypeCastElem.java --- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/TypeCastElem.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/optimize/TypeCastElem.java Mon Mar 25 19:22:03 2013 +0100 @@ -135,10 +135,6 @@ return result; } - public static void main(String[] args) { - System.out.println(test(10, 13, 25)); - } - @Test public void run0() throws Throwable { runTest("test", 10, 13, 25); diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/MonitorTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/MonitorTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/MonitorTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -174,8 +174,6 @@ } public static String copyObj(Chars src, Chars dst, int n) { - System.out.println(Thread.currentThread().getName() + " reps=" + n + ", src.length=" + src.data.length); - int total = 0; for (int j = 0; j < n; j++) { for (int i = 0; i < src.data.length; i++) { synchronized (src) { @@ -183,20 +181,16 @@ synchronized (src) { synchronized (dst) { dst.data[i] = src.data[i]; - total++; } } } } } } - System.out.println(Thread.currentThread().getName() + " total " + total); return new String(dst.data); } public static String copyArr(char[] src, char[] dst, int n) { - System.out.println(Thread.currentThread().getName() + " reps=" + n + ", src.length=" + src.length); - int total = 0; for (int j = 0; j < n; j++) { for (int i = 0; i < src.length; i++) { synchronized (src) { @@ -204,14 +198,12 @@ synchronized (src) { synchronized (dst) { dst[i] = src[i]; - total++; } } } } } } - System.out.println(Thread.currentThread().getName() + " total " + total); return new String(dst); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AbstractTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -57,7 +57,7 @@ PrintStream origErr = System.err; System.setErr(printer); - SimpleLanguage.run(in, printer, REPEATS, true); + SimpleLanguage.run(in, printer, REPEATS, false); System.setErr(origErr); Assert.assertEquals(repeat(concat(expectedOutput), REPEATS), new String(out.toByteArray())); diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AddTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AddTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/AddTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -51,6 +51,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ComparisonTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ComparisonTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/ComparisonTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -51,6 +51,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/DivTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/DivTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/DivTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -45,6 +45,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopPrintTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopPrintTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopPrintTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -43,6 +43,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/LoopTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -43,6 +43,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/MulTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/MulTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/MulTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -45,6 +45,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SubTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SubTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SubTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -45,6 +45,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SumTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SumTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SumTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -45,6 +45,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/TernaryTest.java --- a/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/TernaryTest.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/TernaryTest.java Mon Mar 25 19:22:03 2013 +0100 @@ -47,6 +47,6 @@ @Test public void test() { - executeSL(INPUT, OUTPUT, true); + executeSL(INPUT, OUTPUT, false); } } diff -r 149dee7367e0 -r b2161263e9f2 graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java --- a/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java Mon Mar 25 15:59:26 2013 +0100 +++ b/graal/com.oracle.truffle.sl/src/com/oracle/truffle/sl/SimpleLanguage.java Mon Mar 25 19:22:03 2013 +0100 @@ -36,7 +36,9 @@ } public static void run(InputStream input, PrintStream printOutput, int repeats, boolean log) { - System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); + if (log) { + System.out.printf("== running on %s\n", Truffle.getRuntime().getName()); + } NodeFactory factory = new NodeFactory(printOutput);