resulttool: Enable report for single result file
PATCH 1/2 resulttool: Enable report for single result file
Current validation check function inside resulttool disallow the report for single result file although the underlying library was able to handle both directory and file as source input to report. Removed the validation check as it was no longer needed and to enable report for single result file.
Signed-off-by Yeoh Ee Peng <[email protected]>
--- scripts/resulttool | 10 ---------- 1 file changed, 10 deletions(-)
scripts/resulttool +0 -10
@@ -51,13 +51,6 @@ import resulttool.report import resulttool.manualexecution logger = scriptutils.logger_create('resulttool') -def _validate_user_input_arguments(args): - if hasattr(args, "source_dir"): - if not os.path.isdir(args.source_dir): - logger.error('source_dir argument need to be a directory : %s' % args.source_dir) - return False - return True - def main(): parser = argparse_oe.ArgumentParser(description="OEQA test result manipulation tool.", epilog="Use %(prog)s <subcommand> --help to get help on a specific command")
@@ -80,9 +73,6 @@ def main(): elif args.quiet: logger.setLevel(logging.ERROR) - if not _validate_user_input_arguments(args): - return -1 - try: ret = args.func(args, logger) except argparse_oe.ArgumentUsageError as ae:
Signature · 1 line
2.7.4
PATCH 2/2 resulttool/merge: Enable turn off testseries configuration creation
Testseries configuration has important implication to report and regression. Enable turn off testseries configuration creation during results merge.
Signed-off-by Yeoh Ee Peng <[email protected]>
--- scripts/lib/resulttool/merge.py | 13 +++++++------ scripts/lib/resulttool/resultutils.py | 10 +++++----- 2 files changed, 12 insertions(+), 11 deletions(-)
scripts/lib/resulttool/merge.py +7 -6
@@ -18,15 +18,15 @@ import resulttool.resultutils as resultutils def merge(args, logger): if os.path.isdir(args.target_results): - results = resultutils.load_resultsdata(args.target_results, configmap=resultutils.store_map) - resultutils.append_resultsdata(results, args.base_results, configmap=resultutils.store_map) + results = resultutils.load_resultsdata(args.target_results, configmap=resultutils.store_map, add_testseries=args.off_add_testseries) + resultutils.append_resultsdata(results, args.base_results, configmap=resultutils.store_map, add_testseries=args.off_add_testseries) resultutils.save_resultsdata(results, args.target_results) else: - results = resultutils.load_resultsdata(args.base_results, configmap=resultutils.flatten_map) + results = resultutils.load_resultsdata(args.base_results, configmap=resultutils.flatten_map, add_testseries=args.off_add_testseries) if os.path.exists(args.target_results): - resultutils.append_resultsdata(results, args.target_results, configmap=resultutils.flatten_map) + resultutils.append_resultsdata(results, args.target_results, configmap=resultutils.flatten_map, add_testseries=args.off_add_testseries) resultutils.save_resultsdata(results, os.path.dirname(args.target_results), fn=os.path.basename(args.target_results)) - + logger.info('Merged results to %s' % os.path.dirname(args.target_results)) return 0 def register_commands(subparsers):
@@ -39,4 +39,5 @@ def register_commands(subparsers): help='the results file/directory to import') parser_build.add_argument('target_results', help='the target file or directory to merge the base_results with') - + parser_build.add_argument('-o', '--off-add-testseries', action='store_false', + help='turn off add testseries configuration to results')
scripts/lib/resulttool/resultutils.py +5 -5
@@ -42,7 +42,7 @@ store_map = { # # Load the json file and append the results data into the provided results dict # -def append_resultsdata(results, f, configmap=store_map): +def append_resultsdata(results, f, configmap=store_map, add_testseries=True): if type(f) is str: with open(f, "r") as filedata: data = json.load(filedata)
@@ -51,7 +51,7 @@ def append_resultsdata(results, f, configmap=store_map): for res in data: if "configuration" not in data[res] or "result" not in data[res]: raise ValueError("Test results data without configuration or result section?") - if "TESTSERIES" not in data[res]["configuration"]: + if add_testseries and "TESTSERIES" not in data[res]["configuration"]: data[res]["configuration"]["TESTSERIES"] = os.path.basename(os.path.dirname(f)) testtype = data[res]["configuration"].get("TEST_TYPE") if testtype not in configmap:
@@ -72,16 +72,16 @@ def append_resultsdata(results, f, configmap=store_map): # Walk a directory and find/load results data # or load directly from a file # -def load_resultsdata(source, configmap=store_map): +def load_resultsdata(source, configmap=store_map, add_testseries=True): results = {} if os.path.isfile(source): - append_resultsdata(results, source, configmap) + append_resultsdata(results, source, configmap, add_testseries) return results for root, dirs, files in os.walk(source): for name in files: f = os.path.join(root, name) if name == "testresults.json": - append_resultsdata(results, f, configmap) + append_resultsdata(results, f, configmap, add_testseries) return results def filter_resultsdata(results, resultid):
Signature · 1 line
2.7.4