Merge pull request #4095 from brauner/2022-03-22.meson

build: add tests to meson
This commit is contained in:
Stéphane Graber 2022-03-22 09:40:44 -04:00 committed by GitHub
commit c8f5432d54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 321 additions and 6 deletions

View File

@ -61,6 +61,7 @@ lxcpathprefix = get_option('config-path')
rootfsmount = get_option('rootfs-mount-dir')
runtimepath = join_paths(prefixdir, get_option('runtime-path'))
wants_io_uring = get_option('io-uring-event-loop')
want_tests = get_option('tests')
conf.set_quoted('BINDIR', bindir)
conf.set_quoted('DATADIR', datadir)
@ -428,6 +429,9 @@ subdir('hooks')
template_scripts = []
subdir('templates')
test_programs = []
subdir('src/tests')
cmd_programs = []
subdir('src/lxc/cmd')

View File

@ -21,7 +21,7 @@
/* Test apparmor rules */
#include <lxc/lxccontainer.h>
#include "lxc/utils.h"
#include "utils.h"
#include <fcntl.h>
#include <unistd.h>

View File

@ -33,7 +33,7 @@
#include <string.h>
#include "confile.h"
#include "lxc/state.h"
#include "state.h"
#include "lxctest.h"
int main(int argc, char *argv[])

View File

@ -29,7 +29,7 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "lxc/state.h"
#include "state.h"
#define MYNAME "lxctest1"

View File

@ -30,7 +30,7 @@
#include <errno.h>
#include <string.h>
#include "lxc/state.h"
#include "state.h"
#include "lxctest.h"
#include "utils.h"

View File

@ -29,7 +29,7 @@
#include <sys/wait.h>
#include <lxc/lxccontainer.h>
#include "lxc/state.h"
#include "state.h"
#define MYNAME "lxctest1"

View File

@ -19,7 +19,7 @@
#include "config.h"
#include "lxc/lxclock.h"
#include "lxclock.h"
#include "config.h"
#include <unistd.h>
#include <signal.h>

311
src/tests/meson.build Normal file
View File

@ -0,0 +1,311 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
tests_liblxc_includes = include_directories(
'.',
'../lxc/',
'../lxc/cgroups',
'../lxc/lsm',
'../lxc/storage',
'../include',
'../../')
tests_common_sources = files(
'../lxc/af_unix.c',
'../lxc/af_unix.h',
'../lxc/attach_options.h',
'../lxc/caps.c',
'../lxc/caps.h',
'../lxc/commands.c',
'../lxc/commands.h',
'../lxc/commands_utils.c',
'../lxc/commands_utils.h',
'../lxc/compiler.h',
'../lxc/conf.c',
'../lxc/conf.h',
'../lxc/confile.c',
'../lxc/confile.h',
'../lxc/confile_utils.c',
'../lxc/confile_utils.h',
'../lxc/cgroups/cgfsng.c',
'../lxc/cgroups/cgroup.c',
'../lxc/cgroups/cgroup.h',
'../lxc/cgroups/cgroup2_devices.c',
'../lxc/cgroups/cgroup2_devices.h',
'../lxc/cgroups/cgroup_utils.c',
'../lxc/cgroups/cgroup_utils.h',
'../lxc/error.c',
'../lxc/error.h',
'../lxc/initutils.c',
'../lxc/initutils.h',
'../lxc/file_utils.c',
'../lxc/file_utils.h',
'../lxc/lsm/apparmor.c',
'../lxc/lsm/lsm.c',
'../lxc/lsm/lsm.h',
'../lxc/lsm/nop.c',
'../lxc/lsm/selinux.c',
'../lxc/lxcseccomp.h',
'../lxc/lxclock.c',
'../lxc/lxclock.h',
'../lxc/macro.h',
'../lxc/mainloop.c',
'../lxc/mainloop.h',
'../lxc/memory_utils.h',
'../lxc/monitor.c',
'../lxc/monitor.h',
'../lxc/mount_utils.c',
'../lxc/mount_utils.h',
'../lxc/namespace.c',
'../lxc/namespace.h',
'../lxc/network.c',
'../lxc/network.h',
'../lxc/nl.c',
'../lxc/nl.h',
'../lxc/parse.c',
'../lxc/parse.h',
'../lxc/process_utils.c',
'../lxc/process_utils.h',
'../lxc/ringbuf.c',
'../lxc/ringbuf.h',
'../lxc/seccomp.c',
'../lxc/start.c',
'../lxc/start.h',
'../lxc/state.c',
'../lxc/state.h',
'../lxc/storage/btrfs.c',
'../lxc/storage/btrfs.h',
'../lxc/storage/dir.c',
'../lxc/storage/dir.h',
'../lxc/storage/loop.c',
'../lxc/storage/loop.h',
'../lxc/storage/lvm.c',
'../lxc/storage/lvm.h',
'../lxc/storage/nbd.c',
'../lxc/storage/nbd.h',
'../lxc/storage/overlay.c',
'../lxc/storage/overlay.h',
'../lxc/storage/rbd.c',
'../lxc/storage/rbd.h',
'../lxc/storage/rsync.c',
'../lxc/storage/rsync.h',
'../lxc/storage/storage.c',
'../lxc/storage/storage.h',
'../lxc/storage/storage_utils.c',
'../lxc/storage/storage_utils.h',
'../lxc/storage/zfs.c',
'../lxc/storage/zfs.h',
'../lxc/string_utils.c',
'../lxc/string_utils.h',
'../lxc/sync.c',
'../lxc/sync.h',
'../lxc/terminal.c',
'../lxc/terminal.h',
'../lxc/utils.c',
'../lxc/utils.h',
'../lxc/uuid.c',
'../lxc/uuid.h',
'../lxc/log.h',
'../lxc/log.c') + include_sources + netns_ifaddrs_sources
test_programs += executable(
'lxc-test-arch-parse',
files('arch_parse.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-apparmor',
files('aa.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-api-reboot',
files('api_reboot.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-attach',
files('attach.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-basic',
files('basic.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-capabilities',
files('capabilities.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-cgpath',
files('cgpath.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-clonetest',
files('clonetest.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-concurrent',
files('concurrent.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-config-jump-table',
files('config_jump_table.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-console',
files('console.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-console-log',
files('console_log.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-containertests',
files('containertests.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-createtest',
files('createtest.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-criu-check-feature',
files('criu_check_feature.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-cve-2019-5736',
files('cve-2019-5736.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-destroytest',
files('destroytest.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-device-add-remove',
files('device_add_remove.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-fuzz-lxc-cgroup-init',
files('fuzz-lxc-cgroup-init.c',
'dummy.cxx') + tests_common_sources,
link_args : ['-static'],
include_directories : tests_liblxc_includes,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-fuzz-lxc-config-read',
files('fuzz-lxc-config-read.c',
'dummy.cxx') + tests_common_sources,
link_args : ['-static'],
include_directories : tests_liblxc_includes,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-fuzz-lxc-define-load',
files('fuzz-lxc-define-load.c',
'dummy.cxx') + tests_common_sources,
link_args : ['-static'],
include_directories : tests_liblxc_includes,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-get-item',
files('get_item.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-getkeys',
files('getkeys.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-list',
files('list.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)
test_programs += executable(
'lxc-test-locktests',
files('locktests.c') + tests_common_sources,
include_directories : tests_liblxc_includes,
dependencies : liblxc_dep,
install: false,
build_by_default: want_tests != false)