Merge pull request #16590 from keszybz/test-fs-util-relax
Small adjustements to let various tests pass in overloaded Fedora infra and related changes
This commit is contained in:
@@ -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[]) {
|
||||
|
||||
+3
-10
@@ -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);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#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");
|
||||
|
||||
Reference in New Issue
Block a user