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>
This commit is contained in:
parent
e54d33b687
commit
908bfb6805
|
@ -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.
|
* and other copyright owners as documented in the project's IP log.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made available
|
* This program and the accompanying materials are made available
|
||||||
|
@ -170,7 +170,7 @@ private void assertTimeout() {
|
||||||
// 50 ms of the expected timeout.
|
// 50 ms of the expected timeout.
|
||||||
//
|
//
|
||||||
final long wait = now() - start;
|
final long wait = now() - start;
|
||||||
assertTrue(Math.abs(wait - timeout) < 50);
|
assertTrue("waited only " + wait + " ms", timeout - wait < 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Thread> active() {
|
private static List<Thread> active() {
|
||||||
|
|
|
@ -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.
|
* and other copyright owners as documented in the project's IP log.
|
||||||
*
|
*
|
||||||
* This program and the accompanying materials are made available
|
* This program and the accompanying materials are made available
|
||||||
|
@ -251,7 +251,7 @@ private void assertTimeout() {
|
||||||
// 50 ms of the expected timeout.
|
// 50 ms of the expected timeout.
|
||||||
//
|
//
|
||||||
final long wait = now() - start;
|
final long wait = now() - start;
|
||||||
assertTrue(Math.abs(wait - timeout) < 50);
|
assertTrue("waited only " + wait + " ms", timeout - wait < 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static List<Thread> active() {
|
private static List<Thread> active() {
|
||||||
|
|
Loading…
Reference in New Issue