diff options
author | Martin Braun <martin.braun@ettus.com> | 2016-05-09 10:14:17 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-05-09 10:36:36 -0700 |
commit | 6b7b88102a1a8be1e8deaa1e63dc9ede4b5131b7 (patch) | |
tree | 28910a3845fd42ab1b986d36e386a1e349684c00 /host/tests/devtest/run_testsuite.py | |
parent | 30c3a9f0d5ef628855b9cbd0c68b6a92f238e03b (diff) | |
download | uhd-6b7b88102a1a8be1e8deaa1e63dc9ede4b5131b7.tar.gz uhd-6b7b88102a1a8be1e8deaa1e63dc9ede4b5131b7.tar.bz2 uhd-6b7b88102a1a8be1e8deaa1e63dc9ede4b5131b7.zip |
devtest: Fix $PATH-setting code
PATH was only set for the examples, but not for the initial
call to uhd_find_devices.
This reverts commit b7c296f58399f0ef1fee7b3ef3d7da957f551558, which
tried to fix this but did so badly, and also amends it with the correct
fix.
Diffstat (limited to 'host/tests/devtest/run_testsuite.py')
-rwxr-xr-x | host/tests/devtest/run_testsuite.py | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py index 30601c8bd..2826f25e9 100755 --- a/host/tests/devtest/run_testsuite.py +++ b/host/tests/devtest/run_testsuite.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2015 Ettus Research LLC +# Copyright 2015-2016 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,21 +19,14 @@ Device test runner. """ +from __future__ import print_function import os import sys import subprocess import argparse import logging -import time -from threading import Thread -try: - from Queue import Queue, Empty -except ImportError: - from queue import Queue, Empty # Py3k from usrp_probe import get_usrp_list -ANI = ('.', 'o', 'O', '0', 'O', 'o') - def setup_parser(): """ Set up argparser """ parser = argparse.ArgumentParser(description="Test utility for UHD/USRP.") @@ -46,8 +39,12 @@ def setup_parser(): return parser def setup_env(args): + " Add build dir into lib + exe paths, depending on OS " def setup_env_win(env, build_dir, build_type): - env['PATH'] = "{build_dir}/lib/{build_type};{build_dir}/examples/{build_type};{build_dir}/utils/{build_type};{path}".format( + " Add build dir into paths (Windows)" + 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', '') ) env['LIBPATH'] = "{build_dir}/lib/{build_type};{path}".format( @@ -58,6 +55,7 @@ def setup_env(args): ) return env def setup_env_unix(env, build_dir): + " Add build dir into paths (Unices)" env['PATH'] = "{build_dir}/examples:{build_dir}/utils:{path}".format( build_dir=build_dir, path=env.get('PATH', '') ) @@ -66,6 +64,7 @@ def setup_env(args): ) 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', '') ) @@ -87,12 +86,11 @@ def setup_env(args): return env def main(): - """ - Go, go, go! - """ + " Go, go, go! " args = setup_parser().parse_args() + env = setup_env(args) devtest_pattern = "devtest_{p}.py".format(p=args.devtest_pattern) - uhd_args_list = get_usrp_list("type=" + args.device_filter) + uhd_args_list = get_usrp_list("type=" + args.device_filter, env) if len(uhd_args_list) == 0: print("No devices found. Exiting.") exit(1) @@ -104,7 +102,6 @@ def main(): ser=uhd_info.get('serial') )) print('--- This will take some time. Better grab a cup of tea.') - env = setup_env(args) args_str = uhd_info['args'] env['_UHD_TEST_ARGS_STR'] = args_str logfile_name = "log{}.log".format( @@ -117,7 +114,7 @@ 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) - p = subprocess.Popen( + proc = subprocess.Popen( [ "python", "-m", "unittest", "discover", "-v", "-s", args.src_dir, @@ -126,13 +123,12 @@ def main(): env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) - print(p.communicate()[0]) - if p.returncode != 0: + print(proc.communicate()[0]) + if proc.returncode != 0: tests_passed = False print('--- Done testing all attached devices.') return tests_passed if __name__ == "__main__": - if not main(): - exit(1) + exit(not main()) |