aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2021-09-02 11:38:05 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2021-09-10 15:08:10 -0500
commit09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d (patch)
treef632274ec4af60e1559a361bd2b607cc65e9d5f7 /host/tests
parente64d3e28316f642c1203722b6f5f2af710a7e281 (diff)
downloaduhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.gz
uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.tar.bz2
uhd-09d94529e5dbfa992cb6012cc0dc38d6f3e7d57d.zip
cmake: Replace CMAKE_{SOURCE,BINARY}_DIR with UHD_*_DIR
See the CMake 3.8 documentation on these two variables: https://cmake.org/cmake/help/v3.8/variable/PROJECT-NAME_SOURCE_DIR.html https://cmake.org/cmake/help/v3.8/variable/CMAKE_SOURCE_DIR.html Under normal circumstances, these two are identical. For sub-projects (i.e., when building UHD as part of something else that is also a CMake project), only the former is useful. There is no discernible downside of using UHD_SOURCE_DIR over CMAKE_SOURCE_DIR. This was changed using sed: $ sed -i "s/CMAKE_SOURCE_DIR/UHD_SOURCE_DIR/g" \ `ag -l CMAKE_SOURCE_DIR **/{CMakeLists.txt,*.cmake}` $ sed -i "s/CMAKE_BINARY_DIR/UHD_BINARY_DIR/g" \ `ag -l CMAKE_BINARY_DIR **/{CMakeLists.txt,*.cmake}` At the same time, we also replace the CMake variable UHD_HOST_ROOT (used in MPM) with UHD_SOURCE_DIR. There's no reason to have two variables with the same meaning and different names, but more importantly, this means that UHD_SOURCE_DIR is defined even in those cases where MPM calls into CMake files from UHD without any additional patches. Shoutout to GitHub user marcobergamin for bringing this up.
Diffstat (limited to 'host/tests')
-rw-r--r--host/tests/CMakeLists.txt140
-rw-r--r--host/tests/common/CMakeLists.txt2
-rw-r--r--host/tests/devtest/CMakeLists.txt2
3 files changed, 72 insertions, 72 deletions
diff --git a/host/tests/CMakeLists.txt b/host/tests/CMakeLists.txt
index 9b27e03c1..d3e44a518 100644
--- a/host/tests/CMakeLists.txt
+++ b/host/tests/CMakeLists.txt
@@ -89,8 +89,8 @@ if(ENABLE_C_API)
)
endif(ENABLE_C_API)
-include_directories("${CMAKE_SOURCE_DIR}/lib/include")
-include_directories("${CMAKE_BINARY_DIR}/lib/include")
+include_directories("${UHD_SOURCE_DIR}/lib/include")
+include_directories("${UHD_BINARY_DIR}/lib/include")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/common")
#for each source: build an executable, register it as a test
@@ -149,7 +149,7 @@ macro(UHD_ADD_RFNOC_BLOCK_TEST)
TARGET rfnoc_block_tests/${test_TARGET}
EXTRA_SOURCES
${test_EXTRA_SOURCES}
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/graph.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/graph.cpp
INCLUDE_DIRS
${test_INCLUDE_DIRS}
)
@@ -163,14 +163,14 @@ if(ENABLE_DPDK)
UHD_ADD_NONAPI_TEST(
TARGET "dpdk_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/utils/config_parser.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/paths.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/pathslib.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/prefs.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/adapter.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/config_parser.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/paths.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/pathslib.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/prefs.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/adapter.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
INCLUDE_DIRS
${DPDK_INCLUDE_DIRS}
EXTRA_LIBS ${DPDK_LIBRARIES}
@@ -179,23 +179,23 @@ if(ENABLE_DPDK)
UHD_ADD_NONAPI_TEST(
TARGET "dpdk_port_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/utils/config_parser.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/paths.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/pathslib.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/prefs.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/adapter.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/config_parser.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/paths.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/pathslib.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/prefs.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/adapter.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
INCLUDE_DIRS
${DPDK_INCLUDE_DIRS}
EXTRA_LIBS ${DPDK_LIBRARIES}
NOAUTORUN # Don't register for auto-run, it requires special config
)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_common.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/uhd-dpdk/dpdk_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/udp_dpdk_link.cpp
PROPERTIES COMPILE_FLAGS "-march=native -D_GNU_SOURCE"
)
ENDIF(ENABLE_DPDK)
@@ -203,17 +203,17 @@ ENDIF(ENABLE_DPDK)
UHD_ADD_NONAPI_TEST(
TARGET "system_time_test.cpp"
EXTRA_SOURCES
- "${CMAKE_SOURCE_DIR}/lib/utils/system_time.cpp"
+ "${UHD_SOURCE_DIR}/lib/utils/system_time.cpp"
)
UHD_ADD_NONAPI_TEST(
TARGET "streamer_benchmark.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_ctrl_xport.cpp
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_rx_data_xport.cpp
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_tx_data_xport.cpp
- ${CMAKE_SOURCE_DIR}/lib/transport/inline_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/chdr_ctrl_xport.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/chdr_rx_data_xport.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/chdr_tx_data_xport.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/inline_io_service.cpp
NOAUTORUN # Don't register for auto-run
)
@@ -224,7 +224,7 @@ UHD_ADD_NONAPI_TEST(
UHD_ADD_NONAPI_TEST(
TARGET "config_parser_test.cpp"
- EXTRA_SOURCES ${CMAKE_SOURCE_DIR}/lib/utils/config_parser.cpp
+ EXTRA_SOURCES ${UHD_SOURCE_DIR}/lib/utils/config_parser.cpp
)
# Careful: This is to satisfy the out-of-library build of paths.cpp. This is
@@ -234,69 +234,69 @@ set(UHD_LIB_DIR "lib")
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" UHD_PKG_PATH)
string(REPLACE "\\" "\\\\" UHD_PKG_PATH "${UHD_PKG_PATH}")
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/lib/utils/paths.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/paths.cpp
PROPERTIES COMPILE_DEFINITIONS
"UHD_PKG_PATH=\"${UHD_PKG_PATH}\";UHD_LIB_DIR=\"${UHD_LIB_DIR}\""
)
UHD_ADD_NONAPI_TEST(
TARGET "paths_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/utils/pathslib.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/pathslib.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET rfnoc_propprop_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/graph.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/graph.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET rfnoc_detailgraph_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/graph.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/graph.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET actions_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/graph.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/graph.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET rfnoc_chdr_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/chdr_packet_writer.cpp
INCLUDE_DIRS
- ${CMAKE_BINARY_DIR}/lib/rfnoc/
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/
+ ${UHD_BINARY_DIR}/lib/rfnoc/
+ ${UHD_SOURCE_DIR}/lib/rfnoc/
)
UHD_ADD_NONAPI_TEST(
TARGET client_zero_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/client_zero.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/client_zero.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET zbx_cpld_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_lo_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_lo_ctrl.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
INCLUDE_DIRS
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps
+ ${UHD_BINARY_DIR}/lib/ic_reg_maps
)
UHD_ADD_NONAPI_TEST(
TARGET lmx2572_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
INCLUDE_DIRS
- ${CMAKE_BINARY_DIR}/lib/ic_reg_maps
+ ${UHD_BINARY_DIR}/lib/ic_reg_maps
)
set_source_files_properties(
- ${CMAKE_SOURCE_DIR}/lib/utils/system_time.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/system_time.cpp
PROPERTIES COMPILE_DEFINITIONS
"HAVE_MICROSEC_CLOCK"
)
@@ -368,72 +368,72 @@ UHD_ADD_RFNOC_BLOCK_TEST(
UHD_ADD_RFNOC_BLOCK_TEST(
TARGET x4xx_radio_block_test.cpp
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/common/pwr_cal_mgr.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/x400/x400_radio_control.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/x400/x400_rfdc_control.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/x400/adc_self_calibration.cpp
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/radio_control_impl.cpp
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/rf_control/gain_profile.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/mpmd/mpmd_mb_controller.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_dboard.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_dboard_init.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_lo_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp
- ${CMAKE_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_expert.cpp
- ${CMAKE_SOURCE_DIR}/lib/utils/compat_check.cpp
- ${CMAKE_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/common/lmx2572.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/common/pwr_cal_mgr.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/x400/x400_radio_control.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/x400/x400_rfdc_control.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/x400/adc_self_calibration.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/radio_control_impl.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/rf_control/gain_profile.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/mpmd/mpmd_mb_controller.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_dboard.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_dboard_init.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_lo_ctrl.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_cpld_ctrl.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/dboard/zbx/zbx_expert.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/compat_check.cpp
+ ${UHD_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
$<TARGET_OBJECTS:uhd_rpclib>
- INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/lib/deps/rpclib/include
- INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/lib/deps/flatbuffers/include
+ INCLUDE_DIRS ${UHD_SOURCE_DIR}/lib/deps/rpclib/include
+ INCLUDE_DIRS ${UHD_SOURCE_DIR}/lib/deps/flatbuffers/include
)
UHD_ADD_NONAPI_TEST(
TARGET "mb_controller_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
+ ${UHD_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "transport_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/transport/inline_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/inline_io_service.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "offload_io_srv_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/transport/offload_io_service.cpp
+ ${UHD_SOURCE_DIR}/lib/transport/offload_io_service.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "serial_number_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/utils/serial_number.cpp
+ ${UHD_SOURCE_DIR}/lib/utils/serial_number.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "pwr_cal_mgr_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/usrp/common/pwr_cal_mgr.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/common/pwr_cal_mgr.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "discoverable_feature_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
+ ${UHD_SOURCE_DIR}/lib/features/discoverable_feature_registry.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "rf_control_gain_profile_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/rfnoc/rf_control/gain_profile.cpp
+ ${UHD_SOURCE_DIR}/lib/rfnoc/rf_control/gain_profile.cpp
)
UHD_ADD_NONAPI_TEST(
TARGET "x400_rfdc_control_test.cpp"
EXTRA_SOURCES
- ${CMAKE_SOURCE_DIR}/lib/usrp/x400/x400_rfdc_control.cpp
+ ${UHD_SOURCE_DIR}/lib/usrp/x400/x400_rfdc_control.cpp
)
########################################################################
diff --git a/host/tests/common/CMakeLists.txt b/host/tests/common/CMakeLists.txt
index 7f31f3463..ac0e1b449 100644
--- a/host/tests/common/CMakeLists.txt
+++ b/host/tests/common/CMakeLists.txt
@@ -7,7 +7,7 @@
########################################################################
# Build uhd_test static lib
########################################################################
-include_directories("${CMAKE_SOURCE_DIR}/lib/include")
+include_directories("${UHD_SOURCE_DIR}/lib/include")
add_library(uhd_test
${CMAKE_CURRENT_SOURCE_DIR}/mock_zero_copy.cpp
)
diff --git a/host/tests/devtest/CMakeLists.txt b/host/tests/devtest/CMakeLists.txt
index 3f09620bf..5f70b2f06 100644
--- a/host/tests/devtest/CMakeLists.txt
+++ b/host/tests/devtest/CMakeLists.txt
@@ -28,7 +28,7 @@ macro(ADD_DEVTEST pattern filter devtype)
"--devtest-pattern" "${pattern}"
"--args" "$$EXTRA_DEV_ARGS,type=${filter}"
"--build-type" "${CMAKE_BUILD_TYPE}"
- "--build-dir" "${CMAKE_BINARY_DIR}"
+ "--build-dir" "${UHD_BINARY_DIR}"
"--python-interp" "${RUNTIME_PYTHON_EXECUTABLE}"
COMMENT "Running device test on all connected ${devtype} devices:"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"