Skip to content

Commit 8b3c040

Browse files
committed
luks: make cryptsetup optional in test suite
The LUKS test directory is included unconditionally by the parent meson.build (only gated by cross-compilation), but all LUKS tests require the cryptsetup binary. When cryptsetup is unavailable (e.g., on macOS/Darwin or minimal build environments), the build fails at configure time. Make cryptsetup optional and use subdir_done() to skip the entire test directory when it is not found. This also avoids the luksmeta_data.get('OLD_CRYPTSETUP') error that occurs when libcryptsetup was not detected. Move the jq find_program() call after the cryptsetup guard since it is only used within LUKS tests.
1 parent 1511844 commit 8b3c040

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/luks/tests/meson.build

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
# We use jq for comparing the pin config in the clevis luks list tests.
22
jq = find_program('jq', required: false)
33

4-
# We use cryptsetup for testing LUKS2 binding and saving the token in a
5-
# given token slot.
6-
cryptsetup = find_program('cryptsetup', required: true)
4+
# All LUKS tests require cryptsetup. The test directory is included
5+
# unconditionally by the parent meson.build, so we must handle the case
6+
# where cryptsetup is not available (e.g., on macOS/Darwin).
7+
cryptsetup = find_program('cryptsetup', required: false)
8+
if not cryptsetup.found()
9+
warning('Will not run LUKS tests due to missing cryptsetup')
10+
subdir_done()
11+
endif
712

813
# Use keyctl to check an existing token id can be created from
914
# kernel keyring password
@@ -14,6 +19,9 @@ else
1419
warning('keyutils not installed, unable to test existing token id binding')
1520
endif
1621

22+
# We use jq for comparing the pin config in the clevis luks list tests.
23+
jq = find_program('jq', required: false)
24+
1725
common_functions = configure_file(input: 'tests-common-functions.in',
1826
output: 'tests-common-functions',
1927
configuration: luksmeta_data,

0 commit comments

Comments
 (0)