Skip to content

session: persist partial results on abort mid-suite - #103

Closed
mimi1vx wants to merge 1 commit into
linux-test-project:masterfrom
mimi1vx:fix-102-persist-partial-results
Closed

session: persist partial results on abort mid-suite#103
mimi1vx wants to merge 1 commit into
linux-test-project:masterfrom
mimi1vx:fix-102-persist-partial-results

Conversation

@mimi1vx

@mimi1vx mimi1vx commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

self._results is only extended after _scheduler.schedule() returns. When
a KirkException is raised during scheduling (e.g. a CommunicationError on
SUT connection loss), the extend is skipped and self._results stays empty,
even though the scheduler already collected results for the tests that ran.
The export guard then skips writing results.json, discarding those results.

Wrap the extend in _schedule_once() with try/finally so results collected
before the abort are carried over and exported. Add a regression test in
_TestSession so it runs against every SUT implementation.

Closes #102

@acerv acerv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analysis might be good, but the implementation looks like AI slop.
The whole point is

If a KirkException is raised inside schedule(), that extend is never reached, so self._results stays empty.

So why not just catching the exception and populating the self._results instead of adding code around the issue? :-)

    async def _schedule_once(self, suites_obj: List[Suite]) -> None:
        """
        Schedule tests only once.
        """
        try:
            await self._scheduler.schedule(suites_obj)
        finally:
            self._results.extend(self._scheduler.results)

Also the tests for session stays inside test_session.py and we really want to test all SUT implementations, not faking it with an abstraction class.

@mimi1vx
mimi1vx force-pushed the fix-102-persist-partial-results branch from 3fb1170 to c758a81 Compare July 15, 2026 10:32
@mimi1vx
mimi1vx requested a review from acerv July 15, 2026 10:33
@acerv

acerv commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Feel free to ignore Static analysis errors. I will fix it soon.

@acerv

acerv commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Also, please cleanup the commit message. In kirk we are following the LTP standards, which means kernel commit standards: short subject and precise description. We use Github mostly for CI and accepting PR, but the git history must be concise and simple.

@mimi1vx
mimi1vx force-pushed the fix-102-persist-partial-results branch from c758a81 to 9d1d68f Compare July 15, 2026 14:13
@mimi1vx mimi1vx changed the title fix(session): persist partial results when a session aborts mid-suite session: persist partial results on abort mid-suite Jul 15, 2026
@mimi1vx

mimi1vx commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@acerv btw why are supported EOL versions of python ? Should not be much easier maintain only supported versions , ( maybe + 3.11 as that is still in leap/SLE fully supported )

@acerv

acerv commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

@acerv btw why are supported EOL versions of python ? Should not be much easier maintain only supported versions , ( maybe + 3.11 as that is still in leap/SLE fully supported )

We are supporting systems which are supported by LTP, even if they are in EOL:

https://linux-test-project.readthedocs.io/en/latest/users/supported_systems.html

it's actually not a big effort, we have full control of the code and enough wrappers to handle asyncio. The rest is done by the CI.

@mimi1vx

mimi1vx commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

wow .. 42.2 :D

Comment thread libkirk/tests/test_session.py Outdated
Comment thread libkirk/session.py Outdated
self._results is only extended after _scheduler.schedule() returns. When
a KirkException is raised during scheduling (e.g. a CommunicationError on
SUT connection loss), the extend is skipped and self._results stays empty,
even though the scheduler already collected results for the tests that ran.
The export guard (if self._results) then skips writing results.json,
silently discarding those partial results.

Wrap the extend in _schedule_once() with try/finally so results collected
before the abort are always carried over and exported.

Add a regression test in _TestSession, so it runs against every SUT
implementation.

Closes: linux-test-project#102
Signed-off-by: Ondřej Súkup <osukup@suse.com>
@mimi1vx
mimi1vx force-pushed the fix-102-persist-partial-results branch from 9d1d68f to 76aab18 Compare July 15, 2026 15:51
@mimi1vx
mimi1vx requested a review from acerv July 15, 2026 15:52
@acerv

acerv commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Merged thanks

@acerv acerv closed this Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Partial results discarded when session aborts mid-suite (results.json not written on CommunicationError)

2 participants