Commit 78be284
committed
fix(test): correct test logic and semantics in multiple test cases
1. ChannelTest::MultipleSendersReceivers
- Add C++14-compatible latch implementation (similar to C++20 std::latch)
- Ensure receivers are ready before senders start sending messages
- This prevents race condition where senders might send before receivers are listening
2. RWLockTest::ReadWriteReadPattern
- Fix test logic: lock_shared allows multiple concurrent readers
- Previous test had race condition where both threads could read same value
- New test: each thread writes based on thread id (1 or 2), then reads
- Expected result: 1*20 + 2*20 = 60
3. ShmTest::ReleaseMemory
- Correct return value semantics: release() returns ref count before decrement, or -1 on error
- Must call get_mem() to map memory and set ref count to 1 before release
- Expected: release() returns 1 (ref count before decrement)
4. ShmTest::ReferenceCount
- Correct semantics: ref count is 0 after acquire (memory not mapped)
- get_mem() maps memory and sets ref count to 1
- Second acquire+get_mem increases ref count to 2
- Test now properly validates reference counting behavior
5. ShmTest::SubtractReference
- sub_ref() only works after get_mem() has mapped the memory
- Must call get_mem() first to initialize ref count to 1
- sub_ref() then decrements it to 0
- Test now follows correct API usage pattern1 parent d5f7875 commit 78be284
3 files changed
+89
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
32 | 57 | | |
33 | 58 | | |
34 | 59 | | |
| |||
516 | 541 | | |
517 | 542 | | |
518 | 543 | | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
| 544 | + | |
| 545 | + | |
532 | 546 | | |
533 | 547 | | |
534 | 548 | | |
535 | 549 | | |
536 | 550 | | |
| 551 | + | |
| 552 | + | |
537 | 553 | | |
538 | 554 | | |
539 | 555 | | |
| |||
543 | 559 | | |
544 | 560 | | |
545 | 561 | | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
546 | 579 | | |
547 | 580 | | |
548 | 581 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| 386 | + | |
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
389 | | - | |
390 | | - | |
391 | | - | |
392 | | - | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
393 | 394 | | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | | - | |
397 | | - | |
398 | | - | |
399 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
400 | 403 | | |
401 | 404 | | |
402 | 405 | | |
| |||
408 | 411 | | |
409 | 412 | | |
410 | 413 | | |
411 | | - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
412 | 418 | | |
413 | 419 | | |
414 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
129 | 134 | | |
130 | | - | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
| |||
161 | 166 | | |
162 | 167 | | |
163 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
164 | 177 | | |
165 | | - | |
| 178 | + | |
166 | 179 | | |
167 | | - | |
| 180 | + | |
168 | 181 | | |
169 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
170 | 186 | | |
171 | | - | |
| 187 | + | |
172 | 188 | | |
173 | 189 | | |
174 | 190 | | |
| |||
184 | 200 | | |
185 | 201 | | |
186 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
187 | 207 | | |
| 208 | + | |
| 209 | + | |
188 | 210 | | |
189 | | - | |
190 | 211 | | |
191 | | - | |
| 212 | + | |
| 213 | + | |
192 | 214 | | |
193 | 215 | | |
194 | 216 | | |
| |||
0 commit comments