hostname = gethostname_malloc();
assert_se(hostname);
- condition = condition_new(CONDITION_HOST, hostname, false, false);
- assert_se(condition_test(condition));
- condition_free(condition);
+ /* if hostname looks like an id128 then skip testing it */
- if (id128_is_valid(hostname)) {
++ if (id128_is_valid(hostname))
+ log_notice("hostname is an id128, skipping test");
- } else {
++ else {
+ condition = condition_new(CONDITION_HOST, hostname, false, false);
+ assert_se(condition_test(condition));
+ condition_free(condition);
+ }
}
static void test_condition_test_architecture(void) {
exit($EXIT_TEST_SKIP);
}
- print "Running in a chroot, skipping the test.\n";
- exit($EXIT_TEST_SKIP);
+ # skip the test when running in a chroot
+ system("systemd-detect-virt", "-r", "-q");
+ if ($? >> 8 == 0) {
++ print "Running in a chroot, skipping the test.\n";
++ exit($EXIT_TEST_SKIP);
+ }
+
# skip the test when running in a container
system("systemd-detect-virt", "-c", "-q");
if ($? >> 8 == 0) {
-- print "Running in a container, skipping the test.\n";
-- exit($EXIT_TEST_SKIP);
++ print "Running in a container, skipping the test.\n";
++ exit($EXIT_TEST_SKIP);
}
udev_setup();