diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-10-12 17:56:10 +0000 |
---|---|---|
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-10-12 17:56:10 +0000 |
commit | 805f213c1b9016aec3e40a3977f664add64b1192 (patch) | |
tree | 74b7478669b75ca4a00621a55b48517ae9288952 | |
parent | 1a2ea383a15a49016944ce123e63ce660d677701 (diff) | |
parent | d731f01fe60708670b75506c56bb53c1f723ca1a (diff) | |
download | libcore-805f213c1b9016aec3e40a3977f664add64b1192.tar.gz |
Snap for 5063321 from d731f01fe60708670b75506c56bb53c1f723ca1a to pie-cts-release
Change-Id: I524e5fdfbc78453c42f6159c512017b9b032ca53
-rw-r--r-- | luni/src/test/java/libcore/libcore/io/OsTest.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/luni/src/test/java/libcore/libcore/io/OsTest.java b/luni/src/test/java/libcore/libcore/io/OsTest.java index ab8f16e39d9..5e8a6919a41 100644 --- a/luni/src/test/java/libcore/libcore/io/OsTest.java +++ b/luni/src/test/java/libcore/libcore/io/OsTest.java @@ -714,8 +714,12 @@ public class OsTest extends TestCase { int newValue = 3000; Libcore.os.setsockoptInt(fd, OsConstants.IPPROTO_TCP, OsConstants.TCP_USER_TIMEOUT, newValue); - assertEquals(newValue, Libcore.os.getsockoptInt(fd, OsConstants.IPPROTO_TCP, - OsConstants.TCP_USER_TIMEOUT)); + int actualValue = Libcore.os.getsockoptInt(fd, OsConstants.IPPROTO_TCP, + OsConstants.TCP_USER_TIMEOUT); + // The kernel can round the requested value based on the HZ setting. We allow up to 10ms + // difference. + assertTrue("Returned incorrect timeout:" + actualValue, + Math.abs(newValue - actualValue) <= 10); // No need to reset the value to 0, since we're throwing the socket away } finally { Libcore.os.close(fd); |