diff --git a/src/yardstick/capture.py b/src/yardstick/capture.py index 2fb7bb6..61389d6 100644 --- a/src/yardstick/capture.py +++ b/src/yardstick/capture.py @@ -122,7 +122,18 @@ def one( if request.profile: profile_obj = profiles.get(scan_config.tool_name, {}).get(request.profile, {}) if not profile_obj: - raise RuntimeError(f"no profile found for tool {scan_config.tool_name}") + profile_obj = profiles.get(scan_config.tool_name.replace("-", "_"), {}).get( + request.profile, {} + ) + + if not profile_obj: + profile_obj = profiles.get(scan_config.tool_name.replace("_", "-"), {}).get( + request.profile, {} + ) + if not profile_obj: + raise RuntimeError( + f"no profile found for tool {scan_config.tool_name} profile {request.profile}, have {profiles}" + ) match_results, raw_json = run_scan(config=scan_config, profile=profile_obj) store.scan_result.save( diff --git a/src/yardstick/validate.py b/src/yardstick/validate.py index 933386f..1faab19 100644 --- a/src/yardstick/validate.py +++ b/src/yardstick/validate.py @@ -378,16 +378,13 @@ def validate_image( show_summaries=True, ) - reference_tool, candidate_tool = None, None - for r in results: - if r.config.tool_label == gate_config.reference_tool_label: - reference_tool = r.config.tool - if r.config.tool_label == gate_config.candidate_tool_label: - candidate_tool = r.config.tool + if len(results) != 2: + raise RuntimeError(f"expected 2 results but found {len(results)}") - if reference_tool is None or candidate_tool is None: + reference_tool, candidate_tool = None, None + if not gate_config.candidate_tool_label: reference_tool, candidate_tool = guess_tool_orientation( - [r.config.tool for r in results] + [r.config.tool for r in results], ) logging.warning( f"guessed tool orientation reference:{reference_tool} candidate:{candidate_tool}" @@ -395,6 +392,12 @@ def validate_image( logging.warning( "to avoid guessing, specify reference_tool_label and candidate_tool_label in validation config and re-capture result set" ) + if results[0].config.tool_label == gate_config.candidate_tool_label: + candidate_tool = results[0].config.tool + reference_tool = results[1].config.tool + elif results[1].config.tool_label == gate_config.candidate_tool_label: + candidate_tool = results[1].config.tool + reference_tool = results[0].config.tool # keep a list of differences between tools to summarize deltas = []