|
1 | 1 | import os |
2 | 2 | import os.path as P |
3 | 3 | import re |
4 | | -import sys |
5 | 4 | import xml.etree.ElementTree as ET |
6 | 5 |
|
7 | 6 | from e3.testsuite.driver.diff import ( |
@@ -130,6 +129,8 @@ class GnatcheckDriver(BaseDriver): |
130 | 129 | - ``worker``: Provide a custom worker for the GNATcheck run. |
131 | 130 | - ``gnatkp_autoconfig`` (bool): Whether to automatically configure the |
132 | 131 | target and runtime when running in "gnatkp" mode. Default is True. |
| 132 | + - ``in_tty`` (bool): Whether to run GNATcheck in a pseudo TTY using the |
| 133 | + ``pty`` Python module. |
133 | 134 |
|
134 | 135 | - ``jobs`` (int): The number of jobs to forward to the GNATcheck command. |
135 | 136 | - ``project`` (str): GPR build file to use (if any). |
@@ -404,10 +405,17 @@ def run_one_test(test_data: dict[str, any]) -> None: |
404 | 405 | if label: |
405 | 406 | self.output += label + "\n" + ("=" * len(label)) + "\n\n" |
406 | 407 |
|
407 | | - p = self.shell(args, env=gnatcheck_env, catch_error=False, analyze_output=False) |
408 | | - |
409 | | - # Get the GNATcheck execution output |
410 | | - exec_output = p.out |
| 408 | + # Execute GNATcheck and get its output |
| 409 | + exec_output = "" |
| 410 | + status_code = 0 |
| 411 | + if test_data.get("in_tty"): |
| 412 | + exec_output, status_code = self.run_in_tty(args, env=gnatcheck_env) |
| 413 | + else: |
| 414 | + p = self.shell(args, env=gnatcheck_env, catch_error=False, analyze_output=False) |
| 415 | + exec_output = p.out |
| 416 | + status_code = p.status |
| 417 | + |
| 418 | + # Then read GNATcheck report file if there is one |
411 | 419 | report_file_content = "" |
412 | 420 | parse_output_for_flags = True |
413 | 421 | if output_format in ['full', 'short', 'xml']: |
@@ -451,8 +459,8 @@ def run_one_test(test_data: dict[str, any]) -> None: |
451 | 459 | self.output += ("testsuite_driver: Cannot found the rule " |
452 | 460 | f"list file '{test_data['rule_list_file']}'") |
453 | 461 |
|
454 | | - if (not brief and p.status not in [0, 1]) or (brief and p.status != 0): |
455 | | - self.output += ">>>program returned status code {}\n".format(p.status) |
| 462 | + if (not brief and status_code not in [0, 1]) or (brief and status_code != 0): |
| 463 | + self.output += ">>>program returned status code {}\n".format(status_code) |
456 | 464 |
|
457 | 465 | # List the content of directories if needed |
458 | 466 | if test_data.get('list_dirs'): |
|
0 commit comments