Testing

Test programs for QEMU and the host port.

The tests in examples/ are standalone programs. Each one prints PASS or FAIL for every case over UART, or to stdout on the host. The same sources build for Cortex-M and for the host port.

Test programs

Program Cases
test_scheduler Priority ordering. Round-robin at equal priority. Preemption of a task that never yields.
test_semaphore Take and give. Timeout. Give beyond the maximum. Give waking a blocked waiter.
test_mutex Lock and unlock. Timeout. Priority inheritance. Rejection from interrupt context.
test_mqueue Send and receive in FIFO order. Sender blocked on a full queue. Receive timeout on an empty queue.
test_sleep_list Wake-up in deadline order. Several tasks woken by one alarm.
test_pool Allocate, free and reuse. Exhaustion. Double free.
test_task_delete Delete a task and create a new one in the freed slot.

On QEMU

Target Program
chorus test test_task_delete.elf
chorus test-scheduler test_scheduler.elf
chorus test-semaphore test_semaphore.elf
chorus test-mutex test_mutex.elf
chorus test-mqueue test_mqueue.elf
chorus test-sleep-list test_sleep_list.elf
chorus test-pool test_pool.elf

Each target builds the ELF and starts it on lm3s6965evb. Exit with Ctrl+A, then X.

On the host

The host build compiles the kernel with the system gcc against arch/host-x86-64 and defines BR_HOST_TEST. It needs Linux with ucontext.h.

Build every host binary:

chorus host

Run one:

Target Binary
chorus run-host bedrock_example_host
chorus test-host test_task_delete_host
chorus test-scheduler-host test_scheduler_host
chorus test-semaphore-host test_semaphore_host
chorus test-mutex-host test_mutex_host
chorus test-mqueue-host test_mqueue_host
chorus test-sleep-list-host test_sleep_list_host
chorus test-pool-host test_pool_host

The run targets stop each binary after 5 seconds with timeout and always exit with status 0. Check the output for FAIL.

test_pool_host links only the pool allocator and the host UART, without the kernel.

Continuous integration

There is no CI pipeline yet. It is planned for 0.1.0, see the roadmap.