Test coordination primitives
include/test/sync.h View source View on GitHubStructs
Section titled “Structs”test_latch
Section titled “test_latch” struct test_latch (1 field) source
Just a wrapper around event_latch. Someday we could
But we only really need an event_latch for “correctness”
TODO
add metadata and tracking around this.
§
struct event_latch el test_phase
Section titled “test_phase” struct test_phase (4 fields) source
This effectively serves as the
while (atomic_load(&v->phase) != n) scheduler_yield();pattern that tests like, with a poison bool to tell it to end
§
atomic_uint32_t phase §
atomic_bool poisoned Functions
Section titled “Functions”test_latch_init
Section titled “test_latch_init”void test_latch_init(struct test_latch *l) source test_latch_set
Section titled “test_latch_set”void test_latch_set(struct test_latch *l) source test_latch_test
Section titled “test_latch_test”bool test_latch_test(const struct test_latch *l) source test_latch_wait_timeout
Section titled “test_latch_wait_timeout”bool test_latch_wait_timeout(
struct test_latch *l,
time_ms_t timeout_ms
) source test_latch_spin_timeout
Section titled “test_latch_spin_timeout”bool test_latch_spin_timeout(
struct test_latch *l,
time_ms_t timeout_ms
) source test_phase_init
Section titled “test_phase_init”void test_phase_init(struct test_phase *p) source test_phase_get
Section titled “test_phase_get”uint32_t test_phase_get(const struct test_phase *p) source test_phase_publish
Section titled “test_phase_publish”void test_phase_publish(struct test_phase *p, uint32_t phase) source test_phase_set
Section titled “test_phase_set”void test_phase_set(struct test_phase *p, uint32_t phase) source test_phase_advance
Section titled “test_phase_advance”void test_phase_advance(struct test_phase *p) source test_phase_is_poisoned
Section titled “test_phase_is_poisoned”bool test_phase_is_poisoned(const struct test_phase *p) source test_phase_poison
Section titled “test_phase_poison”void test_phase_poison(struct test_phase *p) source