@@ -83,8 +83,10 @@ class GnatcheckDriver(BaseDriver):
8383 provided file.
8484 - ``ignore_file`` (str): If passed, ignore all sources listed in the
8585 provided file.
86- - ``output_file`` (str): The file to pass to GNATcheck with the `-o` or
87- `-ox` option then to read the output in.
86+ - ``output_file`` (str | bool): The file to pass to GNATcheck with the
87+ `-o` or `-ox` option then to read the output in. If this attribute
88+ is ``False``, no output file option is passed to GNATcheck and the
89+ GNATcheck output file is not analyzed.
8890 - ``gpr_config_file`` (str): A GPR configuration file to pass through
8991 the '--config' option.
9092 - ``scenario_variables`` (dict[str, str]): Dict containing key to value
@@ -408,11 +410,11 @@ def run_one_test(test_data: dict[str, any]) -> None:
408410 brief = output_format == "brief"
409411 exe = GnatcheckDriver .modes [test_data .get ("mode" , "gnatcheck" )]
410412 args = [exe , "-q" ]
411- output_file_name = self . working_dir (
412- test_data . get (
413- "output_file" , f"{ exe } .{ 'xml' if output_format == 'xml' else 'out' } "
414- )
415- )
413+ output_file_name = test_data . get ( "output_file" )
414+ if output_file_name is None or output_file_name == True :
415+ output_file_name = self . working_dir ( f"{ exe } .{ 'xml' if output_format == 'xml' else 'out' } " )
416+ elif output_file_name :
417+ output_file_name = self . working_dir ( output_file_name )
416418 test_env = dict (gnatcheck_env )
417419
418420 pre_python = test_data .get ("pre_python" , None )
@@ -476,10 +478,11 @@ def run_one_test(test_data: dict[str, any]) -> None:
476478 args += ["--subdirs" , test_data ["subdirs" ]]
477479
478480 # Set the output file path according to the requested format
479- if output_format in ["short" , "full" ]:
480- args .append (f"-o={ output_file_name } " )
481- elif output_format == "xml" :
482- args .append (f"-ox={ output_file_name } " )
481+ if output_file_name :
482+ if output_format in ["short" , "full" ]:
483+ args .append (f"-o={ output_file_name } " )
484+ elif output_format == "xml" :
485+ args .append (f"-ox={ output_file_name } " )
483486
484487 # Add the include file if any
485488 include_file = test_data .get ("include_file" , None )
@@ -602,8 +605,8 @@ def run_one_test(test_data: dict[str, any]) -> None:
602605
603606 # Then read GNATcheck report file if there is one
604607 report_file_content = ""
605- parse_output_for_flags = True
606- if output_format in ["full" , "short" , "xml" ]:
608+ has_output_file = False
609+ if output_file_name and output_format in ["full" , "short" , "xml" ]:
607610 try :
608611 with open (output_file_name ) as f :
609612 if output_format in ["short" , "xml" ]:
@@ -622,14 +625,14 @@ def run_one_test(test_data: dict[str, any]) -> None:
622625 # run-specific information that we don't want to
623626 # include in the test baseline.
624627 report_file_content = "" .join (f .readlines ()[9 :])
628+ has_output_file = True
625629 except FileNotFoundError as _ :
626630 self .output += (
627631 "testsuite_driver: No output file generated by gnatcheck\n "
628632 )
629- parse_output_for_flags = False
630633
631634 # Get the lines flagged by the test running and add it to all flagged lines
632- if self .flag_checking and parse_output_for_flags :
635+ if self .flag_checking and ( has_output_file or output_format == "brief" ) :
633636 add_to_files_flagged_lines (
634637 self .parse_flagged_lines (
635638 (
0 commit comments