aboutsummaryrefslogtreecommitdiffstats
path: root/host/cmake
diff options
context:
space:
mode:
authorJoerg Hofrichter <joerg.hofrichter@ni.com>2020-07-10 15:32:21 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2020-08-04 07:38:40 -0500
commit233fc368a3d5ac2472d3b53918d4f0ed1d353f2c (patch)
treef5bbb90a09cedf0bd346cd798b47e47bff6f628d /host/cmake
parent7afc84de1692386df5ee65462703499950170f48 (diff)
downloaduhd-233fc368a3d5ac2472d3b53918d4f0ed1d353f2c.tar.gz
uhd-233fc368a3d5ac2472d3b53918d4f0ed1d353f2c.tar.bz2
uhd-233fc368a3d5ac2472d3b53918d4f0ed1d353f2c.zip
cmake: tests: Support qemu also for python based tests
This requires python3 to be installed in the target sysroot
Diffstat (limited to 'host/cmake')
-rw-r--r--host/cmake/Modules/UHDUnitTest.cmake24
1 files changed, 18 insertions, 6 deletions
diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake
index 76dfdd029..340279b9b 100644
--- a/host/cmake/Modules/UHDUnitTest.cmake
+++ b/host/cmake/Modules/UHDUnitTest.cmake
@@ -112,12 +112,24 @@ endfunction(UHD_ADD_TEST)
# Add a Python unit test
########################################################################
function(UHD_ADD_PYTEST test_name)
- add_test(NAME ${test_name}
- COMMAND ${RUNTIME_PYTHON_EXECUTABLE} -m unittest discover
- -s ${CMAKE_CURRENT_SOURCE_DIR}
- -p "${test_name}.*"
- WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/python"
- )
+ if(ENABLE_QEMU_UNITTESTS)
+ # use QEMU emulator for executing test
+ add_test(NAME ${test_name}
+ COMMAND ${QEMU_EXECUTABLE} -L ${QEMU_SYSROOT}
+ ${QEMU_PYTHON_EXECUTABLE}
+ -m unittest discover
+ -s ${CMAKE_CURRENT_SOURCE_DIR}
+ -p "${test_name}.*"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/python"
+ )
+ else()
+ add_test(NAME ${test_name}
+ COMMAND ${RUNTIME_PYTHON_EXECUTABLE} -m unittest discover
+ -s ${CMAKE_CURRENT_SOURCE_DIR}
+ -p "${test_name}.*"
+ WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/python"
+ )
+ endif(ENABLE_QEMU_UNITTESTS)
set_tests_properties(${test_name} PROPERTIES
ENVIRONMENT PYTHONPATH=${CMAKE_SOURCE_DIR}/tests/common)
endfunction(UHD_ADD_PYTEST)