From ada6312984d9e23fe6d95b36e19198b98122e7f8 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Sat, 20 Aug 2016 03:18:00 +0300 Subject: [PATCH] zdtm: don't trigger BUG if futex returns EINTR It can hapen in tty tests, where we get SIGHUP. Signed-off-by: Andrei Vagin Signed-off-by: Pavel Emelyanov --- test/zdtm/lib/lock.h | 4 ++-- test/zdtm/static/tty00.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/test/zdtm/lib/lock.h b/test/zdtm/lib/lock.h index 362de4993..db9e96d0e 100644 --- a/test/zdtm/lib/lock.h +++ b/test/zdtm/lib/lock.h @@ -64,7 +64,7 @@ static inline void futex_add_and_wake(futex_t *f, uint32_t v) break; \ ret = sys_futex(&(__f)->raw, FUTEX_WAIT,\ tmp, NULL, NULL, 0); \ - if (ret < 0 && errno == EAGAIN) \ + if (ret < 0 && (errno == EAGAIN || errno == EINTR)) \ continue; \ BUG_ON(ret < 0 && errno != EWOULDBLOCK); \ } \ @@ -119,7 +119,7 @@ static inline uint32_t futex_wait_while(futex_t *f, uint32_t v) { while (f->raw == v) { int ret = sys_futex(&f->raw, FUTEX_WAIT, v, NULL, NULL, 0); - if (ret < 0 && errno == EAGAIN) + if (ret < 0 && (errno == EAGAIN || errno == EINTR)) continue; BUG_ON(ret < 0 && errno != EWOULDBLOCK); } diff --git a/test/zdtm/static/tty00.c b/test/zdtm/static/tty00.c index 34085570d..aab0d0f08 100644 --- a/test/zdtm/static/tty00.c +++ b/test/zdtm/static/tty00.c @@ -97,8 +97,10 @@ int main(int argc, char ** argv) fail("The child returned %d", WEXITSTATUS(status)); return 1; } - } else + } else { test_msg("The child has been killed by %d\n", WTERMSIG(status)); + return 1; + } pass();