From: Christian Brauner Date: Wed, 23 Mar 2022 15:10:48 +0000 (+0100) Subject: tests: fix include statements X-Git-Tag: lxc-5.0.0~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44c22b8a957eb0cb66d88941381d13f7ada69799;p=thirdparty%2Flxc.git tests: fix include statements Signed-off-by: Christian Brauner (Microsoft) --- diff --git a/src/tests/lxc-test-utils.c b/src/tests/lxc-test-utils.c index f10c1eba8..e23ac729c 100644 --- a/src/tests/lxc-test-utils.c +++ b/src/tests/lxc-test-utils.c @@ -254,13 +254,13 @@ void test_lxc_safe_uint(void) lxc_test_assert_abort((-EINVAL == lxc_safe_uint("-123", &n))); ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)UINT_MAX); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((0 == lxc_safe_uint(numstr, &n)) && n == UINT_MAX); ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)UINT_MAX + 1); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((-ERANGE == lxc_safe_uint(numstr, &n))); @@ -287,25 +287,25 @@ void test_lxc_safe_int(void) char numstr[INTTYPE_TO_STRLEN(uint64_t)]; ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)INT_MAX); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MAX); ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)INT_MAX + 1); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n))); ret = snprintf(numstr, sizeof(numstr), "%" PRId64, (int64_t)INT_MIN); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MIN); ret = snprintf(numstr, sizeof(numstr), "%" PRId64, (int64_t)INT_MIN - 1); - if (ret < 0 || ret >= sizeof(numstr)) + if (ret < 0 || (size_t)ret >= sizeof(numstr)) exit(EXIT_FAILURE); lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n))); @@ -551,7 +551,7 @@ void test_task_blocks_signal(void) sigemptyset(&mask); - for (i = 0; i < (sizeof(signals) / sizeof(signals[0])); i++) { + for (i = 0; (size_t)i < (sizeof(signals) / sizeof(signals[0])); i++) { ret = sigaddset(&mask, signals[i]); if (ret < 0) _exit(EXIT_FAILURE); @@ -563,7 +563,7 @@ void test_task_blocks_signal(void) _exit(EXIT_FAILURE); } - for (i = 0; i < (sizeof(signals) / sizeof(signals[0])); i++) { + for (i = 0; (size_t)i < (sizeof(signals) / sizeof(signals[0])); i++) { if (!task_blocks_signal(getpid(), signals[i])) { lxc_error("Failed to detect blocked signal " "(idx = %d, signal number = %d)\n", diff --git a/src/tests/mount_injection.c b/src/tests/mount_injection.c index 64b1cb253..f98370b4c 100644 --- a/src/tests/mount_injection.c +++ b/src/tests/mount_injection.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -32,6 +31,7 @@ #include "config.h" #include "lxctest.h" +#include "list.h" #include "utils.h" #define NAME "mount_injection_test-" diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index 990ce7256..1444799ca 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -33,7 +33,7 @@ #include "conf.h" #include "confile_utils.h" -#include "lxc/state.h" +#include "state.h" #include "lxctest.h" #include "utils.h" diff --git a/src/tests/reboot.c b/src/tests/reboot.c index e16aabe2c..0a07bf467 100644 --- a/src/tests/reboot.c +++ b/src/tests/reboot.c @@ -30,7 +30,7 @@ #include #include -#include "lxc/namespace.h" +#include "namespace.h" #include #include diff --git a/src/tests/share_ns.c b/src/tests/share_ns.c index c46023f01..fd070adad 100644 --- a/src/tests/share_ns.c +++ b/src/tests/share_ns.c @@ -288,7 +288,7 @@ int main(int argc, char *argv[]) lxc_debug("Starting namespace sharing test iteration %d\n", j); - for (i = 0; i < nthreads; i++) { + for (i = 0; (size_t)i < nthreads; i++) { memset(&args[i], 0, sizeof(struct thread_args)); memset(&threads[i], 0, sizeof(pthread_t)); @@ -303,7 +303,7 @@ int main(int argc, char *argv[]) goto on_error_stop; } - for (i = 0; i < nthreads; i++) { + for (i = 0; (size_t)i < nthreads; i++) { ret = pthread_join(threads[i], NULL); if (ret != 0) goto on_error_stop; diff --git a/src/tests/snapshot.c b/src/tests/snapshot.c index 62440fe28..dfbf78e45 100644 --- a/src/tests/snapshot.c +++ b/src/tests/snapshot.c @@ -26,7 +26,7 @@ #include #include #include -#include "lxc/lxc.h" +#include "lxc.h" #define MYNAME "snapxxx1" #define MYNAME2 "snapxxx3"