summaryrefslogtreecommitdiff
path: root/src/login/test-inhibit.c
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2014-11-30 02:16:19 +0100
committerRonny Chevalier <chevalier.ronny@gmail.com>2014-11-30 02:35:52 +0100
commit787784c4c1b24a13207d18b415d60483cfbdeaa3 (patch)
tree66b49b1a8e589fb38aa34d0208e6bc6c0b1a69f2 /src/login/test-inhibit.c
parent30fbcf24460263961855e0ce4d8867fd2af3e149 (diff)
tests: use assert_se instead of assert
Otherwise they can be optimized away with -DNDEBUG
Diffstat (limited to 'src/login/test-inhibit.c')
-rw-r--r--src/login/test-inhibit.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/login/test-inhibit.c b/src/login/test-inhibit.c
index 21d2339616..5379ffcaa1 100644
--- a/src/login/test-inhibit.c
+++ b/src/login/test-inhibit.c
@@ -42,11 +42,11 @@ static int inhibit(sd_bus *bus, const char *what) {
&error,
&reply,
"ssss", what, who, reason, mode);
- assert(r >= 0);
+ assert_se(r >= 0);
r = sd_bus_message_read_basic(reply, SD_BUS_TYPE_UNIX_FD, &fd);
- assert(r >= 0);
- assert(fd >= 0);
+ assert_se(r >= 0);
+ assert_se(fd >= 0);
return dup(fd);
}
@@ -67,10 +67,10 @@ static void print_inhibitors(sd_bus *bus) {
&error,
&reply,
"");
- assert(r >= 0);
+ assert_se(r >= 0);
r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssuu)");
- assert(r >= 0);
+ assert_se(r >= 0);
while ((r = sd_bus_message_read(reply, "(ssssuu)", &what, &who, &why, &mode, &uid, &pid)) > 0) {
printf("what=<%s> who=<%s> why=<%s> mode=<%s> uid=<"UID_FMT"> pid=<"PID_FMT">\n",
@@ -78,7 +78,7 @@ static void print_inhibitors(sd_bus *bus) {
n++;
}
- assert(r >= 0);
+ assert_se(r >= 0);
printf("%u inhibitors\n", n);
}
@@ -89,16 +89,16 @@ int main(int argc, char*argv[]) {
int r;
r = sd_bus_open_system(&bus);
- assert(r >= 0);
+ assert_se(r >= 0);
print_inhibitors(bus);
fd1 = inhibit(bus, "sleep");
- assert(fd1 >= 0);
+ assert_se(fd1 >= 0);
print_inhibitors(bus);
fd2 = inhibit(bus, "idle:shutdown");
- assert(fd2 >= 0);
+ assert_se(fd2 >= 0);
print_inhibitors(bus);
safe_close(fd1);