def view_test_report(self, logger, source_dir, branch, commit, tag): test_count_reports = [] if commit: if tag: logger.warning("Ignoring --tag as --commit was specified") tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(source_dir) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch) rev_index = gitarchive.rev_find(revs, 'commit', commit) testresults = resultutils.git_get_result(repo, revs[rev_index][2]) elif tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag]) else: testresults = resultutils.load_resultsdata(source_dir) for testsuite in testresults: for resultid in testresults[testsuite]: result = testresults[testsuite][resultid] test_count_report = self.get_aggregated_test_result( logger, result) test_count_report['testseries'] = result['configuration'][ 'TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def view_test_report(self, logger, source_dir, branch, commit, tag): test_count_reports = [] if commit: if tag: logger.warning("Ignoring --tag as --commit was specified") tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(source_dir) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch) rev_index = gitarchive.rev_find(revs, 'commit', commit) testresults = resultutils.git_get_result(repo, revs[rev_index][2]) elif tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag]) else: testresults = resultutils.load_resultsdata(source_dir) for testsuite in testresults: for resultid in testresults[testsuite]: skip = False result = testresults[testsuite][resultid] machine = result['configuration']['MACHINE'] # Check to see if there is already results for these kinds of tests for the machine for key in result['result'].keys(): testtype = str(key).split('.')[0] if ((machine in self.ptests and testtype == "ptestresult" and self.ptests[machine]) or (machine in self.ltptests and testtype == "ltpiresult" and self.ltptests[machine]) or (machine in self.ltpposixtests and testtype == "ltpposixresult" and self.ltpposixtests[machine])): print( "Already have test results for %s on %s, skipping %s" % (str(key).split('.')[0], machine, resultid)) skip = True break if skip: break test_count_report = self.get_aggregated_test_result( logger, result, machine) test_count_report['machine'] = machine test_count_report['testseries'] = result['configuration'][ 'TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def view_test_report(self, logger, source_dir, branch, commit, tag): test_count_reports = [] if commit: if tag: logger.warning("Ignoring --tag as --commit was specified") tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(source_dir) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch) rev_index = gitarchive.rev_find(revs, 'commit', commit) testresults = resultutils.git_get_result(repo, revs[rev_index][2]) elif tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag]) else: testresults = resultutils.load_resultsdata(source_dir) for testsuite in testresults: for resultid in testresults[testsuite]: result = testresults[testsuite][resultid] test_count_report = self.get_aggregated_test_result(logger, result) test_count_report['testseries'] = result['configuration']['TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def view_test_report(self, logger, source_dir, tag): test_count_reports = [] if tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag]) else: testresults = resultutils.load_resultsdata(source_dir) for testsuite in testresults: for resultid in testresults[testsuite]: result = testresults[testsuite][resultid] test_count_report = self.get_aggregated_test_result(logger, result) test_count_report['testseries'] = result['configuration']['TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def view_test_report(self, logger, source_dir, tag): test_count_reports = [] if tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag]) else: testresults = resultutils.load_resultsdata(source_dir) for testsuite in testresults: for resultid in testresults[testsuite]: result = testresults[testsuite][resultid] test_count_report = self.get_aggregated_test_result( logger, result) test_count_report['testseries'] = result['configuration'][ 'TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def regression_git(args, logger): base_results = {} target_results = {} tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(args.repo) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=args.branch) if args.branch2: revs2 = gitarchive.get_test_revs(logger, repo, tag_name, branch=args.branch2) if not len(revs2): logger.error("No revisions found to compare against") return 1 if not len(revs): logger.error("No revision to report on found") return 1 else: if len(revs) < 2: logger.error( "Only %d tester revisions found, unable to generate report" % len(revs)) return 1 # Pick revisions if args.commit: if args.commit_number: logger.warning( "Ignoring --commit-number as --commit was specified") index1 = gitarchive.rev_find(revs, 'commit', args.commit) elif args.commit_number: index1 = gitarchive.rev_find(revs, 'commit_number', args.commit_number) else: index1 = len(revs) - 1 if args.branch2: revs2.append(revs[index1]) index1 = len(revs2) - 1 revs = revs2 if args.commit2: if args.commit_number2: logger.warning( "Ignoring --commit-number2 as --commit2 was specified") index2 = gitarchive.rev_find(revs, 'commit', args.commit2) elif args.commit_number2: index2 = gitarchive.rev_find(revs, 'commit_number', args.commit_number2) else: if index1 > 0: index2 = index1 - 1 # Find the closest matching commit number for comparision # In future we could check the commit is a common ancestor and # continue back if not but this good enough for now while index2 > 0 and revs[index2].commit_number > revs[ index1].commit_number: index2 = index2 - 1 else: logger.error("Unable to determine the other commit, use " "--commit2 or --commit-number2 to specify it") return 1 logger.info("Comparing:\n%s\nto\n%s\n" % (revs[index1], revs[index2])) base_results = resultutils.git_get_result(repo, revs[index1][2]) target_results = resultutils.git_get_result(repo, revs[index2][2]) regression_common(args, logger, base_results, target_results) return 0
def view_test_report(self, logger, source_dir, branch, commit, tag, use_regression_map, raw_test, selected_test_case_only): def print_selected_testcase_result(testresults, selected_test_case_only): for testsuite in testresults: for resultid in testresults[testsuite]: result = testresults[testsuite][resultid]['result'] test_case_result = result.get(selected_test_case_only, {}) if test_case_result.get('status'): print( 'Found selected test case result for %s from %s' % (selected_test_case_only, resultid)) print(test_case_result['status']) else: print( 'Could not find selected test case result for %s from %s' % (selected_test_case_only, resultid)) if test_case_result.get('log'): print(test_case_result['log']) test_count_reports = [] configmap = resultutils.store_map if use_regression_map: configmap = resultutils.regression_map if commit: if tag: logger.warning("Ignoring --tag as --commit was specified") tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(source_dir) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=branch) rev_index = gitarchive.rev_find(revs, 'commit', commit) testresults = resultutils.git_get_result(repo, revs[rev_index][2], configmap=configmap) elif tag: repo = GitRepo(source_dir) testresults = resultutils.git_get_result(repo, [tag], configmap=configmap) else: testresults = resultutils.load_resultsdata(source_dir, configmap=configmap) if raw_test: raw_results = {} for testsuite in testresults: result = testresults[testsuite].get(raw_test, {}) if result: raw_results[testsuite] = {raw_test: result} if raw_results: if selected_test_case_only: print_selected_testcase_result(raw_results, selected_test_case_only) else: print(json.dumps(raw_results, sort_keys=True, indent=4)) else: print('Could not find raw test result for %s' % raw_test) return 0 if selected_test_case_only: print_selected_testcase_result(testresults, selected_test_case_only) return 0 for testsuite in testresults: for resultid in testresults[testsuite]: skip = False result = testresults[testsuite][resultid] machine = result['configuration']['MACHINE'] # Check to see if there is already results for these kinds of tests for the machine for key in result['result'].keys(): testtype = str(key).split('.')[0] if ((machine in self.ltptests and testtype == "ltpiresult" and self.ltptests[machine]) or (machine in self.ltpposixtests and testtype == "ltpposixresult" and self.ltpposixtests[machine])): print( "Already have test results for %s on %s, skipping %s" % (str(key).split('.')[0], machine, resultid)) skip = True break if skip: break test_count_report = self.get_aggregated_test_result( logger, result, machine) test_count_report['machine'] = machine test_count_report['testseries'] = result['configuration'][ 'TESTSERIES'] test_count_report['result_id'] = resultid test_count_reports.append(test_count_report) self.print_test_report('test_report_full_text.txt', test_count_reports)
def regression_git(args, logger): base_results = {} target_results = {} tag_name = "{branch}/{commit_number}-g{commit}/{tag_number}" repo = GitRepo(args.repo) revs = gitarchive.get_test_revs(logger, repo, tag_name, branch=args.branch) if args.branch2: revs2 = gitarchive.get_test_revs(logger, repo, tag_name, branch=args.branch2) if not len(revs2): logger.error("No revisions found to compare against") return 1 if not len(revs): logger.error("No revision to report on found") return 1 else: if len(revs) < 2: logger.error("Only %d tester revisions found, unable to generate report" % len(revs)) return 1 # Pick revisions if args.commit: if args.commit_number: logger.warning("Ignoring --commit-number as --commit was specified") index1 = gitarchive.rev_find(revs, 'commit', args.commit) elif args.commit_number: index1 = gitarchive.rev_find(revs, 'commit_number', args.commit_number) else: index1 = len(revs) - 1 if args.branch2: revs2.append(revs[index1]) index1 = len(revs2) - 1 revs = revs2 if args.commit2: if args.commit_number2: logger.warning("Ignoring --commit-number2 as --commit2 was specified") index2 = gitarchive.rev_find(revs, 'commit', args.commit2) elif args.commit_number2: index2 = gitarchive.rev_find(revs, 'commit_number', args.commit_number2) else: if index1 > 0: index2 = index1 - 1 # Find the closest matching commit number for comparision # In future we could check the commit is a common ancestor and # continue back if not but this good enough for now while index2 > 0 and revs[index2].commit_number > revs[index1].commit_number: index2 = index2 - 1 else: logger.error("Unable to determine the other commit, use " "--commit2 or --commit-number2 to specify it") return 1 logger.info("Comparing:\n%s\nto\n%s\n" % (revs[index1], revs[index2])) base_results = resultutils.git_get_result(repo, revs[index1][2]) target_results = resultutils.git_get_result(repo, revs[index2][2]) regression_common(args, logger, base_results, target_results) return 0