core: drop unused param, move taint calculation to separate file

Follow-up for 2b28dfe6e6.

I also considered moving the function to src/basic, but since it's only used by
the manager, it doesn't seem useful.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2024-04-24 15:17:49 +02:00
parent c75c8a38b8
commit d851637ca6
9 changed files with 111 additions and 103 deletions
+1 -1
View File
@@ -535,7 +535,7 @@ executables += [
'parallel' : false,
},
core_test_template + {
'sources' : files('test-manager.c'),
'sources' : files('test-taint.c'),
},
core_test_template + {
'sources' : files('test-namespace.c'),
-19
View File
@@ -1,19 +0,0 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "manager.h"
#include "tests.h"
TEST(manager_taint_string) {
Manager m = {};
_cleanup_free_ char *a = manager_taint_string(&m);
assert_se(a);
log_debug("taint string: '%s'", a);
if (cg_all_unified() == 0)
assert_se(strstr(a, "cgroupsv1"));
else
assert_se(!strstr(a, "cgroupsv1"));
}
DEFINE_TEST_MAIN(LOG_DEBUG);
+14
View File
@@ -0,0 +1,14 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "taint.h"
#include "tests.h"
TEST(taint_string) {
_cleanup_free_ char *a = taint_string();
assert_se(a);
log_debug("taint string: '%s'", a);
assert_se(!!strstr(a, "cgroupsv1") == (cg_all_unified() == 0));
}
DEFINE_TEST_MAIN(LOG_DEBUG);