diff options
author | wisberg <wisberg> | 2003-10-31 19:31:22 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-10-31 19:31:22 +0000 |
commit | dd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4 (patch) | |
tree | 46d12745237ab6cfa48b7af5be91ab41b57431ce | |
parent | 458b26fe1241d3457ff8161ac8d18daa700a6cb0 (diff) | |
download | aspectj-dd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4.tar.gz aspectj-dd5ef5ce8c31ef643d2f1a40a0cfcf46e32ca6e4.zip |
using ../{module}/ convention for testdata references so tests can be run from any peer directory/module, i.e., from one module
5 files changed, 24 insertions, 14 deletions
diff --git a/testing-util/testsrc/org/aspectj/testing/util/TestUtilTest.java b/testing-util/testsrc/org/aspectj/testing/util/TestUtilTest.java index e884fb143..11a68d5c4 100644 --- a/testing-util/testsrc/org/aspectj/testing/util/TestUtilTest.java +++ b/testing-util/testsrc/org/aspectj/testing/util/TestUtilTest.java @@ -15,6 +15,7 @@ package org.aspectj.testing.util; import org.aspectj.bridge.MessageHandler; import org.aspectj.bridge.MessageUtil; +import org.aspectj.util.*; import org.aspectj.util.FileUtil; import java.io.File; @@ -33,7 +34,7 @@ public class TestUtilTest extends TestCase { public void testFileCompareNonClass() throws IOException { MessageHandler holder = new MessageHandler(); - File thisFile = new File("testsrc/org/aspectj/testing/util/TestUtilTest.java"); + File thisFile = new File(UtilTests.TESTING_UTIL_PATH + "/testsrc/org/aspectj/testing/util/TestUtilTest.java"); //File thisFile = new File("src/testing-util.lst"); assertTrue(TestUtil.sameFiles(holder, thisFile, thisFile)); @@ -66,7 +67,7 @@ public class TestUtilTest extends TestCase { public void testFileCompareNonClassStaticPositive() throws IOException { MessageHandler holder = new MessageHandler(); - File basedir = new File("testdata/testCompareTextFiles/sameFile"); + File basedir = new File(UtilTests.TESTING_UTIL_PATH + "/testdata/testCompareTextFiles/sameFile"); File expectedBaseDir = new File(basedir, "expected"); File actualBaseDir = new File(basedir, "actual"); String filename = "TestUtilTest.java"; @@ -98,7 +99,7 @@ public class TestUtilTest extends TestCase { return; } MessageHandler holder = new MessageHandler(); - File classBase = new File("testdata/testCompareClassFiles"); + File classBase = new File(UtilTests.TESTING_UTIL_PATH + "/testdata/testCompareClassFiles"); String path = "org/aspectj/testing/util/TestCompareClassFile.class"; File classFile = new File(classBase, path); diff --git a/testing-util/testsrc/org/aspectj/testing/util/UtilTests.java b/testing-util/testsrc/org/aspectj/testing/util/UtilTests.java index a32bd424c..cd36e8b60 100644 --- a/testing-util/testsrc/org/aspectj/testing/util/UtilTests.java +++ b/testing-util/testsrc/org/aspectj/testing/util/UtilTests.java @@ -18,6 +18,7 @@ import junit.framework.*; public class UtilTests extends TestCase { + public static final String TESTING_UTIL_PATH = "../testing-util"; public static Test suite() { TestSuite suite = new TestSuite(UtilTests.class.getName()); // for now, do not include SuiteTest because it would take 15 minutes diff --git a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java index 88a72d815..d0eff4d15 100644 --- a/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java +++ b/weaver/testsrc/org/aspectj/weaver/BcweaverTests.java @@ -17,6 +17,7 @@ import junit.framework.*; public class BcweaverTests extends TestCase { + public static final String TESTDATA_PATH = "../weaver/testdata"; public static Test suite() { TestSuite suite = new TestSuite(BcweaverTests.class.getName()); // abstract diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java index d4024bc7c..0f39caaf7 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/WeaveTestCase.java @@ -130,10 +130,10 @@ public abstract class WeaveTestCase extends TestCase { if (regenerate) genClass(gen, outDir, expectedFile); else realCheckClass(gen, outDir, expectedFile); } - + static final File TESTDATA_DIR = new File("../weaver/testdata"); void genClass(LazyClassGen gen, String outDir, String expectedFile) throws IOException { //ClassGen b = getJavaClass(outDir, className); - FileOutputStream out = new FileOutputStream(new File("testdata", expectedFile)); + FileOutputStream out = new FileOutputStream(new File(TESTDATA_DIR, expectedFile)); PrintStream ps = new PrintStream(out); gen.print(ps); ps.flush(); @@ -142,7 +142,7 @@ public abstract class WeaveTestCase extends TestCase { void realCheckClass(LazyClassGen gen, String outDir, String expectedFile) throws IOException { TestUtil.assertMultiLineStringEquals("classes", - FileUtil.readAsString(new File("testdata", expectedFile)), + FileUtil.readAsString(new File(TESTDATA_DIR, expectedFile)), gen.toLongString()); } @@ -263,7 +263,7 @@ public abstract class WeaveTestCase extends TestCase { } public String getTraceJar() { - return "testdata/tracing.jar"; + return BcweaverTests.TESTDATA_PATH + "/tracing.jar"; } // ---- diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java index ecc961a75..f3f63142d 100644 --- a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java +++ b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java @@ -16,6 +16,8 @@ package org.aspectj.weaver.bcel; import java.io.*; import java.util.Collection; +import org.aspectj.weaver.BcweaverTests; + import junit.framework.TestCase; public class ZipTestCase extends TestCase { @@ -51,7 +53,7 @@ public class ZipTestCase extends TestCase { weaver.addLibraryJarFile(new File(aspectjar)); } } - weaver.addLibraryJarFile(new File("testdata/Regex.jar")); //??? + weaver.addLibraryJarFile(new File(BcweaverTests.TESTDATA_PATH + "/Regex.jar")); //??? Collection woven = weaver.weave(outFile); @@ -64,17 +66,19 @@ public class ZipTestCase extends TestCase { } public void testSmall() throws IOException { - zipTest("testdata/Regex.jar", null); + zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", null); } public void testSmallWithAspects() throws IOException { System.out.println("could take 4 seconds..."); - zipTest("testdata/Regex.jar", "testdata/megatrace.jar"); + zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", + BcweaverTests.TESTDATA_PATH + "/megatrace.jar"); } public void testSmallWithAspectsNoWeave() throws IOException { System.out.println("could take 4 seconds..."); - zipTest("testdata/Regex.jar", "testdata/megatraceNoweave.jar", true); + zipTest(BcweaverTests.TESTDATA_PATH + "/Regex.jar", + BcweaverTests.TESTDATA_PATH + "/megatraceNoweave.jar", true); } @@ -86,19 +90,22 @@ public class ZipTestCase extends TestCase { public void testBigWithEasyNoTrace() throws IOException { System.out.println("could take 4 seconds..."); - zipTest("../lib/bcel/bcel.jar", "testdata/megatrace0easy.jar"); + zipTest("../lib/bcel/bcel.jar", + BcweaverTests.TESTDATA_PATH + "/megatrace0easy.jar"); } // this is something we test every now and again. public void xtestBigWithHardNoTrace() throws IOException { System.out.println("could take 24 seconds..."); - zipTest("../lib/bcel/bcel.jar", "testdata/megatrace0hard.jar"); + zipTest("../lib/bcel/bcel.jar", + BcweaverTests.TESTDATA_PATH + "/megatrace0hard.jar"); } public void xtestBigWithAspects() throws IOException { System.out.println("could take 40 seconds..."); - zipTest("../lib/bcel/bcel.jar", "testdata/megatrace.jar"); + zipTest("../lib/bcel/bcel.jar", + BcweaverTests.TESTDATA_PATH + "/megatrace.jar"); } } |