diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-11-11 16:26:42 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:33 -0800 |
commit | 879f021a0247c2978074044d99c91ca5f4aaf583 (patch) | |
tree | ec8baa5011eccdbbf852d29ca6358076f29fc16f /host/tests/devtest | |
parent | e0a40fd1d76c66e9374129536b7b10b76abad5f8 (diff) | |
download | uhd-879f021a0247c2978074044d99c91ca5f4aaf583.tar.gz uhd-879f021a0247c2978074044d99c91ca5f4aaf583.tar.bz2 uhd-879f021a0247c2978074044d99c91ca5f4aaf583.zip |
devtest: Add test_messages_test to X310
- Fixes issues with test_messages_test (it had inverted the pass/fail
condition)
- Improve Pylint scores in affected files
Diffstat (limited to 'host/tests/devtest')
-rwxr-xr-x | host/tests/devtest/devtest_x3x0.py | 4 | ||||
-rw-r--r-- | host/tests/devtest/test_messages_test.py | 19 | ||||
-rwxr-xr-x | host/tests/devtest/uhd_test_base.py | 3 |
3 files changed, 14 insertions, 12 deletions
diff --git a/host/tests/devtest/devtest_x3x0.py b/host/tests/devtest/devtest_x3x0.py index c928d793d..d7390f8f2 100755 --- a/host/tests/devtest/devtest_x3x0.py +++ b/host/tests/devtest/devtest_x3x0.py @@ -8,6 +8,8 @@ Run device tests for the X3x0 series. """ +# pylint: disable=wrong-import-position +# pylint: disable=unused-import from benchmark_rate_test import uhd_benchmark_rate_test uhd_benchmark_rate_test.tests = { 'mimo_slow': { @@ -67,4 +69,4 @@ from test_pps_test import uhd_test_pps_test from gpio_test import gpio_test from bitbang_test import bitbang_test from list_sensors_test import list_sensors_test - +from test_messages_test import test_messages_test diff --git a/host/tests/devtest/test_messages_test.py b/host/tests/devtest/test_messages_test.py index c66e96670..b07dedcb1 100644 --- a/host/tests/devtest/test_messages_test.py +++ b/host/tests/devtest/test_messages_test.py @@ -2,6 +2,7 @@ # # Copyright 2015 Ettus Research LLC # Copyright 2018 Ettus Research, a National Instruments Company +# Copyright 2019 Ettus Research, a National Instruments Brand # # SPDX-License-Identifier: GPL-3.0-or-later # @@ -10,7 +11,7 @@ import re from uhd_test_base import uhd_example_test_case -class uhd_test_messages_test(uhd_example_test_case): +class test_messages_test(uhd_example_test_case): """ Run test_messages and check output. """ @@ -20,11 +21,11 @@ class uhd_test_messages_test(uhd_example_test_case): """ Set args. """ - self.test_params = uhd_test_messages_test.tests + self.test_params = test_messages_test.tests def run_test(self, test_name, test_args): """ Run the app and scrape for the failure messages. """ - self.log.info('Running test {n}'.format(n=test_name,)) + self.log.info('Running test %s', test_name) # Run example: args = [ self.create_addr_args_str(), @@ -35,13 +36,11 @@ class uhd_test_messages_test(uhd_example_test_case): (app, run_results) = self.run_example('test_messages', args) # Evaluate pass/fail: succ_fail_re = re.compile(r'(?P<test>.*)->\s+(?P<succ>\d+) successes,\s+(?P<fail>\d+) +failures') - for mo in succ_fail_re.finditer(app.stdout): - key = mo.group("test").strip().replace(' ', '_').lower() - successes = int(mo.group("succ")) - failures = int(mo.group("fail")) + for mobj in succ_fail_re.finditer(app.stdout): + key = mobj.group("test").strip().replace(' ', '_').lower() + successes = int(mobj.group("succ")) + failures = int(mobj.group("fail")) run_results[key] = "{}/{}".format(successes, successes+failures) - run_results['passed'] = bool(failures) - + run_results['passed'] = (failures == 0) self.report_example_results(test_name, run_results) return run_results - diff --git a/host/tests/devtest/uhd_test_base.py b/host/tests/devtest/uhd_test_base.py index acc52d378..9f710b7be 100755 --- a/host/tests/devtest/uhd_test_base.py +++ b/host/tests/devtest/uhd_test_base.py @@ -243,7 +243,8 @@ class uhd_example_test_case(uhd_test_case): Hook for test runner. Needs to be a class method that starts with 'test'. Calls run_test(). """ - for test_name, test_args in iteritems(self.test_params): + test_params = getattr(self, 'test_params', {}) + for test_name, test_args in iteritems(test_params): time.sleep(15) # Wait for X300 devices to reclaim them if not 'products' in test_args \ or (self.usrp_info['product'] in test_args.get('products', [])): |