diff options
-rw-r--r-- | .github/workflows/check.yml | 2 | ||||
-rw-r--r-- | completions/bash/meson.build | 1 | ||||
-rw-r--r-- | meson.build | 10 | ||||
-rw-r--r-- | meson_options.txt | 5 | ||||
-rw-r--r-- | tests/meson.build | 24 | ||||
-rwxr-xr-x | tests/test-specifying-pidns.sh | 2 | ||||
-rw-r--r-- | tests/test-utils.c | 4 |
7 files changed, 37 insertions, 11 deletions
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index ceb3b82..34b8771 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -110,7 +110,7 @@ jobs: ( cd DESTDIR && find -ls ) - name: dist run: | - BWRAP_MUST_WORK=1 meson dist -C _build + BWRAP_MUST_WORK=1 CI_MESON_DIST=1 meson dist -C _build - name: Collect dist test logs on failure if: failure() run: mv _build/meson-private/dist-build/meson-logs/testlog.txt test-logs/disttestlog.txt || true diff --git a/completions/bash/meson.build b/completions/bash/meson.build index 92ef27f..1dd946f 100644 --- a/completions/bash/meson.build +++ b/completions/bash/meson.build @@ -22,7 +22,6 @@ if bash_completion_dir == '' 'completionsdir', default: '', define_variable: [ - 'prefix', get_option('prefix'), 'datadir', get_option('prefix') / get_option('datadir'), ], ) diff --git a/meson.build b/meson.build index 159ab2b..85513f3 100644 --- a/meson.build +++ b/meson.build @@ -10,6 +10,7 @@ project( cc = meson.get_compiler('c') add_project_arguments('-D_GNU_SOURCE', language : 'c') +common_include_directories = include_directories('.') # Keep this in sync with ostree, except remove -Wall (part of Meson # warning_level 2) and -Werror=declaration-after-statement @@ -61,9 +62,14 @@ if ( ], language : 'c') endif -sh = find_program('sh', required : true) bash = find_program('bash', required : false) +if get_option('python') == '' + python = find_program('python3') +else + python = find_program(get_option('python')) +endif + libcap_dep = dependency('libcap', required : true) selinux_dep = dependency( @@ -145,3 +151,5 @@ endif if not meson.is_subproject() subdir('completions') endif + +subdir('tests') diff --git a/meson_options.txt b/meson_options.txt index aa88a2f..2fa3a8c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -22,6 +22,11 @@ option( description : 'Prepend string to bwrap executable name, for use with subprojects', ) option( + 'python', + type : 'string', + description : 'Path to Python 3, or empty to use python3', +) +option( 'require_userns', type : 'boolean', description : 'require user namespaces by default when installed setuid', diff --git a/tests/meson.build b/tests/meson.build index 389658f..0f32a37 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -5,9 +5,15 @@ test_programs = [ '../utils.c', '../utils.h', dependencies : [selinux_dep], + include_directories : common_include_directories, )], ] +executable( + 'try-syscall', + 'try-syscall.c', +) + test_scripts = [ 'test-run.sh', 'test-seccomp.py', @@ -17,8 +23,8 @@ test_scripts = [ test_env = environment() test_env.set('BWRAP', bwrap.full_path()) -test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) -test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) +test_env.set('G_TEST_BUILDDIR', meson.current_build_dir() / '..') +test_env.set('G_TEST_SRCDIR', meson.current_source_dir() / '..') foreach pair : test_programs name = pair[0] @@ -40,19 +46,25 @@ foreach pair : test_programs endforeach foreach test_script : test_scripts + if test_script.endswith('.py') + interpreter = python + else + interpreter = bash + endif + if meson.version().version_compare('>=0.50.0') test( test_script, - bash, - args : [test_script], + interpreter, + args : [files(test_script)], env : test_env, protocol : 'tap', ) else test( test_script, - bash, - args : [test_script], + interpreter, + args : [files(test_script)], env : test_env, ) endif diff --git a/tests/test-specifying-pidns.sh b/tests/test-specifying-pidns.sh index b0db6d0..5b88af4 100755 --- a/tests/test-specifying-pidns.sh +++ b/tests/test-specifying-pidns.sh @@ -10,6 +10,8 @@ echo "1..1" # This test needs user namespaces if test -n "${bwrap_is_suid:-}"; then echo "ok - # SKIP no setuid support for --unshare-user" +elif test -n "${CI_MESON_DIST:-}"; then + echo "not ok - # TODO this test hangs under 'meson dist' during Github Workflow CI" else mkfifo donepipe $RUN --info-fd 42 --unshare-user --unshare-pid sh -c 'readlink /proc/self/ns/pid > sandbox-pidns; cat < donepipe' >/dev/null 42>info.json & diff --git a/tests/test-utils.c b/tests/test-utils.c index 23d6bcd..c9b859d 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -199,8 +199,8 @@ test_has_path_prefix (void) } int -main (int argc, - char **argv) +main (int argc UNUSED, + char **argv UNUSED) { setvbuf (stdout, NULL, _IONBF, 0); test_n_elements (); |