tests: Enlarge unittest timeout#10949
Conversation
Signed-off-by: JaySon-Huang <tshent@qq.com>
Signed-off-by: JaySon-Huang <tshent@qq.com>
📝 WalkthroughWalkthroughThis PR modifies the gtest_parallel test runner to record runtime for interrupted test tasks and updates output formatting for interrupted tests, and increases the parallel test execution timeout in run-gtest.sh from 3600 to 5400 seconds. ChangesTest Runner Fixes
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (3)
tests/gtest_parallel.py (2)
386-390: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueLocal variable shadows attribute name.
runtime_mslocal var shadowstask.runtime_ms; a distinct name (e.g.runtime_str) would avoid the confusion.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/gtest_parallel.py` around lines 386 - 390, The variable in the output formatting block of gtest_parallel’s task printing logic is shadowing the task.runtime_ms attribute, which can be confusing. Rename the local in the code path that builds the permanent line output to a distinct name such as runtime_str, and update the formatted string to use that renamed variable while keeping the existing runtime_ms attribute access unchanged.
370-384: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueFragile magic-string dispatch for interrupted formatting.
is_interruptedis derived by comparingmessageagainst the literal'INTERRUPTED TESTS'. This couples formatting behavior to the exact caller-supplied string; if a caller passes a differently-worded message for the interrupted set, this silently falls back to the non-interrupted branch.♻️ Consider an explicit parameter instead
- def print_tests(self, message, tasks, print_try_number): + def print_tests(self, message, tasks, print_try_number, is_interrupted=False): self.out.permanent_line("%s (%s/%s):" % (message, len(tasks), self.total_tasks)) - is_interrupted = message == 'INTERRUPTED TESTS' for task in sorted(tasks):Would require updating call sites to pass the flag explicitly.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/gtest_parallel.py` around lines 370 - 384, The interrupted-test formatting in the task-printing path is driven by a brittle string comparison on message; update the relevant formatter in gtest_parallel to take an explicit interrupted flag instead of deriving is_interrupted from the literal message. Propagate that flag from the call sites that render test results, and keep the existing Interrupted output branch in the same task iteration logic so formatting no longer depends on the exact caller-supplied text.tests/run-gtest.sh (1)
60-60: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueUnquoted variable expansions (SC2086).
Shellcheck flags
${test_bins},${NPROC},${args}on this line for missing quotes, risking word splitting/globbing. This mirrors an existing pattern elsewhere in the file, so treat as optional cleanup rather than blocking.🧹 Optional quoting fix
- python ${SRC_TESTS_PATH}/gtest_parallel.py ${test_bins} --workers=${NPROC} ${args} --print_test_times --timeout=5400 + python "${SRC_TESTS_PATH}/gtest_parallel.py" "${test_bins}" --workers="${NPROC}" ${args} --print_test_times --timeout=5400As per static analysis hints, "Double quote to prevent globbing and word splitting."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/run-gtest.sh` at line 60, Shellcheck is flagging unquoted expansions in the gtest invocation, so update the run-gtest.sh command to quote the test_bins, NPROC, and args variables consistently with the script’s other quoted usage. Keep the behavior unchanged while preventing word splitting/globbing in the python gtest_parallel.py call.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/gtest_parallel.py`:
- Around line 386-390: The variable in the output formatting block of
gtest_parallel’s task printing logic is shadowing the task.runtime_ms attribute,
which can be confusing. Rename the local in the code path that builds the
permanent line output to a distinct name such as runtime_str, and update the
formatted string to use that renamed variable while keeping the existing
runtime_ms attribute access unchanged.
- Around line 370-384: The interrupted-test formatting in the task-printing path
is driven by a brittle string comparison on message; update the relevant
formatter in gtest_parallel to take an explicit interrupted flag instead of
deriving is_interrupted from the literal message. Propagate that flag from the
call sites that render test results, and keep the existing Interrupted output
branch in the same task iteration logic so formatting no longer depends on the
exact caller-supplied text.
In `@tests/run-gtest.sh`:
- Line 60: Shellcheck is flagging unquoted expansions in the gtest invocation,
so update the run-gtest.sh command to quote the test_bins, NPROC, and args
variables consistently with the script’s other quoted usage. Keep the behavior
unchanged while preventing word splitting/globbing in the python
gtest_parallel.py call.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: faa3b8a2-f776-42ac-bfd4-a72be77740c0
📒 Files selected for processing (2)
tests/gtest_parallel.pytests/run-gtest.sh
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: windtalker, yongman The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/retest |
1 similar comment
|
/retest |
What problem does this PR solve?
Issue Number: ref #6233
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit
Bug Fixes
Chores