aboutsummaryrefslogtreecommitdiffstats
path: root/host/tests/devtest
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@ettus.com>2015-10-26 16:45:47 -0700
committerMartin Braun <martin.braun@ettus.com>2015-11-11 10:37:26 -0800
commit88b0baeaf6dfa5f62f99ad53680108183ccc8721 (patch)
tree951e4f13742c9b3421ccb1bf059d77cabcff8626 /host/tests/devtest
parent201c5360cbb781ba93db408fb124a3bc44ffd383 (diff)
downloaduhd-88b0baeaf6dfa5f62f99ad53680108183ccc8721.tar.gz
uhd-88b0baeaf6dfa5f62f99ad53680108183ccc8721.tar.bz2
uhd-88b0baeaf6dfa5f62f99ad53680108183ccc8721.zip
tests: More devtests, works on E3XX now
- devtest now gets installed - uhd_usrp_probe test - Added make test_e3xx - Minor fixes to previous devtests
Diffstat (limited to 'host/tests/devtest')
-rw-r--r--host/tests/devtest/CMakeLists.txt22
-rwxr-xr-xhost/tests/devtest/devtest_b2xx.py2
-rwxr-xr-xhost/tests/devtest/devtest_e3xx.py58
-rwxr-xr-x[-rw-r--r--]host/tests/devtest/gpio_test.py0
-rwxr-xr-xhost/tests/devtest/run_testsuite.py10
-rwxr-xr-x[-rw-r--r--]host/tests/devtest/test_pps_test.py0
-rwxr-xr-xhost/tests/devtest/usrp_probe_test.py53
7 files changed, 140 insertions, 5 deletions
diff --git a/host/tests/devtest/CMakeLists.txt b/host/tests/devtest/CMakeLists.txt
index c770446a6..6fa921bbd 100644
--- a/host/tests/devtest/CMakeLists.txt
+++ b/host/tests/devtest/CMakeLists.txt
@@ -1,3 +1,11 @@
+#
+# Copyright 2015 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -10,7 +18,14 @@
# Formatting
MESSAGE(STATUS "")
-#
+# All devtest files get installed:
+FILE(GLOB py_devtest_files "*.py")
+UHD_INSTALL(PROGRAMS
+ ${py_devtest_files}
+ DESTINATION ${PKG_LIB_DIR}/tests/devtest
+ COMPONENT tests
+)
+
# Arguments:
# - pattern: This will be used to identify which devtest_*.py is to be executed.
# - filter: Will be used in args strings as "type=<filter>".
@@ -19,7 +34,7 @@ MACRO(ADD_DEVTEST pattern filter devtype)
MESSAGE(STATUS "Adding ${devtype} device test target")
ADD_CUSTOM_TARGET("test_${pattern}"
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/run_testsuite.py
- "--src-dir" "@CMAKE_CURRENT_SOURCE_DIR@"
+ "--src-dir" "${CMAKE_CURRENT_SOURCE_DIR}"
"--devtest-pattern" "${pattern}"
"--device-filter" "${filter}"
"--build-type" "${CMAKE_BUILD_TYPE}"
@@ -35,6 +50,9 @@ ENDIF(ENABLE_B200)
IF(ENABLE_X300)
ADD_DEVTEST("x3x0" "x300" "X3x0")
ENDIF(ENABLE_X300)
+IF(ENABLE_E300)
+ ADD_DEVTEST("e3xx" "e3x0" "E3XX")
+ENDIF(ENABLE_E300)
# Formatting
MESSAGE(STATUS "")
diff --git a/host/tests/devtest/devtest_b2xx.py b/host/tests/devtest/devtest_b2xx.py
index cd777aa18..da358d08e 100755
--- a/host/tests/devtest/devtest_b2xx.py
+++ b/host/tests/devtest/devtest_b2xx.py
@@ -17,7 +17,7 @@
"""
Run device tests for the B2xx series.
"""
-
+from usrp_probe_test import uhd_usrp_probe_test
from benchmark_rate_test import uhd_benchmark_rate_test
uhd_benchmark_rate_test.tests = {
#'mimo': {
diff --git a/host/tests/devtest/devtest_e3xx.py b/host/tests/devtest/devtest_e3xx.py
new file mode 100755
index 000000000..1cab44184
--- /dev/null
+++ b/host/tests/devtest/devtest_e3xx.py
@@ -0,0 +1,58 @@
+#
+# Copyright 2015 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+"""
+Run device tests for the E3XX series.
+"""
+from usrp_probe_test import uhd_usrp_probe_test
+from benchmark_rate_test import uhd_benchmark_rate_test
+uhd_benchmark_rate_test.tests = {
+ 'mimo': {
+ 'duration': 1,
+ 'direction': 'tx,rx',
+ 'channels': '0,1',
+ 'rate': 1e6,
+ 'acceptable-underruns': 500,
+ },
+ 'siso_chan0_slow': {
+ 'duration': 1,
+ 'direction': 'tx,rx',
+ 'chan': '0',
+ 'rate': 1e6,
+ 'acceptable-underruns': 50,
+ },
+ 'siso_chan1_slow': {
+ 'duration': 1,
+ 'direction': 'tx,rx',
+ 'chan': '1',
+ 'rate': 1e6,
+ 'acceptable-underruns': 50,
+ 'products': ['B210',],
+ },
+}
+
+from rx_samples_to_file_test import rx_samples_to_file_test
+rx_samples_to_file_test.tests = {
+ 'default': {
+ 'duration': 1,
+ 'subdev': 'A:A',
+ 'rate': 5e6,
+ },
+}
+
+from tx_bursts_test import uhd_tx_bursts_test
+from test_pps_test import uhd_test_pps_test
+
diff --git a/host/tests/devtest/gpio_test.py b/host/tests/devtest/gpio_test.py
index d764a8d96..d764a8d96 100644..100755
--- a/host/tests/devtest/gpio_test.py
+++ b/host/tests/devtest/gpio_test.py
diff --git a/host/tests/devtest/run_testsuite.py b/host/tests/devtest/run_testsuite.py
index 587d1cc64..30601c8bd 100755
--- a/host/tests/devtest/run_testsuite.py
+++ b/host/tests/devtest/run_testsuite.py
@@ -96,6 +96,7 @@ def main():
if len(uhd_args_list) == 0:
print("No devices found. Exiting.")
exit(1)
+ tests_passed = True
for uhd_idx, uhd_info in enumerate(uhd_args_list):
print('--- Running all tests for device {dev} ({prod}, Serial: {ser}).'.format(
dev=uhd_idx,
@@ -125,8 +126,13 @@ def main():
env=env,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
)
- print p.communicate()[0]
+ print(p.communicate()[0])
+ if p.returncode != 0:
+ tests_passed = False
print('--- Done testing all attached devices.')
+ return tests_passed
if __name__ == "__main__":
- main()
+ if not main():
+ exit(1)
+
diff --git a/host/tests/devtest/test_pps_test.py b/host/tests/devtest/test_pps_test.py
index 1e5b36e2c..1e5b36e2c 100644..100755
--- a/host/tests/devtest/test_pps_test.py
+++ b/host/tests/devtest/test_pps_test.py
diff --git a/host/tests/devtest/usrp_probe_test.py b/host/tests/devtest/usrp_probe_test.py
new file mode 100755
index 000000000..a136a2af7
--- /dev/null
+++ b/host/tests/devtest/usrp_probe_test.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+""" Run the test for tx_burst """
+
+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 = {
+ 'default': {
+ 'init-only': False,
+ },
+ }
+
+ def setup_example(self):
+ """
+ Set args.
+ """
+ self.test_params = uhd_usrp_probe_test.tests
+
+ def run_test(self, test_name, test_args):
+ """ Run the app and scrape for the failure messages. """
+ self.log.info('Running test {name}'.format(name=test_name))
+ # Run example:
+ args = [
+ self.create_addr_args_str(),
+ ]
+ if test_args.get('init-only'):
+ args.append('--init-only')
+ (app, run_results) = self.run_example('uhd_usrp_probe', args)
+ # Evaluate pass/fail:
+ run_results['passed'] = all([
+ app.returncode == 0,
+ ])
+ self.report_example_results(test_name, run_results)
+ return run_results
+