]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests: fix config file tests
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 13 Sep 2021 11:55:17 +0000 (13:55 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 14 Oct 2021 15:28:02 +0000 (17:28 +0200)
Link: https://bugs.launchpad.net/bugs/1943441
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/tests/parse_config_file.c

index 8e7731fe30cec7efdc776ca751eeea93511f40c1..df55d69c1182e5c051b204b398d32fff56a8f556 100644 (file)
@@ -368,20 +368,36 @@ int main(int argc, char *argv[])
                goto non_test_error;
        }
 
+       ret = set_get_compare_clear_save_load(c, "lxc.apparmor.profile", "unconfined", tmpf, true);
 #if HAVE_APPARMOR
-       if (set_get_compare_clear_save_load(c, "lxc.apparmor.profile", "unconfined", tmpf, true) < 0) {
+       if (ret < 0)
+#else
+       if (ret == 0)
+#endif
+       {
                lxc_error("%s\n", "lxc.apparmor.profile");
                goto non_test_error;
        }
 
-       if (set_get_compare_clear_save_load(c, "lxc.apparmor.allow_incomplete", "1", tmpf, true) < 0) {
+       ret = set_get_compare_clear_save_load(c, "lxc.apparmor.allow_incomplete", "1", tmpf, true);
+#if HAVE_APPARMOR
+       if (ret < 0)
+#else
+       if (ret == 0)
+#endif
+       {
                lxc_error("%s\n", "lxc.apparmor.allow_incomplete");
                goto non_test_error;
        }
 #endif
 
+       ret = set_get_compare_clear_save_load(c, "lxc.selinux.context", "system_u:system_r:lxc_t:s0:c22", tmpf, true);
 #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) {
+       if (ret < 0)
+#else
+       if (ret == 0)
+#endif
+       {
                lxc_error("%s\n", "lxc.selinux.context");
                goto non_test_error;
        }