From 22a66e7b7e1d73437a8c26c2a1b45bc4ef214e77 Mon Sep 17 00:00:00 2001 From: Cheyenne Wills Date: Tue, 16 Jun 2020 15:20:20 -0600 Subject: [PATCH] tests: Use usleep instead of nanosleep Commit "Build tests by default" 68f406436cc21853ff854c514353e7eb607cb6cb changes the build so tests are always built. On Solaris 10 the build fails because nanosleep is in librt, which we do not link against. Replace nanosleep with usleep. This avoids introducing extra configure tests just for Solaris 10. Note that with Solaris 11 nanosleep was moved from librt to libc, the standard C library. Change-Id: I6639f32bb8c8ace438e0092a866f06561dad54f1 Reviewed-on: https://gerrit.openafs.org/14244 Reviewed-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- tests/auth/superuser-t.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/auth/superuser-t.c b/tests/auth/superuser-t.c index 92c48c78f3..7185722301 100644 --- a/tests/auth/superuser-t.c +++ b/tests/auth/superuser-t.c @@ -379,7 +379,7 @@ waitforsig(int signo, int nsecs) for (nsleeps = 0; nsleeps < nsecs * 10; nsleeps++) { sigset_t set; - struct timespec timeo; + int code; opr_Verify(sigpending(&set) == 0); if (sigismember(&set, signo)) { @@ -387,9 +387,8 @@ waitforsig(int signo, int nsecs) } /* Sleep for 100ms */ - timeo.tv_sec = 0; - timeo.tv_nsec = 100 * 1000 * 1000; - opr_Verify(nanosleep(&timeo, NULL) == 0); + code = usleep(100000); + opr_Assert(code == 0 || errno == EINTR); } return -1;