From 143bfdaf0b890fa7acadf02d1eafacaef1b696bd Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Thu, 18 Jul 2013 08:30:06 +0200 Subject: test: Make testing work on systems without or old systemd * Introduce a macro to conditionally execute tests. This avoids skipping the entire test if some parts require systemd * Skip the journal tests when no /etc/machine-id is present * Change test-catalog to load the catalog from the source directory of systemd. * /proc/PID/comm got introduced in v2.6.33 but travis is still using v2.6.32. * Enable make check and make distcheck on the travis build * Use -D"CATALOG_DIR=STR($(abs_top_srcdir)/catalog)" as a STRINGIY would result in the path '/home/ich/source/linux' to be expanded to '/home/ich/source/1' as linux is defined to 1. --- src/test/test-id128.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/test/test-id128.c') diff --git a/src/test/test-id128.c b/src/test/test-id128.c index 2ed8e292e6..7b92758174 100644 --- a/src/test/test-id128.c +++ b/src/test/test-id128.c @@ -25,6 +25,7 @@ #include "util.h" #include "macro.h" +#include "sd-daemon.h" #define ID128_WALDI SD_ID128_MAKE(01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10) #define STR_WALDI "0102030405060708090a0b0c0d0e0f10" @@ -41,11 +42,13 @@ int main(int argc, char *argv[]) { assert_se(sd_id128_from_string(t, &id2) == 0); assert_se(sd_id128_equal(id, id2)); - assert_se(sd_id128_get_machine(&id) == 0); - printf("machine: %s\n", sd_id128_to_string(id, t)); + if (sd_booted() > 0) { + assert_se(sd_id128_get_machine(&id) == 0); + printf("machine: %s\n", sd_id128_to_string(id, t)); - assert_se(sd_id128_get_boot(&id) == 0); - printf("boot: %s\n", sd_id128_to_string(id, t)); + assert_se(sd_id128_get_boot(&id) == 0); + printf("boot: %s\n", sd_id128_to_string(id, t)); + } printf("waldi: %s\n", sd_id128_to_string(ID128_WALDI, t)); assert_se(streq(t, STR_WALDI)); -- cgit v1.2.3-54-g00ecf