aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-03-28 20:38:05 +0000
committerGerrit Code Review <gerrit@lix>2024-03-28 20:38:05 +0000
commit81e50fef70c2526f560439fde6dee8d33f961948 (patch)
treee7d40448e0aa07ea4288f20e9c24a696ea740332 /meson.build
parent61d394e34431eb18c2f750f04e8934238d3508bd (diff)
parent038daad2182a22c81861ee7cbb5f0c85f6bb16ba (diff)
Merge "meson: implement functional tests" into main
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build23
1 files changed, 23 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 14051a130..556712c34 100644
--- a/meson.build
+++ b/meson.build
@@ -18,6 +18,12 @@
# Finally, src/nix/meson.build defines the Nix command itself, relying on all prior meson files.
#
# Unit tests are setup in tests/unit/meson.build, under the test suite "check".
+#
+# Functional tests are a bit more complicated. Generally they're defined in
+# tests/functional/meson.build, and rely on helper scripts meson/setup-functional-tests.py
+# and meson/run-test.py. Scattered around also are configure_file() invocations, which must
+# be placed in specific directories' meson.build files to create the right directory tree
+# in the build directory.
project('lix', 'cpp',
version : run_command('bash', '-c', 'echo -n $(cat ./.version)$VERSION_SUFFIX', check : true).stdout().strip(),
@@ -27,6 +33,7 @@ project('lix', 'cpp',
'warning_level=1',
'debug=true',
'optimization=2',
+ 'errorlogs=true', # Please print logs for tests that fail
],
)
@@ -48,6 +55,11 @@ path_opts = [
'state-dir',
'log-dir',
]
+# For your grepping pleasure, this loop sets the following variables that aren't mentioned
+# literally above:
+# store_dir
+# state_dir
+# log_dir
foreach optname : path_opts
varname = optname.replace('-', '_')
path = get_option(optname)
@@ -206,6 +218,10 @@ deps += toml11
# Build-time tools
#
bash = find_program('bash')
+coreutils = find_program('coreutils')
+dot = find_program('dot', required : false)
+pymod = import('python')
+python = pymod.find_installation('python3')
# Used to workaround https://github.com/mesonbuild/meson/issues/2320 in src/nix/meson.build.
installcmd = find_program('install')
@@ -336,6 +352,13 @@ if get_option('profile-build').require(meson.get_compiler('cpp').get_id() == 'cl
endif
subdir('src')
+
if enable_tests
+ # Just configures `scripts/nix-profile.sh.in` (and copies the original to the build directory).
+ # Done as a subdirectory to convince Meson to put the configured files
+ # in `build/scripts` instead of just `build`.
+ subdir('scripts')
+
subdir('tests/unit')
+ subdir('tests/functional')
endif