From: Luca Boccassi Date: Mon, 24 Oct 2022 23:56:44 +0000 (+0100) Subject: test-condition: skip test if machine-id is missing X-Git-Tag: v252~30^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b7af9b43a514c213d00c0f0f7451ac59a8720428;p=thirdparty%2Fsystemd.git test-condition: skip test if machine-id is missing When building in a chroot there might not be any machine-id --- diff --git a/src/test/test-condition.c b/src/test/test-condition.c index 8fcaacc1721..4cd23d8e213 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);