diff options
author | Steven Koo <steven.koo@ni.com> | 2021-02-10 19:20:12 -0600 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2021-02-12 13:16:01 -0800 |
commit | 72ac96b23a16ab713a02116f81c18db335b6d140 (patch) | |
tree | 9dce774b1ff0c3784d23c032ae87c62fc10d27ec | |
parent | 2004c1d72bb9d5cbe96db83a5ae8b40139bd5db2 (diff) | |
download | uhd-72ac96b23a16ab713a02116f81c18db335b6d140.tar.gz uhd-72ac96b23a16ab713a02116f81c18db335b6d140.tar.bz2 uhd-72ac96b23a16ab713a02116f81c18db335b6d140.zip |
devtest: reapply allow extra device arguments when running devtests
This change is substantially the same as 7b86a47, but implemented in a ninja
supported way. ninja doesn't allow for arguments, so this uses an environment
variable. This is compatible with both make and ninja. The only change
from the calling point of view is you must set the environment variable
before calling "make test_[devicetype]" instead of after as an arg.
This allows running devtests for a single device instead of all connected devices
or selecting a specific network interface.
Set the additional device arguments with the EXTRA_DEV_ARGS variable.
This can be set as an environment variable or on the command line.
For example: EXTRA_DEV_ARGS=addr=192.168.30.2 make test_x3x0
Also-by: Matthew Crymble <matthew.crymble@ni.com>
Signed-off-by: Steven Koo <steven.koo@ni.com>
-rw-r--r-- | host/tests/devtest/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | host/tests/devtest/run_testsuite.py | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/host/tests/devtest/CMakeLists.txt b/host/tests/devtest/CMakeLists.txt index 429d1a731..e6cef17fe 100644 --- a/host/tests/devtest/CMakeLists.txt +++ b/host/tests/devtest/CMakeLists.txt @@ -26,7 +26,7 @@ macro(ADD_DEVTEST pattern filter devtype) ${RUNTIME_PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_testsuite.py "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}" "--devtest-pattern" "${pattern}" - "--args" "type=${filter}" + "--args" "$$EXTRA_DEV_ARGS,type=${filter}" "--build-type" "${CMAKE_BUILD_TYPE}" "--build-dir" "${CMAKE_BINARY_DIR}" "--python-interp" "${RUNTIME_PYTHON_EXECUTABLE}" diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py index a5ece8ac6..4e45b112e 100755 --- a/host/tests/devtest/run_testsuite.py +++ b/host/tests/devtest/run_testsuite.py @@ -90,6 +90,7 @@ def main(): env = setup_env(args) devtest_pattern = "devtest_{p}.py".format(p=args.devtest_pattern) uhd_args_list = get_usrp_list(args.args, env) + arg_dict = dict(arg.split('=') for arg in args.args.strip(',').split(',')) if len(uhd_args_list) == 0: print("No devices found. Exiting.") exit(1) @@ -103,13 +104,15 @@ def main(): print('--- This will take some time. Better grab a cup of tea.') sys.stdout.flush() args_str = uhd_info['args'] - env['_UHD_TEST_ARGS_STR'] = args_str logfile_name = "log{}.log".format( args_str.replace('type=', '_').replace('serial=', '_').replace(',', '') ) resultsfile_name = "results{}.log".format( args_str.replace('type=', '_').replace('serial=', '_').replace(',', '') ) + if 'addr' in arg_dict: + args_str += ',addr={}'.format(arg_dict['addr']) + env['_UHD_TEST_ARGS_STR'] = args_str env['_UHD_TEST_LOGFILE'] = os.path.join(args.log_dir, logfile_name) env['_UHD_TEST_RESULTSFILE'] = os.path.join(args.log_dir, resultsfile_name) env['_UHD_TEST_LOG_LEVEL'] = str(logging.INFO) |