aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests
diff options
context:
space:
mode:
authorVidush <vidush.vishwanath@ettus.com>2018-07-25 14:30:25 -0700
committerBrent Stapleton <bstapleton@g.hmc.edu>2018-08-10 11:42:47 -0700
commit5b55a32c922c56848bdf6fc023828f3c6a3a07f1 (patch)
tree89a91ec9a61e930950b95f80e71c2771ba688f8f /host/tests
parent318e406b6ffd963900998a2a393b0d4289eb36be (diff)
downloaduhd-5b55a32c922c56848bdf6fc023828f3c6a3a07f1.tar.gz
uhd-5b55a32c922c56848bdf6fc023828f3c6a3a07f1.tar.bz2
uhd-5b55a32c922c56848bdf6fc023828f3c6a3a07f1.zip
devtest: Integrate Python API Tester into Devtest
Diffstat (limited to 'host/tests')
-rwxr-xr-xhost/tests/devtest/devtest_b2xx.py1
-rwxr-xr-xhost/tests/devtest/multi_usrp_test.py5
-rw-r--r--host/tests/devtest/python_api_test.py57
-rwxr-xr-xhost/tests/devtest/usrp_probe_test.py2
4 files changed, 63 insertions, 2 deletions
diff --git a/host/tests/devtest/devtest_b2xx.py b/host/tests/devtest/devtest_b2xx.py
index 7c5fe3752..16c6eb3ec 100755
--- a/host/tests/devtest/devtest_b2xx.py
+++ b/host/tests/devtest/devtest_b2xx.py
@@ -8,6 +8,7 @@
Run device tests for the B2xx series.
"""
from usrp_probe_test import uhd_usrp_probe_test
+from python_api_test import uhd_python_api_test
from benchmark_rate_test import uhd_benchmark_rate_test
uhd_benchmark_rate_test.tests = {
'mimo': {
diff --git a/host/tests/devtest/multi_usrp_test.py b/host/tests/devtest/multi_usrp_test.py
index 2ecfbb4c0..2bb15a0d0 100755
--- a/host/tests/devtest/multi_usrp_test.py
+++ b/host/tests/devtest/multi_usrp_test.py
@@ -618,7 +618,10 @@ def main():
"""
args = parse_args()
usrp = uhd.usrp.MultiUSRP(args.args)
- return run_api_test(usrp)
+ ret_val = run_api_test(usrp)
+ if ret_val != 1:
+ raise Exception("Python API Tester Received Errors")
+ return ret_val
if __name__ == "__main__":
exit(not main())
diff --git a/host/tests/devtest/python_api_test.py b/host/tests/devtest/python_api_test.py
new file mode 100644
index 000000000..d76400188
--- /dev/null
+++ b/host/tests/devtest/python_api_test.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+#
+# Copyright 2018 Ettus Research, a National Instruments Company
+#
+# SPDX-License-Identifier: GPL-3.0-or-later
+#
+""" Test Python API """
+
+from __future__ import print_function
+import os
+from uhd_test_base import shell_application
+from uhd_test_base import uhd_test_case
+try:
+ import uhd
+except ImportError:
+ uhd = None
+
+
+class uhd_python_api_test(uhd_test_case):
+ """ Run multi_usrp_test """
+ def test_api(self):
+ """
+ Run test and report results.
+ """
+ if uhd is None:
+ print("Skipping test, Python API not installed.")
+ self.report_result("python_api_tester", 'status', 'Skipped')
+ return
+ devtest_src_dir = os.getenv('_UHD_DEVTEST_SRC_DIR', '')
+ multi_usrp_test_path = \
+ os.path.join(devtest_src_dir, 'multi_usrp_test.py')
+ args = [
+ self.create_addr_args_str(),
+ ]
+ app = shell_application(multi_usrp_test_path)
+ app.run(args)
+ run_results = {
+ 'return_code': app.returncode,
+ 'passed': False
+ }
+ run_results['passed'] = all([
+ app.returncode == 0,
+ ])
+ self.log.info('STDERR Output:')
+ self.log.info(str(app.stderr))
+ for key in sorted(run_results):
+ self.log.info('%s = %s', str(key), str(run_results[key]))
+ self.report_result(
+ "python_api_tester",
+ key, run_results[key]
+ )
+ if 'passed' in run_results:
+ self.report_result(
+ "python_api_tester",
+ 'status',
+ 'Passed' if run_results['passed'] else 'Failed',
+ )
diff --git a/host/tests/devtest/usrp_probe_test.py b/host/tests/devtest/usrp_probe_test.py
index 762d65030..73592b755 100755
--- a/host/tests/devtest/usrp_probe_test.py
+++ b/host/tests/devtest/usrp_probe_test.py
@@ -10,6 +10,7 @@
import re
from uhd_test_base import uhd_example_test_case
+
class uhd_usrp_probe_test(uhd_example_test_case):
""" Run uhd_usrp_probe """
tests = {
@@ -40,4 +41,3 @@ class uhd_usrp_probe_test(uhd_example_test_case):
])
self.report_example_results(test_name, run_results)
return run_results
-