aboutsummaryrefslogtreecommitdiff
path: root/tests/time_test.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2016-01-26 13:04:57 -0800
committerElliott Hughes <enh@google.com>2016-01-26 13:13:52 -0800
commit33697a0c43c48e15c3bcf018138b9b837d0099cd (patch)
tree5abb2ab07c7f1322defd9fd6313cd11e12978579 /tests/time_test.cpp
parent94bb0fab931102f1fcf393aa507a6b77b741844f (diff)
downloadbionic-33697a0c43c48e15c3bcf018138b9b837d0099cd.tar.gz
Factor out the waiting for children in bionic tests.
Change-Id: I4a1e51b6920b33dc892d447f5bd6d10f1cb2704a
Diffstat (limited to 'tests/time_test.cpp')
-rw-r--r--tests/time_test.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index a04c44976..ec1b54908 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -27,6 +27,7 @@
#include <atomic>
#include "ScopedSignalHandler.h"
+#include "utils.h"
#include "private/bionic_constants.h"
@@ -218,7 +219,7 @@ TEST(time, timer_create) {
timer_t timer_id;
ASSERT_EQ(0, timer_create(CLOCK_MONOTONIC, &se, &timer_id));
- int pid = fork();
+ pid_t pid = fork();
ASSERT_NE(-1, pid) << strerror(errno);
if (pid == 0) {
@@ -228,10 +229,7 @@ TEST(time, timer_create) {
_exit(0);
}
- int status;
- ASSERT_EQ(pid, waitpid(pid, &status, 0));
- ASSERT_TRUE(WIFEXITED(status));
- ASSERT_EQ(0, WEXITSTATUS(status));
+ AssertChildExited(pid, 0);
ASSERT_EQ(0, timer_delete(timer_id));
}