forked from lix-project/lix
Merge "meson: add missing tests: ca, dyn-drv, plugins, libstoreconsumer" into main
This commit is contained in:
commit
4e11b0d04d
14
meson.build
14
meson.build
|
@ -92,8 +92,22 @@ host_system = host_machine.cpu_family() + '-' + host_machine.system()
|
|||
message('canonical Nix system name:', host_system)
|
||||
|
||||
is_linux = host_machine.system() == 'linux'
|
||||
is_darwin = host_machine.system() == 'darwin'
|
||||
is_x64 = host_machine.cpu_family() == 'x86_64'
|
||||
|
||||
# Per-platform arguments that you should probably pass to shared_module() invocations.
|
||||
# Something like add_project_arguments() can't be scoped on only shared modules, so this
|
||||
# variable is here instead.
|
||||
# This corresponds to the $(1)_ALLOW_UNDEFINED option from the Make buildsystem.
|
||||
# Mostly this is load-bearing on the plugin tests defined in tests/functional/plugins/meson.build.
|
||||
shared_module_link_args = []
|
||||
if is_darwin
|
||||
shared_module_link_args += ['-undefined', 'suppress', '-flat_namespace']
|
||||
elif is_linux
|
||||
# -Wl,-z,defs is the equivalent, but a comment in the Make buildsystem says that breaks
|
||||
# Clang sanitizers on Linux.
|
||||
# FIXME(Qyriad): is that true?
|
||||
endif
|
||||
deps = [ ]
|
||||
configdata = { }
|
||||
|
||||
|
|
|
@ -25,9 +25,37 @@ subdir('ca')
|
|||
# Just configures `dyn-drv/config.nix.in`. Same as above.
|
||||
subdir('dyn-drv')
|
||||
|
||||
subdir('plugins')
|
||||
subdir('test-libstoreconsumer')
|
||||
|
||||
functional_tests_scripts = [
|
||||
'init.sh',
|
||||
'test-infra.sh',
|
||||
'ca/build.sh',
|
||||
'ca/build-cache.sh',
|
||||
'ca/concurrent-builds.sh',
|
||||
'ca/derivation-json.sh',
|
||||
'ca/duplicate-realisation-in-closure.sh',
|
||||
'ca/eval-store.sh',
|
||||
'ca/gc.sh',
|
||||
'ca/import-derivation.sh',
|
||||
'ca/new-build-cmd.sh',
|
||||
'ca/nix-copy.sh',
|
||||
'ca/nix-run.sh',
|
||||
'ca/nix-shell.sh',
|
||||
'ca/post-hook.sh',
|
||||
'ca/recursive.sh',
|
||||
'ca/repl.sh',
|
||||
'ca/selfref-gc.sh',
|
||||
'ca/signatures.sh',
|
||||
'ca/substitute.sh',
|
||||
'ca/why-depends.sh',
|
||||
'dyn-drv/text-hashed-output.sh',
|
||||
'dyn-drv/recursive-mod-json.sh',
|
||||
'dyn-drv/build-built-drv.sh',
|
||||
'dyn-drv/eval-outputOf.sh',
|
||||
'dyn-drv/dep-built-drv.sh',
|
||||
'dyn-drv/old-daemon-error-hack.sh',
|
||||
'flakes/flakes.sh',
|
||||
'flakes/develop.sh',
|
||||
'flakes/develop-r8854.sh',
|
||||
|
@ -152,6 +180,8 @@ functional_tests_scripts = [
|
|||
'read-only-store.sh',
|
||||
'nested-sandboxing.sh',
|
||||
'debugger.sh',
|
||||
'plugins.sh',
|
||||
'test-libstoreconsumer.sh',
|
||||
]
|
||||
|
||||
# TODO(Qyriad): this will hopefully be able to be removed when we remove the autoconf+Make
|
||||
|
@ -165,6 +195,21 @@ foreach script : functional_tests_scripts
|
|||
# Turns, e.g., `tests/functional/flakes/show.sh` into a Meson test target called
|
||||
# `functional-flakes-show`.
|
||||
name = 'functional-@0@'.format(fs.replace_suffix(script, '')).replace('/', '-')
|
||||
|
||||
extra_deps = []
|
||||
if script == 'plugins.sh'
|
||||
extra_deps += [
|
||||
# Set in tests/functional/plugins/meson.build
|
||||
libplugintest,
|
||||
libplugintestfail,
|
||||
]
|
||||
elif script == 'test-libstoreconsumer.sh'
|
||||
extra_deps += [
|
||||
# Set in tests/functional/test-libstoreconsumer/meson.build
|
||||
libstoreconsumer_tester,
|
||||
]
|
||||
endif
|
||||
|
||||
test(
|
||||
name,
|
||||
python,
|
||||
|
@ -179,6 +224,8 @@ foreach script : functional_tests_scripts
|
|||
# some tests take 15+ seconds even on an otherwise idle machine, on a loaded machine
|
||||
# this can easily drive them to failure. give them more time, 5min rather than 30sec
|
||||
timeout : 300,
|
||||
# Used for target dependency/ordering tracking, not adding compiler flags or anything.
|
||||
depends : extra_deps,
|
||||
)
|
||||
endforeach
|
||||
|
||||
|
|
|
@ -4,12 +4,19 @@ if [[ $BUILD_SHARED_LIBS != 1 ]]; then
|
|||
skipTest "Plugins are not supported"
|
||||
fi
|
||||
|
||||
res=$(nix --option setting-set true --option plugin-files $PWD/plugins/libplugintest.* eval --expr builtins.anotherNull)
|
||||
# FIXME(Qyriad): this is working around Meson putting `libplugintest.so.p` in the same place
|
||||
# as `libplugintest.so`, so `libplugintest.*` grabs both.
|
||||
libext=so
|
||||
if [[ "$(uname -s)" == Darwin ]]; then
|
||||
libext=dylib
|
||||
fi
|
||||
|
||||
res=$(nix --option setting-set true --option plugin-files "$PWD/plugins/libplugintest.$libext" eval --expr builtins.anotherNull)
|
||||
|
||||
[ "$res"x = "nullx" ]
|
||||
|
||||
# Plugin load failing due to missing symbols
|
||||
res=$(nix --option plugin-files $PWD/plugins/libplugintestfail.* eval --expr '1234 + 5' 2>&1)
|
||||
res=$(nix --option plugin-files "$PWD/plugins/libplugintestfail.$libext" eval --expr '1234 + 5' 2>&1)
|
||||
# We expect this to succeed evaluating
|
||||
echo "$res" | grep 1239 >/dev/null
|
||||
# On Linux, we expect this to print some failure of dlopen.
|
||||
|
|
31
tests/functional/plugins/meson.build
Normal file
31
tests/functional/plugins/meson.build
Normal file
|
@ -0,0 +1,31 @@
|
|||
libplugintest = shared_module(
|
||||
'plugintest',
|
||||
'plugintest.cc',
|
||||
dependencies : [
|
||||
liblixutil,
|
||||
liblixstore,
|
||||
liblixexpr,
|
||||
liblixfetchers,
|
||||
],
|
||||
build_by_default : false,
|
||||
link_args : shared_module_link_args,
|
||||
)
|
||||
|
||||
libplugintestfail_link_args = []
|
||||
if is_linux
|
||||
libplugintestfail_link_args = ['-Wl,-z,now']
|
||||
endif
|
||||
|
||||
libplugintestfail = shared_module(
|
||||
'plugintestfail',
|
||||
'plugintestfail.cc',
|
||||
dependencies : [
|
||||
liblixutil,
|
||||
liblixstore,
|
||||
liblixexpr,
|
||||
liblixfetchers,
|
||||
],
|
||||
cpp_args : ['-DMISSING_REFERENCE'],
|
||||
link_args : shared_module_link_args + libplugintestfail_link_args,
|
||||
build_by_default : false,
|
||||
)
|
13
tests/functional/test-libstoreconsumer/meson.build
Normal file
13
tests/functional/test-libstoreconsumer/meson.build
Normal file
|
@ -0,0 +1,13 @@
|
|||
libstoreconsumer_tester = executable(
|
||||
'test-libstoreconsumer',
|
||||
'main.cc',
|
||||
dependencies : [
|
||||
liblixutil,
|
||||
liblixstore,
|
||||
sodium,
|
||||
editline,
|
||||
boost,
|
||||
lowdown,
|
||||
],
|
||||
build_by_default : false,
|
||||
)
|
Loading…
Reference in a new issue