Skip to content

Show runtime for interrupted tests#102

Open
JaySon-Huang wants to merge 1 commit into
google:masterfrom
JaySon-Huang:show-interrupted-test-runtime
Open

Show runtime for interrupted tests#102
JaySon-Huang wants to merge 1 commit into
google:masterfrom
JaySon-Huang:show-interrupted-test-runtime

Conversation

@JaySon-Huang

Copy link
Copy Markdown

Summary

Hi! This is a small improvement to make interrupted tests easier to diagnose.

When a test run is stopped early (for example with Ctrl+C), the INTERRUPTED TESTS summary currently only shows the test name, without how long it had been running. That makes it harder to tell whether a test was interrupted near the start or after running for a long time.

This change records the elapsed time before the worker thread exits on interruption, and includes it in the summary output.

Before:

INTERRUPTED TESTS (1/3380):
Interrupted: /tiflash/gtests_dbms ComputeServerRunner.runAggTasks

After:

INTERRUPTED TESTS (1/3380):
Interrupted: 1078216 ms: /tiflash/gtests_dbms ComputeServerRunner.runAggTasks

Changes

  • Record runtime_ms in Task.run() when ProcessWasInterrupted is raised (before thread.exit()).
  • Update print_tests() to show Interrupted: <ms> ms for interrupted tests when runtime is available.
  • Add unit tests for both behaviors.

Test plan

  • python3 -m unittest gtest_parallel_tests -v
  • Verified interrupted test output format via test_print_interrupted_tests_shows_runtime

Happy to adjust the output format or naming if you have a preference. Thanks for maintaining this project!

Record elapsed time before thread exit on SIGINT and include it in the INTERRUPTED TESTS summary output.
@google-cla

google-cla Bot commented Jul 2, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

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.

1 participant