From 671a65391ffac63f03c9097837c3aa6ba3766535 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 13 Sep 2021 14:11:05 +0200 Subject: [PATCH] tests: fix config file tests Link: https://bugs.launchpad.net/bugs/1943441 Signed-off-by: Christian Brauner --- src/tests/get_item.c | 2 ++ src/tests/parse_config_file.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/tests/get_item.c b/src/tests/get_item.c index 11db5f673..a30c99a81 100644 --- a/src/tests/get_item.c +++ b/src/tests/get_item.c @@ -402,6 +402,7 @@ int main(int argc, char *argv[]) } printf("lxc.proc returned %d %s\n", ret, v3); +#if HAVE_APPARMOR if (!c->set_config_item(c, "lxc.apparmor.profile", "unconfined")) { fprintf(stderr, "%d: failed to set aa_profile\n", __LINE__); goto out; @@ -413,6 +414,7 @@ int main(int argc, char *argv[]) goto out; } printf("lxc.aa_profile returned %d %s\n", ret, v2); +#endif lxc_container_put(c); diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index 7671f49bd..8e7731fe3 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -368,6 +368,7 @@ int main(int argc, char *argv[]) goto non_test_error; } +#if HAVE_APPARMOR if (set_get_compare_clear_save_load(c, "lxc.apparmor.profile", "unconfined", tmpf, true) < 0) { lxc_error("%s\n", "lxc.apparmor.profile"); goto non_test_error; @@ -377,11 +378,14 @@ int main(int argc, char *argv[]) lxc_error("%s\n", "lxc.apparmor.allow_incomplete"); goto non_test_error; } +#endif +#if HAVE_SELINUX if (set_get_compare_clear_save_load(c, "lxc.selinux.context", "system_u:system_r:lxc_t:s0:c22", tmpf, true) < 0) { lxc_error("%s\n", "lxc.selinux.context"); goto non_test_error; } +#endif if (set_get_compare_clear_save_load(c, "lxc.cgroup.cpuset.cpus", "1-100", tmpf, false) < 0) { -- 2.47.2