To make the result more visible, special return value
is used to tell automake that the test was skipped. While
at it, use the same return value in other skipped tests.
#include "log.h"
#include "util.h"
+#include "macro.h"
#include "sd-bus.h"
#include "bus-message.h"
int q, r;
r = server_init(&bus);
- if (r < 0)
- return EXIT_FAILURE;
+ if (r < 0) {
+ log_info("Failed to connect to bus, skipping tests.");
+ return EXIT_TEST_SKIP;
+ }
log_info("Initialized...");
#define _introspect_(x) __attribute__((section("introspect." x)))
#define _alignas_(x) __attribute__((aligned(__alignof(x))))
+/* automake test harness */
+#define EXIT_TEST_SKIP 77
+
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
#include <sched.h>
#include "manager.h"
-
+#include "macro.h"
int main(int argc, char *argv[]) {
Manager *m;
r = manager_new(SYSTEMD_USER, &m);
if (r == -EPERM) {
puts("manager_new: Permission denied. Skipping test.");
- return EXIT_SUCCESS;
+ return EXIT_TEST_SKIP;
}
assert(r >= 0);
assert_se(manager_startup(m, serial, fdset) >= 0);
#undef expect
}
-static void test_unit_printf(void) {
+static int test_unit_printf(void) {
Manager *m;
Unit *u, *u2;
int r;
r = manager_new(SYSTEMD_USER, &m);
if (r == -EPERM) {
puts("manager_new: Permission denied. Skipping test.");
- return;
+ return EXIT_TEST_SKIP;
}
assert(r == 0);
expect(u2, "%b", bid);
expect(u2, "%H", host);
expect(u2, "%t", "/run/user/*");
+
+ return 0;
}
int main(int argc, char* argv[]) {
test_replacements();
- test_unit_printf();
-
- return 0;
+ return test_unit_printf();
}