Skip to content

gh-109817: Add --single-process-per-case option to libregrtest - #151689

Open
Aniketsy wants to merge 3 commits into
python:mainfrom
Aniketsy:fix-109817
Open

gh-109817: Add --single-process-per-case option to libregrtest#151689
Aniketsy wants to merge 3 commits into
python:mainfrom
Aniketsy:fix-109817

Conversation

@Aniketsy

@Aniketsy Aniketsy commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

fixes #109817

  • still working on this , so converting into draft @serhiy-storchaka please let me know if this looks in right direction or any pointers you want to share. Thanks!

@Aniketsy

Aniketsy commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

i'll fix these mypy and add tests , in the meantime removing from draft, to get some review and suggestions.

@Aniketsy
Aniketsy marked this pull request as ready for review July 1, 2026 07:04
@serhiy-storchaka
serhiy-storchaka self-requested a review July 1, 2026 07:21
@serhiy-storchaka

Copy link
Copy Markdown
Member

I'm a little busy now, but I'll review it after finishing with other unittest/regrtest tasks. Thank you for your efforts.

@Aniketsy

Copy link
Copy Markdown
Contributor Author

I'm a little busy now, but I'll review it after finishing with other unittest/regrtest tasks.

no hurry, i'm improving this till then, so hopefully it creates less pain for you to review 😊 .

I've added tests, with some improvement (locally everything works fine for me) . i'll once again go through this and check for improvement areas before you come here .

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for working on this.

It looks like the code does what the issue asked. But I suspect it can be simplified.

@@ -94,19 +94,47 @@ def list_cases(tests: TestTuple, *,
test_dir: StrPath | None = None) -> None:
support.verbose = False
set_match_tests(match_tests)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

set_match_tests() is called both in list_cases() and in collect_cases().

with self.lock:
self.tests_iter = None

class GroupedMultiprocessIterator:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Cannot MultiprocessIterator be used instead? These classes look very similar.

finally:
self.test_name = _NOT_RUNNING

mp_result = dataclasses.replace(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mp_result.result is mutable, it can be mutated in-place (see _run_flat()).

finally:
self.output.put(WorkerThreadExited())

def _run_grouped(self) -> None:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

_run_grouped() looks very similar to _run_flat() (especially if unify iterators). Could not the share the parametrized body?

@Aniketsy

Aniketsy commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

Thank you for working on this.

It looks like the code does what the issue asked. But I suspect it can be simplified.

thanks for the review , i'll update shortly with the improvement points you shared .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

libregrtest: add option to run every test case in separate process

2 participants