svn commit: r350620 - head/contrib/netbsd-tests/lib/libpthread
Eric van Gyzen
vangyzen at FreeBSD.org
Mon Aug 5 22:59:36 UTC 2019
Author: vangyzen
Date: Mon Aug 5 22:59:35 2019
New Revision: 350620
URL: https://svnweb.freebsd.org/changeset/base/350620
Log:
Relax time constraint in pthread_cond_timedwait unit test
pthread_cond_timedwait() should wait _at least_ until the timeout,
but it might appear to wait longer due to system activity and
scheduling. The test ignored fractional seconds when comparing the
actual and expected timeouts, so it allowed anywhere between zero
and one extra second of wait time. Zero is a bit unreasonable.
Compare fractional seconds so we always allow up to one extra second.
Reviewed by: ngie
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Modified:
head/contrib/netbsd-tests/lib/libpthread/t_condwait.c
Modified: head/contrib/netbsd-tests/lib/libpthread/t_condwait.c
==============================================================================
--- head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Mon Aug 5 22:04:16 2019 (r350619)
+++ head/contrib/netbsd-tests/lib/libpthread/t_condwait.c Mon Aug 5 22:59:35 2019 (r350620)
@@ -51,6 +51,9 @@ static void *
run(void *param)
{
struct timespec ts, to, te;
+#ifdef __FreeBSD__
+ struct timespec tw;
+#endif
clockid_t clck;
pthread_condattr_t attr;
pthread_cond_t cond;
@@ -91,7 +94,15 @@ run(void *param)
/* Loose upper limit because of qemu timing bugs */
ATF_REQUIRE(to_seconds < WAITTIME * 2.5);
} else {
+#ifdef __FreeBSD__
+ tw.tv_sec = WAITTIME;
+ tw.tv_nsec = 0;
+ ATF_REQUIRE(timespeccmp(&to, &tw, >=));
+ tw.tv_sec++;
+ ATF_REQUIRE(timespeccmp(&to, &tw, <=));
+#else
ATF_REQUIRE_EQ(to.tv_sec, WAITTIME);
+#endif
}
break;
default:
More information about the svn-src-head
mailing list