From 94635f33e7654b30139e987a7cd6aa360ca631e9 Mon Sep 17 00:00:00 2001 From: acolyer Date: Fri, 24 Feb 2006 15:01:01 +0000 Subject: Completed: Improve ajc memory usage incremental tests need to ensure that AjState runs in incremental mode! --- .../testing/drivers/AjcHarnessTestsUsingJUnit.java | 18 ++++++++++++++++++ .../org/aspectj/testing/drivers/AjctestsAdapter.java | 3 +++ .../systemtest/incremental/IncrementalTests.java | 13 +++++++++++++ .../tools/MultiProjectIncrementalTests.java | 6 ++++++ 4 files changed, 40 insertions(+) diff --git a/testing-drivers/testsrc/org/aspectj/testing/drivers/AjcHarnessTestsUsingJUnit.java b/testing-drivers/testsrc/org/aspectj/testing/drivers/AjcHarnessTestsUsingJUnit.java index d91419c15..17b6eeb21 100644 --- a/testing-drivers/testsrc/org/aspectj/testing/drivers/AjcHarnessTestsUsingJUnit.java +++ b/testing-drivers/testsrc/org/aspectj/testing/drivers/AjcHarnessTestsUsingJUnit.java @@ -12,6 +12,8 @@ package org.aspectj.testing.drivers; +import org.aspectj.ajdt.internal.core.builder.AjState; + import junit.framework.*; /* @@ -42,4 +44,20 @@ public class AjcHarnessTestsUsingJUnit extends TestCase { public AjcHarnessTestsUsingJUnit(String name) { super(name); } + + /* (non-Javadoc) + * @see junit.framework.TestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; + } + + /* (non-Javadoc) + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + super.tearDown(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; + } } diff --git a/testing-drivers/testsrc/org/aspectj/testing/drivers/AjctestsAdapter.java b/testing-drivers/testsrc/org/aspectj/testing/drivers/AjctestsAdapter.java index af326dbfa..b5eb7666c 100644 --- a/testing-drivers/testsrc/org/aspectj/testing/drivers/AjctestsAdapter.java +++ b/testing-drivers/testsrc/org/aspectj/testing/drivers/AjctestsAdapter.java @@ -23,6 +23,7 @@ import junit.framework.TestCase; import junit.framework.TestResult; import junit.framework.TestSuite; +import org.aspectj.ajdt.internal.core.builder.AjState; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IMessageHolder; import org.aspectj.bridge.MessageHandler; @@ -388,11 +389,13 @@ public class AjctestsAdapter extends TestSuite { throw new Error("need to re-init"); } try { + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; result.startTest(this); suite.runTest(this, result); } finally { result.endTest(this); suite = null; + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; } } diff --git a/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java index 9be1dbd4c..3b7aefce3 100644 --- a/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/IncrementalTests.java @@ -29,6 +29,19 @@ public class IncrementalTests extends org.aspectj.testing.XMLBasedAjcTestCase { } + /* (non-Javadoc) + * @see org.aspectj.testing.XMLBasedAjcTestCase#setUp() + */ + protected void setUp() throws Exception { + super.setUp(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; + } + + protected void tearDown() throws Exception { + super.tearDown(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; + } + public void test001() throws Exception { runTest("expect class added in initial incremental tests"); nextIncrement(false); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 202b8beee..af2f9b57b 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -52,6 +52,12 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { protected void setUp() throws Exception { super.setUp(); AjdeInteractionTestbed.VERBOSE = VERBOSE; + AjState.FORCE_INCREMENTAL_DURING_TESTING = true; + } + + protected void tearDown() throws Exception { + super.tearDown(); + AjState.FORCE_INCREMENTAL_DURING_TESTING = false; } -- cgit v1.2.3