| 1 | #include "sync/tests/test_internal.h" |
|---|---|
| 2 | |
| 3 | TEST_GROUP_DECLARE(rwlock, .intensity_desc = { |
| 4 | .curve = SCALE_PIECEWISE_LOG, |
| 5 | .unit = "threads", |
| 6 | }); |
| 7 | |
| 8 | #define RWLOCK_REPORT_PROBLEMS() \ |
| 9 | test_info("rwlock tests are encountering problems and will be skipped"); \ |
| 10 | return TEST_SKIP(TEST_SKIP_NONE); |
| 11 | |
| 12 | static struct rwlock rw_basic = RWLOCK_INIT(THREAD_PRIO_CLASS_TIMESHARE); |
| 13 | |
| 14 | TEST_DECLARE_SMOKE(rwlock, basic_read) { |
| 15 | rw_lock(&rw_basic, RWLOCK_ACQUIRE_READ); |
| 16 | scheduler_yield(); |
| 17 | rw_unlock(&rw_basic); |
| 18 | |
| 19 | return TEST_SUCCESS; |
| 20 | } |
| 21 | |
| 22 | static struct rwlock rw_basic_w = RWLOCK_INIT(THREAD_PRIO_CLASS_TIMESHARE); |
| 23 | |
| 24 | TEST_DECLARE_SMOKE(rwlock, basic_write) { |
| 25 | rw_lock(&rw_basic_w, RWLOCK_ACQUIRE_WRITE); |
| 26 | scheduler_yield(); |
| 27 | rw_unlock(&rw_basic_w); |
| 28 | |
| 29 | return TEST_SUCCESS; |
| 30 | } |
| 31 |