# HG changeset patch # User Doug Simon # Date 1397570992 -7200 # Node ID 0d296283e87d289e75819e89f019fa4faa90de4c # Parent de406a971984c20f098bffd3360cc8a5cb94dda1 HSAIL: suppressed output in unit tests diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringConcatTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringConcatTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringConcatTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -22,8 +22,12 @@ */ package com.oracle.graal.compiler.hsail.test; +import static com.oracle.graal.debug.Debug.*; + import org.junit.Test; +import com.oracle.graal.debug.*; + /** * Tests allocation of a new String based on string concatenation. */ @@ -49,6 +53,8 @@ // Node implementing Lowerable not handled in HSAIL Backend: 6274|MonitorEnter @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringInternTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringInternTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/EscapingNewStringInternTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -22,8 +22,12 @@ */ package com.oracle.graal.compiler.hsail.test; +import static com.oracle.graal.debug.Debug.*; + import org.junit.Test; +import com.oracle.graal.debug.*; + /** * Tests allocation of a new String based on string interning. */ @@ -37,6 +41,8 @@ // at node: 12|Invoke#Direct#intern @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/ArrayListGetTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/ArrayListGetTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/ArrayListGetTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,8 +23,13 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import org.junit.Test; + import java.util.ArrayList; /** @@ -56,7 +61,9 @@ // NYI emitForeignCall charAlignedDisjointArraycopy @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/AtomicIntAddAndGetGidTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/AtomicIntAddAndGetGidTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/AtomicIntAddAndGetGidTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -57,11 +57,11 @@ // note: the actual order of entries in outArray is not predictable // thus we sort before we compare results Arrays.sort(outArray); - System.out.print("outArray: "); - for (int val : outArray) { - System.out.print(val + ", "); - } - System.out.println(); +// System.out.print("outArray: "); +// for (int val : outArray) { +// System.out.print(val + ", "); +// } +// System.out.println(); // create array of gaps gaps[0] = outArray[0] - 0; for (int i = 1; i < NUM; i++) { diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/HashMapGetTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/HashMapGetTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/HashMapGetTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,8 +23,13 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import java.util.HashMap; + import org.junit.Test; /** @@ -88,12 +93,16 @@ // type profile exists @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/LongAdderTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/LongAdderTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/LongAdderTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,8 +23,13 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; +import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; import java.util.concurrent.atomic.LongAdder; + import org.junit.Test; /** @@ -53,11 +58,15 @@ // cannot handle node: CurrentJavaThread @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope dcs = setConfig(new DelegatingDebugConfig().disable(INTERCEPT))) { + testGeneratedHsail(); + } } @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope dcs = setConfig(new DelegatingDebugConfig().disable(INTERCEPT))) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NewStringEqualsTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NewStringEqualsTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NewStringEqualsTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,7 +23,11 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import org.junit.Test; /** @@ -62,12 +66,16 @@ // NYI emitForeignCall charAlignedDisjointArraycopy @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NonEscapingNewObjWithArrayTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NonEscapingNewObjWithArrayTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/NonEscapingNewObjWithArrayTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,8 +23,14 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; +import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import org.junit.Test; + import java.util.Arrays; /** @@ -74,12 +80,16 @@ // NYI emitForeignCall floatArraycopy @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope dcs = setConfig(new DelegatingDebugConfig().disable(INTERCEPT))) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/SynchronizedMethodTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/SynchronizedMethodTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/SynchronizedMethodTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,7 +23,11 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import org.junit.Test; /** @@ -58,13 +62,17 @@ // cannot handle the BeginLockScope node @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } // cannot handle the BeginLockScope node @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/VirtualCallTest.java --- a/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/VirtualCallTest.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.compiler.hsail.test/src/com/oracle/graal/compiler/hsail/test/lambda/VirtualCallTest.java Tue Apr 15 16:09:52 2014 +0200 @@ -23,7 +23,11 @@ package com.oracle.graal.compiler.hsail.test.lambda; +import static com.oracle.graal.debug.Debug.*; + import com.oracle.graal.compiler.hsail.test.infra.GraalKernelTester; +import com.oracle.graal.debug.*; + import org.junit.Test; /** @@ -92,12 +96,16 @@ // graal says not inlining getArea():float (0 bytes): no type profile exists @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void test() { - testGeneratedHsail(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsail(); + } } @Test(expected = com.oracle.graal.graph.GraalInternalError.class) public void testUsingLambdaMethod() { - testGeneratedHsailUsingLambdaMethod(); + try (DebugConfigScope s = disableIntercept()) { + testGeneratedHsailUsingLambdaMethod(); + } } } diff -r de406a971984 -r 0d296283e87d graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Tue Apr 15 15:37:35 2014 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Tue Apr 15 16:09:52 2014 +0200 @@ -264,6 +264,24 @@ } /** + * Opens a scope in which exception {@linkplain DebugConfig#interceptException(Throwable) + * interception} is disabled. It is recommended to use the try-with-resource statement for + * managing entering and leaving such scopes: + * + *
+     * try (DebugConfigScope s = Debug.disableIntercept()) {
+     *     ...
+     * }
+     * 
+ * + * This is particularly useful to suppress extraneous output in JUnit tests that are expected to + * throw an exception. + */ + public static DebugConfigScope disableIntercept() { + return Debug.setConfig(new DelegatingDebugConfig().disable(INTERCEPT)); + } + + /** * Handles an exception in the context of the debug scope just exited. The just exited scope * must have the current scope as its parent which will be the case if the try-with-resource * pattern recommended by {@link #scope(Object)} and