aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-08-03 21:17:50 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-08-10 11:42:47 -0700
commit318e406b6ffd963900998a2a393b0d4289eb36be (patch)
tree013a2a2fff7fe8d7a3b90e539dcba391326987e5 /host/tests
parent2e838250863eb7f4e0c7d3800174b8ccc8dc2da9 (diff)
downloaduhd-318e406b6ffd963900998a2a393b0d4289eb36be.tar.gz
uhd-318e406b6ffd963900998a2a393b0d4289eb36be.tar.bz2
uhd-318e406b6ffd963900998a2a393b0d4289eb36be.zip
devtest: Add more env vars, make Py3k compatible
The testsuite now includes more environment variables for source dir, build dir, and PYTHONPATH.
Diffstat (limited to 'host/tests')
-rwxr-xr-xhost/tests/devtest/run_testsuite.py21
-rw-r--r--host/tests/devtest/usrp_probe.py5
2 files changed, 18 insertions, 8 deletions
diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py
index 5e90acdcb..e243a4cda 100755
--- a/host/tests/devtest/run_testsuite.py
+++ b/host/tests/devtest/run_testsuite.py
@@ -35,14 +35,16 @@ def setup_env(args):
env['PATH'] = "{build_dir}/lib/{build_type};" + \
"{build_dir}/examples/{build_type};" + \
"{build_dir}/utils/{build_type};{path}".format(
- build_dir=build_dir, build_type=build_type, path=env.get('PATH', '')
- )
+ build_dir=build_dir,
+ build_type=build_type,
+ path=env.get('PATH', ''))
env['LIBPATH'] = "{build_dir}/lib/{build_type};{path}".format(
build_dir=build_dir, build_type=build_type, path=env.get('LIBPATH', '')
)
env['LIB'] = "{build_dir}/lib/{build_type};{path}".format(
build_dir=build_dir, build_type=build_type, path=env.get('LIB', '')
)
+ env['PYTHONPATH'] = "{build_dir}/python".format(build_dir=build_dir)
return env
def setup_env_unix(env, build_dir):
" Add build dir into paths (Unices)"
@@ -52,15 +54,17 @@ def setup_env(args):
env['LD_LIBRARY_PATH'] = "{build_dir}/lib:{path}".format(
build_dir=build_dir, path=env.get('LD_LIBRARY_PATH', '')
)
+ env['PYTHONPATH'] = "{build_dir}/python".format(build_dir=build_dir)
return env
def setup_env_osx(env, build_dir):
" Add build dir into paths (OS X)"
env['PATH'] = "{build_dir}/examples:{build_dir}/utils:{path}".format(
- build_dir=build_dir, path=env.get('PATH', '')
+ build_dir=build_dir, path=env.get('PATH', '')
)
env['DYLD_LIBRARY_PATH'] = "{build_dir}/lib:{path}".format(
- build_dir=build_dir, path=env.get('DYLD_LIBRARY_PATH', '')
+ build_dir=build_dir, path=env.get('DYLD_LIBRARY_PATH', '')
)
+ env['PYTHONPATH'] = "{build_dir}/python".format(build_dir=build_dir)
return env
### Go
env = os.environ
@@ -71,7 +75,8 @@ def setup_env(args):
elif sys.platform.startswith('darwin'):
env = setup_env_osx(env, args.build_dir)
else:
- print("Devtest not supported on this platform ({0}).".format(sys.platform))
+ print("Devtest not supported on this platform ({0})."
+ .format(sys.platform))
exit(1)
return env
@@ -105,6 +110,8 @@ def main():
env['_UHD_TEST_RESULTSFILE'] = os.path.join(args.log_dir, resultsfile_name)
env['_UHD_TEST_LOG_LEVEL'] = str(logging.INFO)
env['_UHD_TEST_PRINT_LEVEL'] = str(logging.WARNING)
+ env['_UHD_BUILD_DIR'] = str(args.build_dir)
+ env['_UHD_DEVTEST_SRC_DIR'] = str(args.src_dir)
proc = subprocess.Popen(
[
"python", "-m", "unittest", "discover", "-v",
@@ -112,7 +119,9 @@ def main():
"-p", devtest_pattern,
],
env=env,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
)
print(proc.communicate()[0])
sys.stdout.flush()
diff --git a/host/tests/devtest/usrp_probe.py b/host/tests/devtest/usrp_probe.py
index 53d971707..43dd999c1 100644
--- a/host/tests/devtest/usrp_probe.py
+++ b/host/tests/devtest/usrp_probe.py
@@ -7,6 +7,7 @@
#
""" Run uhd_find_devices and parse the output. """
+from __future__ import print_function
import re
import subprocess
@@ -38,5 +39,5 @@ def get_usrp_list(device_filter=None, env=None):
return result
if __name__ == "__main__":
- print get_usrp_list()
- print get_usrp_list('type=x300')
+ print(get_usrp_list())
+ print(get_usrp_list('type=x300'))