def run(self): """ Run tests, calculate overall score and print test results """ mbeds = mbed_lstools.create() muts_list = mbeds.list_mbeds() test_base = IOperTestCaseBase() self.raw_test_results = {} for i, mut in enumerate(muts_list): result = [] self.raw_test_results[mut['platform_name']] = [] print "MBEDLS: Detected %s, port: %s, mounted: %s" % ( mut['platform_name'], mut['serial_port'], mut['mount_point']) print "Running interoperability test suite, scope '%s'" % ( self.requested_scope) for test_case in TEST_LIST: if self.scopes[self.requested_scope] >= self.scopes[ test_case.scope]: res = test_case.test(param=mut) result.extend(res) self.raw_test_results[mut['platform_name']].extend(res) columns = [ 'Platform', 'Test Case', 'Result', 'Scope', 'Description' ] pt = PrettyTable(columns) for col in columns: pt.align[col] = 'l' for tr in result: severity, tr_name, tr_scope, text = tr tr = (test_base.COLOR(severity, mut['platform_name']), test_base.COLOR(severity, tr_name), test_base.COLOR(severity, severity), test_base.COLOR(severity, tr_scope), test_base.COLOR(severity, text)) pt.add_row(list(tr)) print pt.get_string(border=True, sortby='Result') if i + 1 < len(muts_list): print return self.raw_test_results
def __init__(self, scope=None): IOperTestCaseBase.__init__(self, scope)
pass COLORAMA = 'colorama' in sys.modules from ioper_base import IOperTestCaseBase from ioper_test_fs import IOperTest_FileStructure_Basic from ioper_test_fs import IOperTest_FileStructure_MbedEnabled from ioper_test_target_id import IOperTest_TargetID_Basic from ioper_test_target_id import IOperTest_TargetID_MbedEnabled TEST_LIST = [ IOperTest_TargetID_Basic('basic'), IOperTest_TargetID_MbedEnabled('mbed-enabled'), IOperTest_FileStructure_Basic('basic'), IOperTest_FileStructure_MbedEnabled('mbed-enabled'), IOperTestCaseBase('all'), # Dummy used to add 'all' option ] class IOperTestRunner(): """ Calls all i/face interoperability tests """ def __init__(self, scope=None): """ Test scope: 'pedantic' - all 'mbed-enabled' - let's try to check if this device is mbed-enabled 'basic' - just simple, passive tests (no device flashing) """ self.requested_scope = scope # Test scope given by user self.raw_test_results = { } # Raw test results, can be used by exporters: { Platform: [test results]}
def __init__(self, scope=None): IOperTestCaseBase.__init__(self, scope) self.TARGET_ID_LEN = 24