summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2015-11-23 05:49:41 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2015-11-23 05:58:54 +0000
commit591df2b5c3ec0c92996648c122520a03b3ea3503 (patch)
tree6565ba9d241a0858163df41ce407a5369cd53635
parent8c93f4ed7b597ced30b0cf9906e14c33ddc7656a (diff)
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);