[pr-tests] darner-gpu's tests no longer stand still: refresh_tests::submission takes the two test locks in the order the tests beside it do #224

Open
blazecoding2009 wants to merge 1 commit from blazecoding2009/Darner:pr/test-lock-order into main
First-time contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: gate 3 (cargo test --workspace --locked) can stand still in darner-gpu's unit tests and never end. On f3840d7 it did in 1 of 6 runs of that test binary here, and in 4 of 5 runs of host::refresh_tests alone. What one such run printed before I stopped it:

    test host::refresh_tests::a_title_write_flushes_only_the_copies_it_writes has been running for over 60 seconds
    test host::refresh_tests::askings_of_other_threads_beside_a_submission has been running for over 60 seconds
    test host::refresh_tests::chunked_nothing_new_with_matches_individual has been running for over 60 seconds
    test host::refresh_tests::landings_title_writes_and_light_refreshes_at_once has been running for over 60 seconds
    test host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due has been running for over 60 seconds
    test host::refresh_tests::refreshed_ranges_hold_title_memory has been running for over 60 seconds
    test host::refresh_tests::scoped_title_writes_end_as_writes_that_flush_everything has been running for over 60 seconds
    test host::refresh_tests::unchanged_ranges_are_known has been running for over 60 seconds
    

Two test locks are taken in opposite orders. refresh_tests::submission takes one_submission's lock and then watch::one_view_test's (the second since 6ecada3). Six tests of the same module take one_view_test's first and one_submission's second: a_title_write_flushes_only_the_copies_it_writes, a_title_write_flushes_copies_of_its_pages_at_other_addresses, scoped_title_writes_end_as_writes_that_flush_everything, chunked_nothing_new_with_matches_individual, refresh_front_zero_arc_matches_and_runs_due and frame_of_refresh_front. When a test that calls submission holding neither lock runs beside one of those six, each can hold one lock and wait for the other. Every other test that takes either lock (in a whole run, those of watch:: and host::watch_pipe too) then waits behind them.

submission now takes one_view_test's lock first, as those six tests do. Both locks are held over the same lines as before. Test code only: one function in mod refresh_tests of host.rs.

How it was tested

  • Tested revision: 27c1b18 (this one commit on main f3840d7).

  • Commands and results: cargo test --locked -p darner-gpu --lib --no-run on each revision, then that test binary run by itself, with a time limit a run (a whole run takes 27 to 48 s here, the module alone 2 s).

    A (main, f3840d7) B (27c1b18)
    host::refresh_tests alone, 90 s limit: runs 5 20
    stood still until the limit 4 0
    ended, all passed 1 20
    all tests, 150 s limit: runs 6 6
    stood still until the limit 1 0
    ended, all 1756 passed 1 4
    ended, one test failed 4 2

    The one test that failed, in all six of those runs on either side, is watch::tests::ask_once_by_res_splits_reservations_without_refusals. This change does not touch it and I did not look into it here.

  • Changes a default: no.

  • Gates run on that revision (the three in AGENTS.md; there is no CI): cargo clippy --workspace --all-targets --locked -- -D warnings: passed. The same with --all-features: passed. cargo xtask policy: 555 files ok. cargo test --workspace --locked: not run as one command on this revision. Of it, I ran darner-gpu's tests as in the table. On f3840d7 plus another one-file change of mine (ramtrim.rs only), cargo test --workspace --locked --no-fail-fast passed in every other test binary but darner-shader's (557 passed, 1 failed: emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, the failure #186 and #163 report on main), and that is the run in which darner-gpu's tests first stood still.

  • Gameplay: not run in the game. The change is in test code only.

  • Shader wave sizes tested, when relevant: not relevant.

  • Hardware dependence: likely general (a lock order). How often two such tests meet depends on timing and on the number of test threads: 16 here (Ryzen 7 8845HS, Windows 11 build 26300).

  • Coverage gaps: one PC. The cause is read from the code and from which tests waited, not from a dump of the waiting threads; the runs with the lock order changed are the evidence for it.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for this. Searches of open and closed issues and pull requests for one_view_test, one_submission, deadlock and test hang found no report. I searched the diff of every open pull request (83): 31 change host.rs, none changes submission or one_submission. #50 adds a test in another file that takes one_view_test's lock alone, which this order does not affect.
  • Replaces or overlaps: none found

This change was made with AI assistance (Claude Code).

🤖 Generated with Claude Code

## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: gate 3 (`cargo test --workspace --locked`) can stand still in `darner-gpu`'s unit tests and never end. On f3840d7 it did in 1 of 6 runs of that test binary here, and in 4 of 5 runs of `host::refresh_tests` alone. What one such run printed before I stopped it: ``` test host::refresh_tests::a_title_write_flushes_only_the_copies_it_writes has been running for over 60 seconds test host::refresh_tests::askings_of_other_threads_beside_a_submission has been running for over 60 seconds test host::refresh_tests::chunked_nothing_new_with_matches_individual has been running for over 60 seconds test host::refresh_tests::landings_title_writes_and_light_refreshes_at_once has been running for over 60 seconds test host::refresh_tests::refresh_front_zero_arc_matches_and_runs_due has been running for over 60 seconds test host::refresh_tests::refreshed_ranges_hold_title_memory has been running for over 60 seconds test host::refresh_tests::scoped_title_writes_end_as_writes_that_flush_everything has been running for over 60 seconds test host::refresh_tests::unchanged_ranges_are_known has been running for over 60 seconds ``` Two test locks are taken in opposite orders. `refresh_tests::submission` takes `one_submission`'s lock and then `watch::one_view_test`'s (the second since 6ecada3). Six tests of the same module take `one_view_test`'s first and `one_submission`'s second: `a_title_write_flushes_only_the_copies_it_writes`, `a_title_write_flushes_copies_of_its_pages_at_other_addresses`, `scoped_title_writes_end_as_writes_that_flush_everything`, `chunked_nothing_new_with_matches_individual`, `refresh_front_zero_arc_matches_and_runs_due` and `frame_of_refresh_front`. When a test that calls `submission` holding neither lock runs beside one of those six, each can hold one lock and wait for the other. Every other test that takes either lock (in a whole run, those of `watch::` and `host::watch_pipe` too) then waits behind them. `submission` now takes `one_view_test`'s lock first, as those six tests do. Both locks are held over the same lines as before. Test code only: one function in `mod refresh_tests` of `host.rs`. ## How it was tested - Tested revision: 27c1b18 (this one commit on `main` f3840d7). - Commands and results: `cargo test --locked -p darner-gpu --lib --no-run` on each revision, then that test binary run by itself, with a time limit a run (a whole run takes 27 to 48 s here, the module alone 2 s). | | A (main, f3840d7) | B (27c1b18) | |---|---|---| | `host::refresh_tests` alone, 90 s limit: runs | 5 | 20 | | stood still until the limit | 4 | 0 | | ended, all passed | 1 | 20 | | all tests, 150 s limit: runs | 6 | 6 | | stood still until the limit | 1 | 0 | | ended, all 1756 passed | 1 | 4 | | ended, one test failed | 4 | 2 | The one test that failed, in all six of those runs on either side, is `watch::tests::ask_once_by_res_splits_reservations_without_refusals`. This change does not touch it and I did not look into it here. - Changes a default: no. - Gates run on that revision (the three in AGENTS.md; there is no CI): `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed. The same with `--all-features`: passed. `cargo xtask policy`: 555 files ok. `cargo test --workspace --locked`: not run as one command on this revision. Of it, I ran `darner-gpu`'s tests as in the table. On f3840d7 plus another one-file change of mine (`ramtrim.rs` only), `cargo test --workspace --locked --no-fail-fast` passed in every other test binary but `darner-shader`'s (557 passed, 1 failed: `emit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders`, the failure #186 and #163 report on `main`), and that is the run in which `darner-gpu`'s tests first stood still. - Gameplay: not run in the game. The change is in test code only. - Shader wave sizes tested, when relevant: not relevant. - Hardware dependence: likely general (a lock order). How often two such tests meet depends on timing and on the number of test threads: 16 here (Ryzen 7 8845HS, Windows 11 build 26300). - Coverage gaps: one PC. The cause is read from the code and from which tests waited, not from a dump of the waiting threads; the runs with the lock order changed are the evidence for it. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for this. Searches of open and closed issues and pull requests for `one_view_test`, `one_submission`, `deadlock` and `test hang` found no report. I searched the diff of every open pull request (83): 31 change `host.rs`, none changes `submission` or `one_submission`. #50 adds a test in another file that takes `one_view_test`'s lock alone, which this order does not affect. - Replaces or overlaps: none found This change was made with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refresh_tests::submission took one_submission's lock and then
watch::one_view_test's (the second since 6ecada3), while six tests of the
same module take one_view_test's first and one_submission's second. A test
that calls submission holding neither, beside one of those six, could hold
one lock each and wait for the other; every other test that takes either
lock then waited behind them and `cargo test` never ended.

submission takes one_view_test's first, as those tests do. Both are held
over the same lines as before.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/test-lock-order:blazecoding2009-pr/test-lock-order'
git switch 'blazecoding2009-pr/test-lock-order'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'blazecoding2009-pr/test-lock-order'
git switch 'blazecoding2009-pr/test-lock-order'
git rebase 'main'
git switch 'main'
git merge --ff-only 'blazecoding2009-pr/test-lock-order'
git switch 'blazecoding2009-pr/test-lock-order'
git rebase 'main'
git switch 'main'
git merge --no-ff 'blazecoding2009-pr/test-lock-order'
git switch 'main'
git merge --squash 'blazecoding2009-pr/test-lock-order'
git switch 'main'
git merge --ff-only 'blazecoding2009-pr/test-lock-order'
git switch 'main'
git merge 'blazecoding2009-pr/test-lock-order'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!224
No description provided.