summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-11-23 11:26:25 +0100
committerDaniel Mack <github@zonque.org>2015-11-23 11:26:25 +0100
commit8a85b710aaf40741b0990b7f923f35c923a2adab (patch)
tree26b253d1a36d2a333a1bb0e532333c10b4b12fc8
parent2b65dcd63127e310c3c3d4502e03be77035979b2 (diff)
parent591df2b5c3ec0c92996648c122520a03b3ea3503 (diff)
Merge pull request #1992 from evverx/tests-add-event-now
tests: add sd_event_now to test_basic
-rw-r--r--src/libsystemd/sd-event/test-event.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c
index 4a87159151..9417a8d1d1 100644
--- a/src/libsystemd/sd-event/test-event.c
+++ b/src/libsystemd/sd-event/test-event.c
@@ -173,6 +173,7 @@ static void test_basic(void) {
sd_event_source *w = NULL, *x = NULL, *y = NULL, *z = NULL, *q = NULL, *t = NULL;
static const char ch = 'x';
int a[2] = { -1, -1 }, b[2] = { -1, -1}, d[2] = { -1, -1}, k[2] = { -1, -1 };
+ uint64_t event_now;
assert_se(pipe(a) >= 0);
assert_se(pipe(b) >= 0);
@@ -180,6 +181,7 @@ static void test_basic(void) {
assert_se(pipe(k) >= 0);
assert_se(sd_event_default(&e) >= 0);
+ assert_se(sd_event_now(e, CLOCK_MONOTONIC, &event_now) > 0);
assert_se(sd_event_set_watchdog(e, true) >= 0);
@@ -241,7 +243,8 @@ static void test_basic(void) {
do_quit = true;
assert_se(sd_event_add_post(e, NULL, post_handler, NULL) >= 0);
- assert_se(sd_event_source_set_time(z, now(CLOCK_MONOTONIC) + 200 * USEC_PER_MSEC) >= 0);
+ assert_se(sd_event_now(e, CLOCK_MONOTONIC, &event_now) == 0);
+ assert_se(sd_event_source_set_time(z, event_now + 200 * USEC_PER_MSEC) >= 0);
assert_se(sd_event_source_set_enabled(z, SD_EVENT_ONESHOT) >= 0);
assert_se(sd_event_loop(e) >= 0);