test.h introduces a PLANNED_TEST() macro for C code, shows what tests are provided and so on (the nobug version did that since some time). test names are now passed as identifers and translated to strings by the macros. A lot fixes for existing tests, replace some printfs with ECHO, cosmetics. one threadpool (sync_many) test is broken and set to PLANNED, this needs further testsuite support for dispatching output. add a TEST nobug flag to test.h
45 lines
929 B
Text
45 lines
929 B
Text
|
|
TESTING "Thread Pools" ./test-threadpool
|
|
|
|
PLANNED "create"
|
|
PLANNED "yield"
|
|
PLANNED "cancel"
|
|
|
|
TEST "Most basic threadpool test" threadpool-basic <<END
|
|
END
|
|
|
|
TEST "process a function" process-function <<END
|
|
err: the input to the function is
|
|
err: the result is 1
|
|
END
|
|
|
|
TEST "acquire two threads" two-thread-acquire <<END
|
|
err: start by initializing the threadpool
|
|
err: acquiring thread 1
|
|
err: acquiring thread 2
|
|
err: thread 1 state=IDLE
|
|
err: thread 2 state=IDLE
|
|
err: cleaning up
|
|
END
|
|
|
|
TEST "many sleepy threads" many-sleepy-threads <<END
|
|
END
|
|
|
|
TEST "simple sync" simple-sync <<END
|
|
err: syncing with the other thread
|
|
err: result is 0
|
|
END
|
|
|
|
# Broken, needs better test drive (planned features for dispatching output)
|
|
PLANNED "sync many" sync-many <<END
|
|
err(worker_): result is 0
|
|
err(thread_1): value is 84
|
|
END
|
|
|
|
TEST "joinable thread" joinable-thread <<END
|
|
END
|
|
|
|
TEST "sync joinable" sync-joinable <<END
|
|
END
|
|
|
|
PLANNED "error cleared on join"
|