diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-07-11 16:41:45 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:03:59 -0800 |
commit | aefbc5b957c346f1facf1f6b072f9fc140103707 (patch) | |
tree | d1daf32d1dc2b0214478d8931c7039d3e0c4b705 /mpm | |
parent | a53976c6ea818839412f748af134e920f45feac1 (diff) | |
download | uhd-aefbc5b957c346f1facf1f6b072f9fc140103707.tar.gz uhd-aefbc5b957c346f1facf1f6b072f9fc140103707.tar.bz2 uhd-aefbc5b957c346f1facf1f6b072f9fc140103707.zip |
n3xx bist: Added both time and date to rtc test, added error_msg common key
Diffstat (limited to 'mpm')
-rwxr-xr-x | mpm/python/n3xx_bist | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/mpm/python/n3xx_bist b/mpm/python/n3xx_bist index 2d2afe217..99c1706cb 100755 --- a/mpm/python/n3xx_bist +++ b/mpm/python/n3xx_bist @@ -23,6 +23,7 @@ from __future__ import print_function import os import sys import socket +import time import json from datetime import datetime import argparse @@ -111,7 +112,9 @@ class N310BIST(object): "Executing test method: {0}\n\n".format(testmethod_name) ) try: - return getattr(self, testmethod_name)() + status, data = getattr(self, testmethod_name)() + data['status'] = status + return status, data except AttributeError: sys.stderr.write("Test not defined: {}\n".format(testname)) return False, {} @@ -119,7 +122,7 @@ class N310BIST(object): sys.stderr.write( "Test {} failed to execute: {}\n".format(testname, str(ex)) ) - return False, {} + return False, {'error_msg': str(ex)} tests_successful = True result = {} for test in self.tests_to_run: @@ -139,18 +142,19 @@ class N310BIST(object): BIST for RTC (real time clock) Return dictionary: - - time: Returns the current UTC time, with seconds-accuracy, in ISO 8601 - format, as a string. + - date: Returns the current UTC time, with seconds-accuracy, in ISO 8601 + format, as a string. As if running 'date -Iseconds -u'. + - time: Same time, but in seconds since epoch. Return status: - Unless the 'date' command fails (which is used under the hood), will - always return True. + Unless datetime throws an exception, returns True. """ assert 'rtc' in self.tests_to_run - result = {} - utc_time = datetime.utcnow().replace(microsecond=0).isoformat() - result['time'] = utc_time + "+00:00" - return True, result + utc_now = datetime.utcnow() + return True, { + 'time': time.mktime(utc_now.timetuple()), + 'date': utc_now.replace(microsecond=0).isoformat() + "+00:00", + } def bist_ddr3(self): """ |