@@ -129,11 +129,16 @@ class GnatcheckDriver(BaseDriver):
129129 - ``worker``: Provide a custom worker for the GNATcheck run.
130130 - ``gnatkp_autoconfig`` (bool): Whether to automatically configure the
131131 target and runtime when running in "gnatkp" mode. Default is True.
132+ - ``auto_codepeer_target`` (bool): Whether to automatically add the
133+ codepeer target when the test is run in CodePeer mode. Default is
134+ True.
132135 - ``in_tty`` (bool): Whether to run GNATcheck in a pseudo TTY using the
133136 ``pty`` Python module.
134137
135138 - ``jobs`` (int): The number of jobs to forward to the GNATcheck command.
136139 - ``project`` (str): GPR build file to use (if any).
140+ - ``target`` (str): The target to forward to LibGPR for project
141+ resolution.
137142 - ``subdirs`` (str): The directory to forward to GNATcheck `--subdirs`
138143 option.
139144 - ``input_sources`` (list[str]): Ada files to analyze (if explicit,
@@ -166,6 +171,8 @@ class GnatcheckDriver(BaseDriver):
166171 - ``extra_rule_options`` (list[str]): Extra arguments for the rules
167172 section.
168173
174+ - ``canonicalize_worker`` (bool): Whether to replace the GNATcheck worker
175+ name by a constant string in then test output. Default is True.
169176 - ``pre_python``/``post_python`` (str): Python code to be executed
170177 before/after the test.
171178 - ``list_dirs`` (list[str]): A list of directories to display the content
@@ -296,15 +303,24 @@ def run_one_test(test_data: dict[str, any]) -> None:
296303 if pre_python :
297304 capture_exec_python (pre_python )
298305
299- # If the executable is gantkp, we must provide an explicit runtime
306+ # Set the target if one has been provided
307+ if test_data .get ('target' ):
308+ args .append (f"--target={ test_data ['target' ]} " )
309+
310+ # If the executable is gnatkp, we must provide an explicit runtime
300311 # and target
301312 if exe == "gnatkp" and test_data .get ('gnatkp_autoconfig' , True ):
302- if not self .is_codepeer :
313+ if not self .is_codepeer and not test_data . get ( 'target' ) :
303314 args .append (f"--target={ self .env .host .triplet } " )
304315 args .append ("--RTS=default" )
305316
306- # Set the codepeer target if needed
307- if self .is_codepeer :
317+ # Set the codepeer target if needed and no other one has been
318+ # provided.
319+ if (
320+ self .is_codepeer and
321+ test_data .get ('auto_codepeer_target' , True )
322+ and not test_data .get ('target' )
323+ ):
308324 args .append ("--target=codepeer" )
309325
310326 # Set the "--show-rule" flag according to the test
@@ -415,6 +431,16 @@ def run_one_test(test_data: dict[str, any]) -> None:
415431 exec_output = p .out
416432 status_code = p .status
417433
434+ # If required, canonicalize gnatcheck worker name in the output
435+ if test_data .get ('canonicalize_worker' , True ):
436+ worker = " " .join (
437+ [
438+ P .basename (self .gnatcheck_worker_exe [0 ]),
439+ * self .gnatcheck_worker_exe [1 :],
440+ ]
441+ )
442+ exec_output = exec_output .replace (worker , "<gnatcheck_worker_exe>" )
443+
418444 # Then read GNATcheck report file if there is one
419445 report_file_content = ""
420446 parse_output_for_flags = True
0 commit comments