diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-18 08:30:06 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-08-22 00:52:14 -0400 |
commit | 143bfdaf0b890fa7acadf02d1eafacaef1b696bd (patch) | |
tree | 5a640d40bc7489c5933aac824f2bf23ecd2818ff /src/test/test-id128.c | |
parent | 67ccd1c4b821b142ccd7b4bb292d9947aea8c581 (diff) |
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.
Diffstat (limited to 'src/test/test-id128.c')
-rw-r--r-- | src/test/test-id128.c | 11 |
1 files changed, 7 insertions, 4 deletions
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)); |