Skip to content

feat(test): add batch test selection to the test runner - #2586

Merged
an-tao merged 2 commits into
drogonframework:masterfrom
den-a-s:feature/batch-test-selection
Sep 7, 2026
Merged

feat(test): add batch test selection to the test runner#2586
an-tao merged 2 commits into
drogonframework:masterfrom
den-a-s:feature/batch-test-selection

Conversation

@den-a-s

@den-a-s den-a-s commented Sep 6, 2026

Copy link
Copy Markdown

Summary

Allow the Drogon test runner to select several named tests in one invocation:

./unittest -r TestFrameworkSelfTest URLCodec SomeTest3

Why

CI jobs and local development often need to rerun a focused set of related
tests. Previously, -r accepted only one test name, requiring a separate
process for every selected test.

User story

As a developer, I want to pass a list of test names to -r so that I can run
a targeted group of tests with one command while preserving the order in which
I requested them.

Behaviour

  • -r accepts one or more test names until the next option.

  • Selected tests are started in the supplied order.

  • The runner validates every requested name before starting tests; if one or
    more names are unknown, it reports all missing names and starts none.

  • Duplicate names are rejected immediately to avoid running the same
    TestCase instance more than once.

  • --help documents batch syntax and shell expansion, for example
    -r $(cat selected-tests.txt).

  • Existing -s, -l, -h, and unknown-option behaviour is preserved.

Tests

  • Added CTest CLI coverage for single and batch selection, order preservation,
    duplicates, unknown names, missing arguments, unknown options, listing, and
    help output.

  • Ran drogon_test_runner_cli.

  • Ran the complete unittest suite successfully.

Allow -r to accept multiple test names and start them in the specified
order.

Validate all requested test names before starting any test and report
unknown names. Reject duplicate names immediately to avoid running the
same TestCase instance more than once.

Add CLI regression coverage for single and batch selection, invalid
arguments, test listing, and help output.
@den-a-s
den-a-s marked this pull request as ready for review September 6, 2026 12:39
Avoid calling exit() from test::run() on CLI early-exit paths.

exit() bypasses the unittest main's shutdown sequence, leaving the
app event-loop thread running while static objects are destroyed. This
can race with Drogon teardown and cause a use-after-free when listing
tests.

Return the corresponding status instead, so main() can quit the app
and join the thread before process teardown.
@den-a-s

den-a-s commented Sep 7, 2026

Copy link
Copy Markdown
Author

I think it would be better not to squash the commits, since an important bug was discovered and fixed thanks to the new tests.
Or would it be better to squash them and explain separately in the PR description how the bug was fixed?

@an-tao
an-tao merged commit 9af062a into drogonframework:master Sep 7, 2026
34 checks passed
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.

2 participants