summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-06-08 15:03:48 +0000
committeracolyer <acolyer>2004-06-08 15:03:48 +0000
commit33ae558f9a81b8a059a4f909b8c630bd6d8390ab (patch)
treecc50c58a3ffbf4597bb5b83cfb2ddcfacb29f26a /weaver
parent685ad4356300bdd6bad7451521f98a413a0ac726 (diff)
downloadaspectj-33ae558f9a81b8a059a4f909b8c630bd6d8390ab.tar.gz
aspectj-33ae558f9a81b8a059a4f909b8c630bd6d8390ab.zip
ensure tests don't give false failures on fast machines
Diffstat (limited to 'weaver')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
index 5df1e2cfb..8b03c28c0 100644
--- a/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/bcel/ZipTestCase.java
@@ -56,6 +56,12 @@ public class ZipTestCase extends TestCase {
BcelWeaver weaver = new BcelWeaver(world);
long startTime = System.currentTimeMillis();
+ // ensure that a fast cpu doesn't complete file write within 1000ms of start
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
weaver.addJarFile(inFile, new File("."),false);
if (aspectjar != null) {
if (isInJar) {
@@ -73,6 +79,9 @@ public class ZipTestCase extends TestCase {
System.out.println("handled " + woven.size() + " entries, in " +
(stopTime-startTime)/1000. + " seconds");
+ // last mod times on linux (at least) are only accurate to the second.
+ // with fast disks and a fast cpu the following test can fail if the write completes less than
+ // 1000 milliseconds after the start of the test, hence the 1000ms delay added above.
assertTrue(outFile.lastModified() > startTime);
}