libcamera/test/py/meson.build
Laurent Pinchart b3eba17213 test: py: Replace environment array with environment object
The environment for pyunittests is stored in an array. Meson provides an
environment object, which makes handling of multi-value environment
variables easier and increases code clarity. Switch to using the
environment object.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05 15:28:33 +02:00

36 lines
892 B
Meson

# SPDX-License-Identifier: CC0-1.0
if not pycamera_enabled
subdir_done()
endif
# If ASan is enabled, the link order runtime check will fail as Python is not
# linked to ASan. LD_PRELOAD the ASan runtime if available, or skip the test
# otherwise.
if asan_runtime_missing
warning('Unable to get path to ASan runtime, Python test disabled')
subdir_done()
endif
py_env = environment()
pymod = import('python')
py3 = pymod.find_installation('python3')
pypathdir = meson.project_build_root() / 'src' / 'py'
py_env.append('PYTHONPATH', pypathdir)
if asan_enabled
py_env.append('LD_PRELOAD', asan_runtime)
# Disable leak detection as the Python interpreter is full of leaks.
py_env.append('ASAN_OPTIONS', 'detect_leaks=0')
endif
test('pyunittests',
py3,
args : files('unittests.py'),
env : py_env,
suite : 'pybindings',
is_parallel : false)