aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2018-08-21 11:21:15 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-08-22 18:37:12 -0700
commit6849514a05259dc6282d41325c6ed3b3ac12d0cb (patch)
tree0998e4f4cdcd44fb8e1deed8db48082a1aa320fe /host/tests
parent35a74c8c80719d47d0e1c987a21799274a7f7b63 (diff)
downloaduhd-6849514a05259dc6282d41325c6ed3b3ac12d0cb.tar.gz
uhd-6849514a05259dc6282d41325c6ed3b3ac12d0cb.tar.bz2
uhd-6849514a05259dc6282d41325c6ed3b3ac12d0cb.zip
devtest: Improve error handling for shell_application
Diffstat (limited to 'host/tests')
-rwxr-xr-xhost/tests/devtest/uhd_test_base.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py
index a1fd8216e..57193e625 100755
--- a/host/tests/devtest/uhd_test_base.py
+++ b/host/tests/devtest/uhd_test_base.py
@@ -71,16 +71,21 @@ class shell_application(object):
start_time = time.time()
env = os.environ
env["UHD_LOG_FASTPATH_DISABLE"] = "1"
- proc = Popen(
- cmd_line,
- stdout=PIPE,
- stderr=PIPE,
- close_fds=True,
- env=env
- )
- self.stdout, self.stderr = proc.communicate()
- self.returncode = proc.returncode
- self.exec_time = time.time() - start_time
+ try:
+ proc = Popen(
+ cmd_line,
+ stdout=PIPE,
+ stderr=PIPE,
+ close_fds=True,
+ env=env
+ )
+ self.stdout, self.stderr = proc.communicate()
+ self.returncode = proc.returncode
+ self.exec_time = time.time() - start_time
+ except OSError as ex:
+ raise RuntimeError("Failed to execute command: `{}'\n{}"
+ .format(cmd_line, str(ex)))
+
#--------------------------------------------------------------------------
# Test case base
@@ -229,7 +234,8 @@ class uhd_example_test_case(uhd_test_case):
"""
for test_name, test_args in iteritems(self.test_params):
time.sleep(15) # Wait for X300 devices to reclaim them
- if not test_args.has_key('products') or (self.usrp_info['product'] in test_args.get('products', [])):
+ if not test_args.has_key('products') \
+ or (self.usrp_info['product'] in test_args.get('products', [])):
run_results = self.run_test(test_name, test_args)
passed = bool(run_results)
if isinstance(run_results, dict):