# HG changeset patch # User Doug Simon # Date 1339417323 -7200 # Node ID 4b47c0898e89b3270edfa0d93b7c8caec65669b8 # Parent 525cff3d90267a688e2c2b0d93445860907282aa added debug scopes to some tests replaced usages of AssertionFailedError with AssertionError diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/DegeneratedLoopsTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/DegeneratedLoopsTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/DegeneratedLoopsTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -73,15 +73,19 @@ } - private void test(String snippet) { - StructuredGraph graph = parse(snippet); - Debug.dump(graph, "Graph"); - for (Invoke invoke : graph.getInvokes()) { - invoke.intrinsify(null); - } - new CanonicalizerPhase(null, runtime(), null).apply(graph); - StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); - Debug.dump(referenceGraph, "Graph"); - assertEquals(referenceGraph, graph); + private void test(final String snippet) { + Debug.scope("DegeneratedLoopsTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { + StructuredGraph graph = parse(snippet); + Debug.dump(graph, "Graph"); + for (Invoke invoke : graph.getInvokes()) { + invoke.intrinsify(null); + } + new CanonicalizerPhase(null, runtime(), null).apply(graph); + StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); + Debug.dump(referenceGraph, "Graph"); + assertEquals(referenceGraph, graph); + } + }); } } diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/EscapeAnalysisTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -116,31 +116,35 @@ } } - private void test(String snippet, Constant expectedResult) { - StructuredGraph graph = parse(snippet); - for (Invoke n : graph.getInvokes()) { - n.node().setProbability(100000); - } + private void test(final String snippet, final Constant expectedResult) { + Debug.scope("ScalarTypeSystemTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { + StructuredGraph graph = parse(snippet); + for (Invoke n : graph.getInvokes()) { + n.node().setProbability(100000); + } - new InliningPhase(null, runtime(), null, null, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - new DeadCodeEliminationPhase().apply(graph); - Debug.dump(graph, "Graph"); - new EscapeAnalysisPhase(null, runtime(), null, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); - Debug.dump(graph, "Graph"); - int retCount = 0; - for (ReturnNode ret : graph.getNodes(ReturnNode.class)) { - Assert.assertTrue(ret.result().isConstant()); - Assert.assertEquals(ret.result().asConstant(), expectedResult); - retCount++; - } - Assert.assertEquals(1, retCount); - int newInstanceCount = 0; - for (@SuppressWarnings("unused") NewInstanceNode n : graph.getNodes(NewInstanceNode.class)) { - newInstanceCount++; - } - for (@SuppressWarnings("unused") NewObjectArrayNode n : graph.getNodes(NewObjectArrayNode.class)) { - newInstanceCount++; - } - Assert.assertEquals(0, newInstanceCount); + new InliningPhase(null, runtime(), null, null, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + new DeadCodeEliminationPhase().apply(graph); + Debug.dump(graph, "Graph"); + new EscapeAnalysisPhase(null, runtime(), null, null, getDefaultPhasePlan(), OptimisticOptimizations.ALL).apply(graph); + Debug.dump(graph, "Graph"); + int retCount = 0; + for (ReturnNode ret : graph.getNodes(ReturnNode.class)) { + Assert.assertTrue(ret.result().isConstant()); + Assert.assertEquals(ret.result().asConstant(), expectedResult); + retCount++; + } + Assert.assertEquals(1, retCount); + int newInstanceCount = 0; + for (@SuppressWarnings("unused") NewInstanceNode n : graph.getNodes(NewInstanceNode.class)) { + newInstanceCount++; + } + for (@SuppressWarnings("unused") NewObjectArrayNode n : graph.getNodes(NewObjectArrayNode.class)) { + newInstanceCount++; + } + Assert.assertEquals(0, newInstanceCount); + } + }); } } diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/FloatingReadTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/FloatingReadTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/FloatingReadTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -25,6 +25,7 @@ import org.junit.*; import com.oracle.graal.compiler.phases.*; +import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.extended.*; @@ -50,28 +51,32 @@ test("test1Snippet"); } - private void test(String snippet) { - StructuredGraph graph = parse(snippet); - new LoweringPhase(runtime(), null).apply(graph); - new FloatingReadPhase().apply(graph); + private void test(final String snippet) { + Debug.scope("FloatingReadTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { + StructuredGraph graph = parse(snippet); + new LoweringPhase(runtime(), null).apply(graph); + new FloatingReadPhase().apply(graph); - ReturnNode returnNode = null; - MonitorExitNode monitor = null; + ReturnNode returnNode = null; + MonitorExitNode monitor = null; - for (Node n : graph.getNodes()) { - if (n instanceof ReturnNode) { - returnNode = (ReturnNode) n; - } else if (n instanceof MonitorExitNode) { - monitor = (MonitorExitNode) n; - } - } + for (Node n : graph.getNodes()) { + if (n instanceof ReturnNode) { + returnNode = (ReturnNode) n; + } else if (n instanceof MonitorExitNode) { + monitor = (MonitorExitNode) n; + } + } - Assert.assertNotNull(returnNode); - Assert.assertNotNull(monitor); - Assert.assertTrue(returnNode.result() instanceof FloatingReadNode); + Assert.assertNotNull(returnNode); + Assert.assertNotNull(monitor); + Assert.assertTrue(returnNode.result() instanceof FloatingReadNode); - FloatingReadNode read = (FloatingReadNode) returnNode.result(); + FloatingReadNode read = (FloatingReadNode) returnNode.result(); - assertOrderedAfterSchedule(graph, read, monitor); + assertOrderedAfterSchedule(graph, read, monitor); + } + }); } } diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/MonitorTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/MonitorTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/MonitorTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -26,10 +26,7 @@ import java.util.*; -import junit.framework.*; - -import org.junit.Assert; -import org.junit.Test; +import org.junit.*; import com.oracle.graal.compiler.*; import com.oracle.graal.compiler.phases.*; @@ -56,7 +53,7 @@ return 1; } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test1() { test("test1Snippet"); } diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ScalarTypeSystemTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ScalarTypeSystemTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/ScalarTypeSystemTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.tests; -import junit.framework.AssertionFailedError; - import org.junit.*; import com.oracle.graal.compiler.phases.*; @@ -43,7 +41,7 @@ } } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test1() { test("test1Snippet", "referenceSnippet1"); } @@ -60,7 +58,7 @@ } } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test2() { test("test2Snippet", "referenceSnippet1"); } @@ -77,7 +75,7 @@ } } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test3() { test("test3Snippet", "referenceSnippet2"); } @@ -144,7 +142,7 @@ } } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test6() { test("test6Snippet", "referenceSnippet3"); } @@ -161,14 +159,18 @@ } } - private void test(String snippet, String referenceSnippet) { - StructuredGraph graph = parse(snippet); - Debug.dump(graph, "Graph"); -// TypeSystemTest.outputGraph(graph); - new CanonicalizerPhase(null, runtime(), null).apply(graph); - new CheckCastEliminationPhase().apply(graph); - new CanonicalizerPhase(null, runtime(), null).apply(graph); - StructuredGraph referenceGraph = parse(referenceSnippet); - assertEquals(referenceGraph, graph); + private void test(final String snippet, final String referenceSnippet) { + Debug.scope("ScalarTypeSystemTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { + StructuredGraph graph = parse(snippet); + Debug.dump(graph, "Graph"); +// TypeSystemTest.outputGraph(graph); + new CanonicalizerPhase(null, runtime(), null).apply(graph); + new CheckCastEliminationPhase().apply(graph); + new CanonicalizerPhase(null, runtime(), null).apply(graph); + StructuredGraph referenceGraph = parse(referenceSnippet); + assertEquals(referenceGraph, graph); + } + }); } } diff -r 525cff3d9026 -r 4b47c0898e89 graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/StraighteningTest.java --- a/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/StraighteningTest.java Sun Jun 10 21:03:15 2012 +0200 +++ b/graal/com.oracle.graal.tests/src/com/oracle/graal/compiler/tests/StraighteningTest.java Mon Jun 11 14:22:03 2012 +0200 @@ -22,8 +22,6 @@ */ package com.oracle.graal.compiler.tests; -import junit.framework.AssertionFailedError; - import org.junit.*; import com.oracle.graal.compiler.phases.*; @@ -71,26 +69,30 @@ return c == 1; } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test1() { test("test1Snippet"); } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test2() { test("test2Snippet"); } - @Test(expected = AssertionFailedError.class) + @Test(expected = AssertionError.class) public void test3() { test("test3Snippet"); } - private void test(String snippet) { - StructuredGraph graph = parse(snippet); - Debug.dump(graph, "Graph"); - new CanonicalizerPhase(null, runtime(), null).apply(graph); - StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); - assertEquals(referenceGraph, graph); + private void test(final String snippet) { + Debug.scope("StraighteningTest", new DebugDumpScope(snippet), new Runnable() { + public void run() { + StructuredGraph graph = parse(snippet); + Debug.dump(graph, "Graph"); + new CanonicalizerPhase(null, runtime(), null).apply(graph); + StructuredGraph referenceGraph = parse(REFERENCE_SNIPPET); + assertEquals(referenceGraph, graph); + } + }); } }