Repository navigation
Commit e4e8f84
committed
[None][fix] Harden the KVCM2 concurrency tests against their own failure modes
Three problems in the tests added earlier in this PR, all of which made them
look stronger than they were.
Fatal assertions ran while worker threads were still joinable. ASSERT_* returns
from the function immediately, so a firing assertion would have destroyed a
joinable std::thread and terminated the process instead of reporting which check
failed. The three sites now use EXPECT_* and guard the dependent checks, so the
join always runs.
ProbeReuseInterleavesWithExclusiveWork evaluated its loop condition before the
first iteration, so if the prober had already cleared kMinProbes between
sampling the baseline and the check, the writer performed no exclusive work at
all and the test passed having exercised no interleaving. It is now a do/while,
so at least one exclusive mutation always happens.
The same test could also hang. glibc's rwlock prefers readers, so a continuous
stream of probeReuse() shared acquisitions can starve the writer, and
getAndResetIterationStats() would then block with no bound. The prober now stops
on its own deadline and yields between probes, so starvation ends the run and
fails the assertion rather than hanging CI.
Tests: 84 KVCM2 C++ tests and 230 python tests pass; both concurrency binaries
run 5x without flaking.
Signed-off-by: Yao Yao <lowsfer@users.noreply.github.com>1 parent bf075c3 commit e4e8f84
2 files changed
Lines changed: 49 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
165 | 169 | | |
166 | 170 | | |
167 | 171 | | |
168 | | - | |
| 172 | + | |
169 | 173 | | |
170 | 174 | | |
171 | 175 | | |
| 176 | + | |
172 | 177 | | |
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
180 | 184 | | |
181 | 185 | | |
182 | 186 | | |
183 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
184 | 190 | | |
185 | | - | |
186 | 191 | | |
187 | 192 | | |
188 | | - | |
189 | | - | |
190 | | - | |
| 193 | + | |
| 194 | + | |
191 | 195 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
196 | 208 | | |
197 | 209 | | |
198 | 210 | | |
199 | 211 | | |
200 | | - | |
201 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
202 | 218 | | |
203 | 219 | | |
204 | 220 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
| |||
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
182 | | - | |
183 | | - | |
184 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
187 | 198 | | |
| |||
0 commit comments