|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
From 67c6ff720796bc97f262ba93c6ea87da93b04a1a Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
Date: Fri, 31 Jul 2020 10:36:57 +0200
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
Subject: [PATCH 3/4] test-path: do not fail the test if we fail to start some
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
The test was failing because it couldn't start the service:
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.path: state = waiting; result = success
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.path: state = waiting; result = success
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.path: state = waiting; result = success
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.path: state = waiting; result = success
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.path: state = waiting; result = success
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: state = failed; result = exit-code
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
Failed to connect to system bus: No such file or directory
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
-.slice: Failed to enable/disable controllers on cgroup /system.slice/kojid.service, ignoring: Permission denied
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: Failed to create cgroup /system.slice/kojid.service/path-modified.service: Permission denied
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: Failed to attach to cgroup /system.slice/kojid.service/path-modified.service: No such file or directory
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: Failed at step CGROUP spawning /bin/true: No such file or directory
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: Main process exited, code=exited, status=219/CGROUP
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
path-modified.service: Failed with result 'exit-code'.
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
Test timeout when testing path-modified.path
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
In fact any of the services that we try to start may fail, especially
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
considering that we're doing some rogue cgroup operations. See
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
https://github.com/systemd/systemd/pull/16603#issuecomment-679133641.
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
src/test/test-path.c | 88 ++++++++++++++++++++++++++++++--------------
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
1 file changed, 61 insertions(+), 27 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
diff --git a/src/test/test-path.c b/src/test/test-path.c
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
index 84dcf5e37d..d6c37b77e6 100644
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
--- a/src/test/test-path.c
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+++ b/src/test/test-path.c
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -77,8 +77,8 @@ static Service *service_for_path(Manager *m, Path *path, const char *service_nam
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
return SERVICE(service_unit);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
-static void _check_states(unsigned line,
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- Manager *m, Path *path, Service *service, PathState path_state, ServiceState service_state) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+static int _check_states(unsigned line,
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ Manager *m, Path *path, Service *service, PathState path_state, ServiceState service_state) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(m);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(service);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -102,11 +102,20 @@ static void _check_states(unsigned line,
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service_state_to_string(service->state),
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service_result_to_string(service->result));
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (service->state == SERVICE_FAILED)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return log_notice_errno(SYNTHETIC_ERRNO(ECANCELED),
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ "Failed to start service %s, aborting test: %s/%s",
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ UNIT(service)->id,
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ service_state_to_string(service->state),
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ service_result_to_string(service->result));
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
if (n >= end) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
log_error("Test timeout when testing %s", UNIT(path)->id);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
exit(EXIT_FAILURE);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return 0;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
#define check_states(...) _check_states(__LINE__, __VA_ARGS__)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -124,18 +133,22 @@ static void test_path_exists(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service = service_for_path(m, path, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(test_path) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* Service restarts if file still exists */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -154,18 +167,22 @@ static void test_path_existsglob(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service = service_for_path(m, path, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(test_path) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* Service restarts if file still exists */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -185,23 +202,28 @@ static void test_path_changed(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service = service_for_path(m, path, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(test_path) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* Service does not restart if file still exists */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
f = fopen(test_path, "w");
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(f);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
fclose(f);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -222,23 +244,28 @@ static void test_path_modified(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service = service_for_path(m, path, NULL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(test_path) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* Service does not restart if file still exists */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
f = fopen(test_path, "w");
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(f);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
fputs("test", f);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -258,14 +285,17 @@ static void test_path_unit(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
service = service_for_path(m, path, "path-mycustomunit.service");
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(test_path) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
@@ -286,22 +316,26 @@ static void test_path_directorynotempty(Manager *m) {
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(access(test_path, F_OK) < 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_start(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* MakeDirectory default to no */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(access(test_path, F_OK) < 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(mkdir_p(test_path, 0755) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(touch(strjoina(test_path, "test_file")) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
/* Service restarts if directory is still not empty */
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_RUNNING, SERVICE_RUNNING) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL) == 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(UNIT(service)) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
- check_states(m, path, service, PATH_WAITING, SERVICE_DEAD);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ if (check_states(m, path, service, PATH_WAITING, SERVICE_DEAD) < 0)
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
+ return;
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
assert_se(unit_stop(unit) >= 0);
|
|
Zbigniew Jędrzejewski-Szmek |
de06d8 |
}
|