Skip to content

Commit c03603c

Browse files
committed
Add a 'gnatcheck_working_dir' configuration attribute to the GNATcheck testing driver
1 parent 6a32baf commit c03603c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

testsuite/drivers/gnatcheck_driver.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class GnatcheckDriver(BaseDriver):
5959
- ``auto_codepeer_target`` (bool): Whether to automatically add the
6060
codepeer target when the test is run in CodePeer mode. Default is
6161
True.
62+
- ``gnatcheck_working_dir`` (str): Path to set as working directory
63+
when spawning GNATcheck. This path should be relative to the test
64+
working directory.
6265
- ``in_tty`` (bool): Whether to run GNATcheck in a pseudo TTY using the
6366
``pty`` Python module.
6467
- ``lkql_path`` (list[str]): A list of directories forwarded to the
@@ -563,13 +566,26 @@ def run_one_test(test_data: dict[str, any]) -> None:
563566
self.output += label + "\n" + ("=" * len(label)) + "\n\n"
564567

565568
# Execute GNATcheck and get its output
569+
gnatcheck_cwd = (
570+
self.working_dir(test_data["gnatcheck_working_dir"])
571+
if test_data.get("gnatcheck_working_dir") else
572+
None
573+
)
566574
exec_output = ""
567575
status_code = 0
568576
if test_data.get("in_tty"):
569-
exec_output, status_code = self.run_in_tty(args, env=test_env)
577+
exec_output, status_code = self.run_in_tty(
578+
args,
579+
env=test_env,
580+
cwd=gnatcheck_cwd,
581+
)
570582
else:
571583
p = self.shell(
572-
args, env=test_env, catch_error=False, analyze_output=False
584+
args,
585+
env=test_env,
586+
catch_error=False,
587+
analyze_output=False,
588+
cwd=gnatcheck_cwd,
573589
)
574590
exec_output = p.out
575591
status_code = p.status

0 commit comments

Comments
 (0)