summaryrefslogtreecommitdiff
path: root/test/py/meson.build
AgeCommit message (Collapse)Author
2024-11-05test: py: LD_PRELOAD the C++ standard library when using ASanLaurent Pinchart
When the ASan runtime is linked using --as-needed, its dependency on the C++ standard library is stripped. This results to a failure to properly handled exceptions when a C++ dynamically loaded .so is used, as in the Python unit tests that load the libcamera Python module: AddressSanitizer: CHECK failed: asan_interceptors.cpp:335 "((__interception::real___cxa_throw)) != (0)" (0x0, 0x0) (tid=32679) #0 0x7fa2f32e6c19 in CheckUnwind /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_rtl.cpp:69 #1 0x7fa2f330c9fd in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/sanitizer_common/sanitizer_termination.cpp:86 #2 0x7fa2f3247824 in __interceptor___cxa_throw /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_interceptors.cpp:335 #3 0x7fa2f3247824 in __interceptor___cxa_throw /var/tmp/portage/sys-devel/gcc-13.3.1_p20241025/work/gcc-13-20241025/libsanitizer/asan/asan_interceptors.cpp:334 #4 0x7fa2efb6da8b in operator() ../../src/py/libcamera/py_main.cpp:157 [...] The issue has been reported in [1] and so far remains unfixed. Work around it by preloading the C++ standard library. [1] https://github.com/google/sanitizers/issues/934 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-11-05test: py: Replace environment array with environment objectLaurent Pinchart
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>
2022-12-24test: py: Fix test failure when ASan is enabledLaurent Pinchart
When the address sanitizer is enabled, the Python unit tests fail due to the link order runtime check as the Python interpreter is (generally) not linked to ASan. Fix this by LD_PRELOAD'ing the ASan runtime. We have to disable the leak detector as the Python interpreter itself leaks memory, which would result in test failures. To LD_PRELOAD the ASan runtime, the path to the binary needs to be known. gcc gives us a generic way to get the path, but that doesn't work with clang as the ASan runtime file name depends on the clang version and target architecture. We thus have to keep the Python test disabled when ASan is enabled and libcamera is compiled with clang. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Acked-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-05-10py: Add unittests.pyTomi Valkeinen
Add a simple unittests.py as a base for python unittests. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>