diff --git a/src/libsystemd-network/test-ndisc-rs.c b/src/libsystemd-network/test-ndisc-rs.c index 5d1e66fcdc..3f46c8d0c5 100644 --- a/src/libsystemd-network/test-ndisc-rs.c +++ b/src/libsystemd-network/test-ndisc-rs.c @@ -217,7 +217,7 @@ static int send_ra(uint8_t flags) { advertisement[5] = flags; assert_se(write(test_fd[1], advertisement, sizeof(advertisement)) == - sizeof(advertisement)); + sizeof(advertisement)); if (verbose) printf(" sent RA with flag 0x%02x\n", flags); @@ -291,8 +291,8 @@ static void test_rs(void) { assert_se(sd_ndisc_set_callback(nd, test_callback, e) >= 0); assert_se(sd_event_add_time(e, &test_hangcheck, clock_boottime_or_monotonic(), - time_now + 2 *USEC_PER_SEC, 0, - test_rs_hangcheck, NULL) >= 0); + time_now + 30 * USEC_PER_SEC, 0, + test_rs_hangcheck, NULL) >= 0); assert_se(sd_ndisc_stop(nd) >= 0); assert_se(sd_ndisc_start(nd) >= 0); @@ -393,8 +393,8 @@ static void test_timeout(void) { assert_se(sd_ndisc_set_mac(nd, &mac_addr) >= 0); assert_se(sd_event_add_time(e, &test_hangcheck, clock_boottime_or_monotonic(), - time_now + 2U * USEC_PER_SEC, 0, - test_rs_hangcheck, NULL) >= 0); + time_now + 30 * USEC_PER_SEC, 0, + test_rs_hangcheck, NULL) >= 0); assert_se(sd_ndisc_start(nd) >= 0); diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 6b9074ce2b..0dccc8f970 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -125,10 +125,16 @@ int can_sleep_state(char **types) { k = strlen(*type); FOREACH_WORD_SEPARATOR(word, l, p, WHITESPACE, state) - if (l == k && memcmp(word, *type, l) == 0) + if (l == k && memcmp(word, *type, l) == 0) { + log_debug("Sleep mode \"%s\" is supported by the kernel.", *type); return true; + } } + if (DEBUG_LOGGING) { + _cleanup_free_ char *t = strv_join(types, "/"); + log_debug("Sleep mode %s not supported by the kernel, sorry.", strnull(t)); + } return false; } diff --git a/src/test/test-fs-util.c b/src/test/test-fs-util.c index 8d9a1974b2..dfea70ca27 100644 --- a/src/test/test-fs-util.c +++ b/src/test/test-fs-util.c @@ -864,14 +864,17 @@ static void test_path_is_encrypted_one(const char *p, int expect) { } static void test_path_is_encrypted(void) { - log_info("/* %s */", __func__); + int booted = sd_booted(); /* If this is run in build environments such as koji, /dev might be a + * reguar fs. Don't assume too much if not running under systemd. */ + + log_info("/* %s (sd_booted=%d)*/", __func__, booted); test_path_is_encrypted_one("/home", -1); test_path_is_encrypted_one("/var", -1); test_path_is_encrypted_one("/", -1); test_path_is_encrypted_one("/proc", false); test_path_is_encrypted_one("/sys", false); - test_path_is_encrypted_one("/dev", false); + test_path_is_encrypted_one("/dev", booted > 0 ? false : -1); } int main(int argc, char *argv[]) { diff --git a/src/test/test-path.c b/src/test/test-path.c index e8844fd5ef..1075f31bc6 100644 --- a/src/test/test-path.c +++ b/src/test/test-path.c @@ -79,21 +79,15 @@ static Service *service_for_path(Manager *m, Path *path, const char *service_nam } static void check_states(Manager *m, Path *path, Service *service, PathState path_state, ServiceState service_state) { - usec_t ts; - usec_t timeout = 2 * USEC_PER_SEC; - assert_se(m); assert_se(service); - ts = now(CLOCK_MONOTONIC); + usec_t end = now(CLOCK_MONOTONIC) + 30 * USEC_PER_SEC; while (path->result != PATH_SUCCESS || service->result != SERVICE_SUCCESS || path->state != path_state || service->state != service_state) { - usec_t n; - int r; - r = sd_event_run(m->event, 100 * USEC_PER_MSEC); - assert_se(r >= 0); + assert_se(sd_event_run(m->event, 100 * USEC_PER_MSEC) >= 0); printf("%s: state = %s; result = %s \n", UNIT(path)->id, @@ -104,8 +98,7 @@ static void check_states(Manager *m, Path *path, Service *service, PathState pat service_state_to_string(service->state), service_result_to_string(service->result)); - n = now(CLOCK_MONOTONIC); - if (ts + timeout < n) { + if (now(CLOCK_MONOTONIC) >= end) { log_error("Test timeout when testing %s", UNIT(path)->id); exit(EXIT_FAILURE); } diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index 2e63aace02..8b4fa82640 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -7,6 +7,7 @@ #include #include +#include "efivars.h" #include "errno-util.h" #include "fd-util.h" #include "log.h" @@ -84,7 +85,9 @@ static void test_sleep(void) { log_info("/* %s */", __func__); - log_info("/= configuration =/"); + printf("Secure boot: %sd\n", enable_disable(is_efi_secure_boot())); + + log_info("/= individual sleep modes =/"); log_info("Standby configured: %s", yes_no(can_sleep_state(standby) > 0)); log_info("Suspend configured: %s", yes_no(can_sleep_state(mem) > 0)); log_info("Hibernate configured: %s", yes_no(can_sleep_state(disk) > 0)); @@ -94,7 +97,7 @@ static void test_sleep(void) { log_info("Hibernate+Shutdown configured: %s", yes_no(can_sleep_disk(shutdown) > 0)); log_info("Freeze configured: %s", yes_no(can_sleep_state(freeze) > 0)); - log_info("/= running system =/"); + log_info("/= high-level sleep verbs =/"); r = can_sleep("suspend"); log_info("Suspend configured and possible: %s", r >= 0 ? yes_no(r) : strerror_safe(r)); r = can_sleep("hibernate");