mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-21 18:03:41 +03:00
tests: modify enter_cgroup_subroot() to return the new path
This commit is contained in:
parent
48e98ba5c3
commit
64ad9e088d
@ -172,7 +172,7 @@ bool can_memlock(void) {
|
||||
return b;
|
||||
}
|
||||
|
||||
int enter_cgroup_subroot(void) {
|
||||
int enter_cgroup_subroot(char **ret_cgroup) {
|
||||
_cleanup_free_ char *cgroup_root = NULL, *cgroup_subroot = NULL;
|
||||
CGroupMask supported;
|
||||
int r;
|
||||
@ -192,5 +192,11 @@ int enter_cgroup_subroot(void) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return cg_attach_everywhere(supported, cgroup_subroot, 0, NULL, NULL);
|
||||
r = cg_attach_everywhere(supported, cgroup_subroot, 0, NULL, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (ret_cgroup)
|
||||
*ret_cgroup = TAKE_PTR(cgroup_subroot);
|
||||
return 0;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ static inline bool manager_errno_skip_test(int r) {
|
||||
}
|
||||
|
||||
char* setup_fake_runtime_dir(void);
|
||||
int enter_cgroup_subroot(void);
|
||||
int enter_cgroup_subroot(char **ret_cgroup);
|
||||
const char* get_testdata_dir(void);
|
||||
const char* get_catalog_dir(void);
|
||||
bool slow_tests_enabled(void);
|
||||
|
@ -44,7 +44,7 @@ int main(int argc, char *argv[]) {
|
||||
if (!can_memlock())
|
||||
return log_tests_skipped("Can't use mlock(), skipping.");
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -33,7 +33,7 @@ static int test_cgroup_mask(void) {
|
||||
int r;
|
||||
CGroupMask cpu_accounting_mask = get_cpu_accounting_mask();
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -18,7 +18,7 @@ static int test_default_memory_low(void) {
|
||||
uint64_t dml_tree_default;
|
||||
int r;
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -21,7 +21,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_DEBUG);
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -869,7 +869,7 @@ int main(int argc, char *argv[]) {
|
||||
if (getuid() != 0)
|
||||
return log_tests_skipped("not root");
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -779,7 +779,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -31,7 +31,7 @@ static int setup_test(Manager **m) {
|
||||
|
||||
assert_se(m);
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -20,7 +20,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -820,7 +820,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
test_setup_logging(LOG_INFO);
|
||||
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
@ -16,7 +16,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
if (getuid() != 0)
|
||||
return log_tests_skipped("not root");
|
||||
r = enter_cgroup_subroot();
|
||||
r = enter_cgroup_subroot(NULL);
|
||||
if (r == -ENOMEDIUM)
|
||||
return log_tests_skipped("cgroupfs not available");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user