From b902c4904eddce7c32c5593a0a68c40e235d25b7 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 26 Sep 2023 21:42:04 +0200 Subject: [PATCH] common: present important results by default ... if any filters of important results are defined. The full results are now available with the `-all` suffix. The files with `-imp` suffix are provided as symlinks to the filtered results for compatibility. Resolves: https://issues.redhat.com/browse/OSH-299 Closes: https://github.com/csutils/csmock/pull/124 --- py/common/results.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/py/common/results.py b/py/common/results.py index b5a5c45..2c1820f 100644 --- a/py/common/results.py +++ b/py/common/results.py @@ -320,16 +320,23 @@ def finalize_results(js_file, results, props): cmd = strlist_to_shell_cmd(["bash", "-c", cmd], escape_special=True) results.exec_cmd(cmd, shell=True) - # generate *-imp.{err,html} - transform_results(imp_js_file, results) - - # initialize the "imp" flag in the resulting full .js output file - tmp_js_file = re.sub("\\.js", "-tmp.js", js_file) + # initialize the "imp" flag in the resulting `-all.js` output file + # and replace the original .js file by `-imp.js` + all_js_file = re.sub("\\.js", "-all.js", js_file) cmd = "cslinker --implist '%s' '%s' > '%s' && mv -v '%s' '%s'" \ - % (imp_js_file, js_file, tmp_js_file, tmp_js_file, js_file) + % (imp_js_file, js_file, all_js_file, imp_js_file, js_file) if 0 != results.exec_cmd(cmd, shell=True): results.error("failed to tag important findings in the full results", ec=0) + # generate *-all{.err,.html,-summary.txt} + transform_results(all_js_file, results) + + # create `-imp` symlinks for compatibility + for suffix in [".err", ".html", "-summary.txt"]: + src = f"scan-results{suffix}" + dst = os.path.join(results.resdir, f"scan-results-imp{suffix}") + results.exec_cmd(["ln", "-s", src, dst]) + (err_file, _) = transform_results(js_file, results) if props.print_defects: