summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event/test-event.c
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2015-01-22 22:53:42 +0100
committerRonny Chevalier <chevalier.ronny@gmail.com>2015-01-22 23:10:56 +0100
commit0c0cdb06c139b52ff103287f6909b3daa5b2dc54 (patch)
treef904cb032c43691d325b6bb19941a2c115a07416 /src/libsystemd/sd-event/test-event.c
parent714af6af8a912650f9129f8b056ed92589443060 (diff)
tests: use assert_se instead of assert
Otherwise they can be optimized away with -DNDEBUG
Diffstat (limited to 'src/libsystemd/sd-event/test-event.c')
-rw-r--r--src/libsystemd/sd-event/test-event.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libsystemd/sd-event/test-event.c b/src/libsystemd/sd-event/test-event.c
index ffefb14b74..721700be7b 100644
--- a/src/libsystemd/sd-event/test-event.c
+++ b/src/libsystemd/sd-event/test-event.c
@@ -22,6 +22,7 @@
#include "sd-event.h"
#include "log.h"
#include "util.h"
+#include "macro.h"
static int prepare_handler(sd_event_source *s, void *userdata) {
log_info("preparing %c", PTR_TO_INT(userdata));
@@ -62,12 +63,12 @@ static int io_handler(sd_event_source *s, int fd, uint32_t revents, void *userda
static int child_handler(sd_event_source *s, const siginfo_t *si, void *userdata) {
- assert(s);
- assert(si);
+ assert_se(s);
+ assert_se(si);
log_info("got child on %c", PTR_TO_INT(userdata));
- assert(userdata == INT_TO_PTR('f'));
+ assert_se(userdata == INT_TO_PTR('f'));
assert_se(sd_event_exit(sd_event_source_get_event(s), 0) >= 0);
sd_event_source_unref(s);
@@ -80,12 +81,12 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
sigset_t ss;
pid_t pid;
- assert(s);
- assert(si);
+ assert_se(s);
+ assert_se(si);
log_info("got signal on %c", PTR_TO_INT(userdata));
- assert(userdata == INT_TO_PTR('e'));
+ assert_se(userdata == INT_TO_PTR('e'));
assert_se(sigemptyset(&ss) >= 0);
assert_se(sigaddset(&ss, SIGCHLD) >= 0);
@@ -109,11 +110,11 @@ static int defer_handler(sd_event_source *s, void *userdata) {
sd_event_source *p = NULL;
sigset_t ss;
- assert(s);
+ assert_se(s);
log_info("got defer on %c", PTR_TO_INT(userdata));
- assert(userdata == INT_TO_PTR('d'));
+ assert_se(userdata == INT_TO_PTR('d'));
assert_se(sigemptyset(&ss) >= 0);
assert_se(sigaddset(&ss, SIGUSR1) >= 0);
@@ -140,7 +141,7 @@ static int time_handler(sd_event_source *s, uint64_t usec, void *userdata) {
assert_se(sd_event_add_defer(sd_event_source_get_event(s), &p, defer_handler, INT_TO_PTR('d')) >= 0);
assert_se(sd_event_source_set_enabled(p, SD_EVENT_ONESHOT) >= 0);
} else {
- assert(!got_c);
+ assert_se(!got_c);
got_c = true;
}
} else