def verify(args): """Verify test data. @param args: directory of test data @return_value: 0 for success, or number of failed tests """ failed = 0 res = {} # find test data tests = util.list_test_data(args.data_dir) for platform in tests.keys(): res[platform] = {} for os_name in tests[platform].keys(): test_name = "platform='{}', os='{}'".format(platform, os_name) LOG.info('test: %s verifying test data', test_name) # run test res[platform][os_name] = verify_data( os.sep.join((args.data_dir, platform, os_name)), tests[platform][os_name]) # handle results fail_list = [ k for k, v in res[platform][os_name].items() if not v.get('passed') ] if len(fail_list) == 0: LOG.info('test: %s passed all tests', test_name) else: LOG.warning('test: %s failed %s tests', test_name, len(fail_list)) failed += len(fail_list) # dump results LOG.debug('verify results: %s', res) if args.result: util.merge_results({'verify': res}, args.result) return failed
def verify(args): """Verify test data. @param args: directory of test data @return_value: 0 for success, or number of failed tests """ failed = 0 res = {} # find test data tests = util.list_test_data(args.data_dir) for platform in tests.keys(): res[platform] = {} for os_name in tests[platform].keys(): test_name = "platform='{}', os='{}'".format(platform, os_name) LOG.info('test: %s verifying test data', test_name) # run test res[platform][os_name] = verify_data( args.data_dir, platform, os_name, tests[platform][os_name]) # handle results fail_list = [k for k, v in res[platform][os_name].items() if not v.get('passed')] if len(fail_list) == 0: LOG.info('test: %s passed all tests', test_name) else: LOG.warning('test: %s failed %s tests', test_name, len(fail_list)) failed += len(fail_list) # dump results LOG.debug('\n---- Verify summarized results:\n%s', format_results(res)) if args.result: util.merge_results({'verify': res}, args.result) return failed