New version of patch

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-09-14 21:16:32 +02:00
parent a896a747c3
commit 3417440344
1 changed files with 29 additions and 14 deletions

View File

@ -1,8 +1,8 @@
From 67c6ff720796bc97f262ba93c6ea87da93b04a1a Mon Sep 17 00:00:00 2001
From c491e46a741ad8603aeb7ec518fefc6a307b251d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 31 Jul 2020 10:36:57 +0200
Subject: [PATCH 3/4] test-path: do not fail the test if we fail to start some
service
Subject: [PATCH] test-path: do not fail the test if we fail to start a service
because of cgroup setup
The test was failing because it couldn't start the service:
@ -30,11 +30,25 @@ In fact any of the services that we try to start may fail, especially
considering that we're doing some rogue cgroup operations. See
https://github.com/systemd/systemd/pull/16603#issuecomment-679133641.
---
src/test/test-path.c | 88 ++++++++++++++++++++++++++++++--------------
1 file changed, 61 insertions(+), 27 deletions(-)
src/core/execute.h | 2 +-
src/test/test-path.c | 89 ++++++++++++++++++++++++++++++--------------
2 files changed, 63 insertions(+), 28 deletions(-)
diff --git a/src/core/execute.h b/src/core/execute.h
index fc7bc5c24b..b5653451fd 100644
--- a/src/core/execute.h
+++ b/src/core/execute.h
@@ -86,7 +86,7 @@ struct ExecStatus {
dual_timestamp exit_timestamp;
pid_t pid;
int code; /* as in siginfo_t::si_code */
- int status; /* as in sigingo_t::si_status */
+ int status; /* as in siginfo_t::si_status */
};
/* Stores information about commands we execute. Covers both configuration settings as well as runtime data. */
diff --git a/src/test/test-path.c b/src/test/test-path.c
index 84dcf5e37d..d6c37b77e6 100644
index 7d3e35e299..a89503ccea 100644
--- a/src/test/test-path.c
+++ b/src/test/test-path.c
@@ -77,8 +77,8 @@ static Service *service_for_path(Manager *m, Path *path, const char *service_nam
@ -48,11 +62,12 @@ index 84dcf5e37d..d6c37b77e6 100644
assert_se(m);
assert_se(service);
@@ -102,11 +102,20 @@ static void _check_states(unsigned line,
@@ -102,11 +102,21 @@ static void _check_states(unsigned line,
service_state_to_string(service->state),
service_result_to_string(service->result));
+ if (service->state == SERVICE_FAILED)
+ if (service->state == SERVICE_FAILED &&
+ service->main_exec_status.status == EXIT_CGROUP)
+ return log_notice_errno(SYNTHETIC_ERRNO(ECANCELED),
+ "Failed to start service %s, aborting test: %s/%s",
+ UNIT(service)->id,
@ -69,7 +84,7 @@ index 84dcf5e37d..d6c37b77e6 100644
}
#define check_states(...) _check_states(__LINE__, __VA_ARGS__)
@@ -124,18 +133,22 @@ static void test_path_exists(Manager *m) {
@@ -124,18 +134,22 @@ static void test_path_exists(Manager *m) {
service = service_for_path(m, path, NULL);
assert_se(unit_start(unit) >= 0);
@ -96,7 +111,7 @@ index 84dcf5e37d..d6c37b77e6 100644
assert_se(unit_stop(unit) >= 0);
}
@@ -154,18 +167,22 @@ static void test_path_existsglob(Manager *m) {
@@ -154,18 +168,22 @@ static void test_path_existsglob(Manager *m) {
service = service_for_path(m, path, NULL);
assert_se(unit_start(unit) >= 0);
@ -123,7 +138,7 @@ index 84dcf5e37d..d6c37b77e6 100644
assert_se(unit_stop(unit) >= 0);
}
@@ -185,23 +202,28 @@ static void test_path_changed(Manager *m) {
@@ -185,23 +203,28 @@ static void test_path_changed(Manager *m) {
service = service_for_path(m, path, NULL);
assert_se(unit_start(unit) >= 0);
@ -157,7 +172,7 @@ index 84dcf5e37d..d6c37b77e6 100644
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
assert_se(unit_stop(unit) >= 0);
@@ -222,23 +244,28 @@ static void test_path_modified(Manager *m) {
@@ -222,23 +245,28 @@ static void test_path_modified(Manager *m) {
service = service_for_path(m, path, NULL);
assert_se(unit_start(unit) >= 0);
@ -191,7 +206,7 @@ index 84dcf5e37d..d6c37b77e6 100644
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
assert_se(unit_stop(unit) >= 0);
@@ -258,14 +285,17 @@ static void test_path_unit(Manager *m) {
@@ -258,14 +286,17 @@ static void test_path_unit(Manager *m) {
service = service_for_path(m, path, "path-mycustomunit.service");
assert_se(unit_start(unit) >= 0);
@ -212,7 +227,7 @@ index 84dcf5e37d..d6c37b77e6 100644
assert_se(unit_stop(unit) >= 0);
}
@@ -286,22 +316,26 @@ static void test_path_directorynotempty(Manager *m) {
@@ -286,22 +317,26 @@ static void test_path_directorynotempty(Manager *m) {
assert_se(access(test_path, F_OK) < 0);
assert_se(unit_start(unit) >= 0);