Skip to content

Commit 197eb8c

Browse files
Rollup merge of #154967 - PaulDance:patches/fix-x86-win7-rwlock-max-test, r=Mark-Simulacrum
Test(lib/sync): Fix `test_rwlock_max_readers` for x86 Win7 The test recently added in #153555 currently systematically deadlocks when running it under i686 Windows 7, but not x86_64 that passes it fine. This therefore fixes the test for the target. Empirically, the correct value for `MAX_READERS` seems to be `2^28 - 1`: removing the `- 1` re-introduces the deadlock, at least under our testing environment. This fix thus uses this value. However, I have no real justification to support that, because I find myself a bit at a loss when comparing the implementation details, the comment added above the test and what the current value is; some help would therefore be nice in this aspect. Also, the value change is restricted to 32-bit Win7 as there is no evidence to support it should be done for other targets. cc @roblabla @rustbot label O-windows-msvc O-windows-7 O-x86_32 A-atomic T-libs
2 parents 81578ef + 962e9e2 commit 197eb8c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

library/std/tests/sync/rwlock.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,19 +917,23 @@ fn test_rwlock_max_readers() {
917917
target_os = "fuchsia",
918918
all(target_family = "wasm", target_feature = "atomics"),
919919
target_os = "hermit",
920-
target_os = "motor",
920+
target_os = "motor",
921921
) => {
922922
(1 << 30) - 2
923923
},
924924
any(
925925
target_family = "unix",
926-
all(target_os = "windows", target_vendor = "win7"),
926+
all(target_os = "windows", target_vendor = "win7", target_pointer_width = "64"),
927927
all(target_vendor = "fortanix", target_env = "sgx"),
928928
target_os = "xous",
929929
target_os = "teeos",
930930
) => {
931931
u32::MAX
932932
},
933+
// Otherwise a form of deadlock is observed.
934+
all(target_os = "windows", target_vendor = "win7", target_pointer_width = "32") => {
935+
(1 << 28) - 1
936+
},
933937
target_os = "solid_asp3" => {
934938
(1 << 30)
935939
},

0 commit comments

Comments
 (0)