diff options
author | Luca Boccassi <bluca@debian.org> | 2022-10-25 01:56:44 +0200 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2022-10-25 16:10:15 +0200 |
commit | b7af9b43a514c213d00c0f0f7451ac59a8720428 (patch) | |
tree | 9671f94db4b53d3cdd9651fdfe7dd55ce8da23e7 | |
parent | test-sd-device: check if /run/udev/ exists (diff) | |
download | systemd-b7af9b43a514c213d00c0f0f7451ac59a8720428.tar.xz systemd-b7af9b43a514c213d00c0f0f7451ac59a8720428.zip |
test-condition: skip test if machine-id is missing
When building in a chroot there might not be any machine-id
-rw-r--r-- | src/test/test-condition.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/test-condition.c b/src/test/test-condition.c index 8fcaacc172..4cd23d8e21 100644 --- a/src/test/test-condition.c +++ b/src/test/test-condition.c @@ -247,8 +247,12 @@ TEST(condition_test_host) { _cleanup_free_ char *hostname = NULL; Condition *condition; sd_id128_t id; + int r; - assert_se(sd_id128_get_machine(&id) >= 0); + r = sd_id128_get_machine(&id); + if (IN_SET(r, -ENOENT, -ENOMEDIUM)) + return (void) log_tests_skipped("/etc/machine-id missing"); + assert_se(r >= 0); condition = condition_new(CONDITION_HOST, SD_ID128_TO_STRING(id), false, false); assert_se(condition); |