aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2010-02-10 15:00:12 -0800
committerShawn O. Pearce <spearce@spearce.org>2010-02-10 15:00:12 -0800
commit908bfb6805eca9cb96a2cff0477256d2e47ad456 (patch)
tree555b83cb9770547ad251eae5cfff67e09868e381 /org.eclipse.jgit.test/tst/org/eclipse/jgit
parente54d33b6873f0b392640f9200398861210ac9374 (diff)
downloadjgit-908bfb6805eca9cb96a2cff0477256d2e47ad456.tar.gz
jgit-908bfb6805eca9cb96a2cff0477256d2e47ad456.zip
Fix TimeoutInputStreamTest, TimeoutOutputStreamTest assertions
If the build server is really busy, we might wait longer than 250 ms before being interrupted, simply because one of our threads couldn't be scheduled onto a CPU. Don't make that cause a test failure. Instead tolerate longer than expected waits, but not shorter waits. Change-Id: I64511eec24b49e33928451e4c8b8c124eddaf0c2 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test/tst/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java4
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java4
2 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
index b854ae4e4e..b4a6a6a9ba 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutInputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009, Google Inc.
+ * Copyright (C) 2009-2010, Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -170,7 +170,7 @@ public class TimeoutInputStreamTest extends TestCase {
// 50 ms of the expected timeout.
//
final long wait = now() - start;
- assertTrue(Math.abs(wait - timeout) < 50);
+ assertTrue("waited only " + wait + " ms", timeout - wait < 50);
}
private static List<Thread> active() {
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
index 7563fc8c3b..f7afd21abc 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/util/io/TimeoutOutputStreamTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009, Google Inc.
+ * Copyright (C) 2009-2010, Google Inc.
* and other copyright owners as documented in the project's IP log.
*
* This program and the accompanying materials are made available
@@ -251,7 +251,7 @@ public class TimeoutOutputStreamTest extends TestCase {
// 50 ms of the expected timeout.
//
final long wait = now() - start;
- assertTrue(Math.abs(wait - timeout) < 50);
+ assertTrue("waited only " + wait + " ms", timeout - wait < 50);
}
private static List<Thread> active() {