tests: fix include statements

Signed-off-by: Christian Brauner (Microsoft) <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2022-03-23 16:10:48 +01:00 committed by Christian Brauner (Microsoft)
parent c8f5432d54
commit 44c22b8a95
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
6 changed files with 14 additions and 14 deletions

View File

@ -254,13 +254,13 @@ void test_lxc_safe_uint(void)
lxc_test_assert_abort((-EINVAL == lxc_safe_uint("-123", &n))); lxc_test_assert_abort((-EINVAL == lxc_safe_uint("-123", &n)));
ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)UINT_MAX); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((0 == lxc_safe_uint(numstr, &n)) && n == UINT_MAX); lxc_test_assert_abort((0 == lxc_safe_uint(numstr, &n)) && n == UINT_MAX);
ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)UINT_MAX + 1); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((-ERANGE == lxc_safe_uint(numstr, &n))); 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)]; char numstr[INTTYPE_TO_STRLEN(uint64_t)];
ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)INT_MAX); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MAX); lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MAX);
ret = snprintf(numstr, sizeof(numstr), "%" PRIu64, (uint64_t)INT_MAX + 1); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n))); lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n)));
ret = snprintf(numstr, sizeof(numstr), "%" PRId64, (int64_t)INT_MIN); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MIN); lxc_test_assert_abort((0 == lxc_safe_int(numstr, &n)) && n == INT_MIN);
ret = snprintf(numstr, sizeof(numstr), "%" PRId64, (int64_t)INT_MIN - 1); 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); exit(EXIT_FAILURE);
lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n))); lxc_test_assert_abort((-ERANGE == lxc_safe_int(numstr, &n)));
@ -551,7 +551,7 @@ void test_task_blocks_signal(void)
sigemptyset(&mask); 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]); ret = sigaddset(&mask, signals[i]);
if (ret < 0) if (ret < 0)
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
@ -563,7 +563,7 @@ void test_task_blocks_signal(void)
_exit(EXIT_FAILURE); _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])) { if (!task_blocks_signal(getpid(), signals[i])) {
lxc_error("Failed to detect blocked signal " lxc_error("Failed to detect blocked signal "
"(idx = %d, signal number = %d)\n", "(idx = %d, signal number = %d)\n",

View File

@ -23,7 +23,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <lxc/lxccontainer.h> #include <lxc/lxccontainer.h>
#include <lxc/list.h>
#include <string.h> #include <string.h>
#include <sys/mount.h> #include <sys/mount.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -32,6 +31,7 @@
#include "config.h" #include "config.h"
#include "lxctest.h" #include "lxctest.h"
#include "list.h"
#include "utils.h" #include "utils.h"
#define NAME "mount_injection_test-" #define NAME "mount_injection_test-"

View File

@ -33,7 +33,7 @@
#include "conf.h" #include "conf.h"
#include "confile_utils.h" #include "confile_utils.h"
#include "lxc/state.h" #include "state.h"
#include "lxctest.h" #include "lxctest.h"
#include "utils.h" #include "utils.h"

View File

@ -30,7 +30,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include "lxc/namespace.h" #include "namespace.h"
#include <sched.h> #include <sched.h>
#include <linux/sched.h> #include <linux/sched.h>

View File

@ -288,7 +288,7 @@ int main(int argc, char *argv[])
lxc_debug("Starting namespace sharing test iteration %d\n", j); 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(&args[i], 0, sizeof(struct thread_args));
memset(&threads[i], 0, sizeof(pthread_t)); memset(&threads[i], 0, sizeof(pthread_t));
@ -303,7 +303,7 @@ int main(int argc, char *argv[])
goto on_error_stop; goto on_error_stop;
} }
for (i = 0; i < nthreads; i++) { for (i = 0; (size_t)i < nthreads; i++) {
ret = pthread_join(threads[i], NULL); ret = pthread_join(threads[i], NULL);
if (ret != 0) if (ret != 0)
goto on_error_stop; goto on_error_stop;

View File

@ -26,7 +26,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "lxc/lxc.h" #include "lxc.h"
#define MYNAME "snapxxx1" #define MYNAME "snapxxx1"
#define MYNAME2 "snapxxx3" #define MYNAME2 "snapxxx3"