tests: More devtests, works on E3XX now

- devtest now gets installed
- uhd_usrp_probe test
- Added make test_e3xx
- Minor fixes to previous devtests
This commit is contained in:
Martin Braun 2015-10-26 16:45:47 -07:00
parent 201c5360cb
commit 88b0baeaf6
7 changed files with 140 additions and 5 deletions

View file

@ -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 "")

View file

@ -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': {

View file

@ -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

0
host/tests/devtest/gpio_test.py Normal file → Executable file
View file

View file

@ -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)

0
host/tests/devtest/test_pps_test.py Normal file → Executable file
View file

View file

@ -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