-
Notifications
You must be signed in to change notification settings - Fork 121
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |||||||||||
| nFAIL = 0 | ||||||||||||
| nPASS = 0 | ||||||||||||
| nSKIP = 0 | ||||||||||||
| current_test_number = 0 | ||||||||||||
| total_test_count = 0 | ||||||||||||
| errors = [] | ||||||||||||
|
|
||||||||||||
| # pylint: disable=too-many-branches, trailing-whitespace | ||||||||||||
|
|
@@ -95,7 +97,7 @@ def __filter(cases_) -> typing.List[TestCase]: | |||||||||||
|
|
||||||||||||
| def test(): | ||||||||||||
| # pylint: disable=global-statement, global-variable-not-assigned | ||||||||||||
| global nFAIL, nPASS, nSKIP | ||||||||||||
| global nFAIL, nPASS, nSKIP, total_test_count | ||||||||||||
| global errors | ||||||||||||
|
|
||||||||||||
| cases = list_cases() | ||||||||||||
|
|
@@ -113,6 +115,7 @@ def test(): | |||||||||||
|
|
||||||||||||
| cases, skipped_cases = __filter(cases) | ||||||||||||
| cases = [ _.to_case() for _ in cases ] | ||||||||||||
| total_test_count = len(cases) | ||||||||||||
|
|
||||||||||||
| if ARG("list"): | ||||||||||||
| table = rich.table.Table(title="MFC Test Cases", box=rich.table.box.SIMPLE) | ||||||||||||
|
|
@@ -150,7 +153,7 @@ def test(): | |||||||||||
|
|
||||||||||||
| # Run cases with multiple threads (if available) | ||||||||||||
| cons.print() | ||||||||||||
| cons.print(" tests/[bold magenta]UUID[/bold magenta] (s) Summary") | ||||||||||||
| cons.print(" Progress [bold magenta]UUID[/bold magenta] (s) Summary") | ||||||||||||
| cons.print() | ||||||||||||
|
|
||||||||||||
| # Select the correct number of threads to use to launch test cases | ||||||||||||
|
|
@@ -185,6 +188,7 @@ def test(): | |||||||||||
| # pylint: disable=too-many-locals, too-many-branches, too-many-statements, trailing-whitespace | ||||||||||||
| 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() | ||||||||||||
|
|
||||||||||||
| tol = case.compute_tolerance() | ||||||||||||
|
|
@@ -269,7 +273,9 @@ def _handle_case(case: TestCase, devices: typing.Set[int]): | |||||||||||
| end_time = time.time() | ||||||||||||
| duration = end_time - start_time | ||||||||||||
|
|
||||||||||||
| cons.print(f" [bold magenta]{case.get_uuid()}[/bold magenta] {duration:6.2f} {case.trace}") | ||||||||||||
| current_test_number += 1 | ||||||||||||
| progress_str = f"({current_test_number:3d}/{total_test_count:3d})" | ||||||||||||
|
Comment on lines
+276
to
+277
|
||||||||||||
| 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})" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_numberis being modified in_handle_casewhich 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.