summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrung Tran <trung.tran@ettus.com>2019-01-20 02:00:52 -0800
committerBrent Stapleton <brent.stapleton@ettus.com>2019-01-23 11:03:39 -0800
commit3f77f6d5e0a63aed64d58fb8e8276b098cef2486 (patch)
tree7f29c93a5815061c82c1338bc1e201c6172cb2f5
parenttests: replace has_key by using 'in' (diff)
downloaduhd-3f77f6d5e0a63aed64d58fb8e8276b098cef2486.tar.xz
uhd-3f77f6d5e0a63aed64d58fb8e8276b098cef2486.zip
devtest: add universal_newlines to subprocess call
subprocess call in python3+ return stderr and stdout object is byte object instead of text. This caused many issue with parsing the ouput in devtest. These are not an issue in python2. This change will make devtest more python3 compatible. Signed-off-by: Trung.Tran<trung.tran@ettus.com>
-rwxr-xr-xhost/tests/devtest/run_testsuite.py1
-rwxr-xr-xhost/tests/devtest/uhd_test_base.py3
-rw-r--r--host/tests/devtest/usrp_probe.py2
3 files changed, 4 insertions, 2 deletions
diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py
index e243a4cda..99871b150 100755
--- a/host/tests/devtest/run_testsuite.py
+++ b/host/tests/devtest/run_testsuite.py
@@ -122,6 +122,7 @@ def main():
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
+ universal_newlines=True
)
print(proc.communicate()[0])
sys.stdout.flush()
diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py
index d77226941..8d965eef7 100755
--- a/host/tests/devtest/uhd_test_base.py
+++ b/host/tests/devtest/uhd_test_base.py
@@ -77,7 +77,8 @@ class shell_application(object):
stdout=PIPE,
stderr=PIPE,
close_fds=True,
- env=env
+ env=env,
+ universal_newlines=True
)
self.stdout, self.stderr = proc.communicate()
self.returncode = proc.returncode
diff --git a/host/tests/devtest/usrp_probe.py b/host/tests/devtest/usrp_probe.py
index 43dd999c1..c7b73288e 100644
--- a/host/tests/devtest/usrp_probe.py
+++ b/host/tests/devtest/usrp_probe.py
@@ -17,7 +17,7 @@ def get_usrp_list(device_filter=None, env=None):
cmd = ['uhd_find_devices']
if device_filter is not None:
cmd += ['--args', device_filter]
- output = subprocess.check_output(cmd, env=env)
+ output = subprocess.check_output(cmd, env=env, universal_newlines=True)
except subprocess.CalledProcessError:
return []
split_re = "\n*-+\n-- .*\n-+\n"