From ea5a08dbc385c38688833fd04c6fe3fc142ea27b Mon Sep 17 00:00:00 2001 From: Aaron Rossetto Date: Thu, 14 Jan 2021 10:59:12 -0600 Subject: tests: Add lib/ to LD_LIBRARY_PATH for pytests This commit sets the LD_LIBRARY_PATH environment variable when invoking pytests to ensure that Python tests that use bindings to UHD in libpyuhd.so can link to new symbols in libuhd.so without the need to have UHD installed. --- host/cmake/Modules/UHDUnitTest.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake index d477dc966..519be9ca0 100644 --- a/host/cmake/Modules/UHDUnitTest.cmake +++ b/host/cmake/Modules/UHDUnitTest.cmake @@ -131,6 +131,11 @@ function(UHD_ADD_PYTEST test_name) ) endif(ENABLE_QEMU_UNITTESTS) # Include ${CMAKE_BINARY_DIR}/utils/ for testing the python utils - set_tests_properties(${test_name} PROPERTIES - ENVIRONMENT PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/) + if(APPLE) + set_tests_properties(${test_name} PROPERTIES + ENVIRONMENT "DYLD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/") + else() + set_tests_properties(${test_name} PROPERTIES + ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib/;PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common:${CMAKE_BINARY_DIR}/utils/") + endif() endfunction(UHD_ADD_PYTEST) -- cgit v1.2.3