From 445f7c324c954c27240a98c095df074ad22aefaf Mon Sep 17 00:00:00 2001 From: Andrea Cervesato Date: Wed, 1 Nov 2023 14:09:16 +0100 Subject: [PATCH] Search for commands to run in framework folder With this patch it's possible tot execute tests which are inside the framework path by using the --run-command option. --- libkirk/session.py | 6 +++++- libkirk/tests/conftest.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libkirk/session.py b/libkirk/session.py index 3774beb..a54783e 100644 --- a/libkirk/session.py +++ b/libkirk/session.py @@ -235,9 +235,13 @@ async def _exec_command(self, command: str) -> None: try: await libkirk.events.fire("run_cmd_start", command) + test = await self._framework.find_command(self._sut, command) + ret = await asyncio.wait_for( self._sut.run_command( - command, + test.full_command, + cwd=test.cwd, + env=test.env, iobuffer=RedirectSUTStdout(self._sut, True)), timeout=self._exec_timeout ) diff --git a/libkirk/tests/conftest.py b/libkirk/tests/conftest.py index 65292b9..db1424d 100644 --- a/libkirk/tests/conftest.py +++ b/libkirk/tests/conftest.py @@ -48,6 +48,9 @@ def config_help(self) -> dict: async def get_suites(self, sut: SUT) -> list: return ["suite01", "suite02", "sleep", "environ", "kernel_panic"] + async def find_command(self, sut: SUT, command: str) -> Test: + return Test(command, command) + async def find_suite(self, sut: SUT, name: str) -> Suite: if name in "suite01": test0 = Test(