-
Notifications
You must be signed in to change notification settings - Fork 117
Add progress counter to ./mfc.sh test
#980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a progress counter to the MFC test runner, displaying the current test number and total test count during test execution. This enhancement improves user experience by providing visibility into test progress.
Key changes:
- Added global variables to track current test number and total test count
- Modified test output format to include progress information
- Updated the test header to accommodate the new progress column
def _handle_case(case: TestCase, devices: typing.Set[int]): | ||
# pylint: disable=global-statement, global-variable-not-assigned | ||
global current_test_number | ||
start_time = time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The global variable current_test_number
is being modified in _handle_case
which appears to be called from multiple threads based on the comment 'Run cases with multiple threads'. This creates a race condition where multiple threads could increment the counter simultaneously, leading to incorrect progress reporting.
start_time = time.time() | |
start_time = time.time() | |
# Ensure thread-safe increment of current_test_number | |
with current_test_number_lock: | |
current_test_number += 1 |
Copilot uses AI. Check for mistakes.
current_test_number += 1 | ||
progress_str = f"({current_test_number:3d}/{total_test_count:3d})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This increment operation is not thread-safe. When multiple test cases run concurrently, the progress counter will be inaccurate due to race conditions. Consider using a thread-safe counter or moving this logic to a synchronized section.
current_test_number += 1 | |
progress_str = f"({current_test_number:3d}/{total_test_count:3d})" | |
with current_test_number_lock: | |
current_test_number += 1 | |
progress_str = f"({current_test_number:3d}/{total_test_count:3d})" |
Copilot uses AI. Check for mistakes.
PR Code Suggestions ✨Explore these optional code suggestions:
|
User description
Adds progress counter to test.
PR Type
Enhancement
Description
Add progress counter to test execution output
Update job name formatting in CI script
Diagram Walkthrough
File Walkthrough
test.py
Add progress tracking to test execution
toolchain/mfc/test/test.py
current_test_number
andtotal_test_count
fortracking progress
total_test_count
with the number of test casessubmit.sh
Fix job name formatting
.github/workflows/frontier/submit.sh