Library for creating and running tests for seL4.
Small unit tests can be defined anywhere, such as libraries outside of sel4test
or in sel4test-driver
. Larger tests that do things like creating processes need to be declared inside sel4test-tests
.
To define a small unit test in a library outside of sel4test
or in sel4test-driver
:
- Declare
libsel4test
as a dependency for your library and include<sel4test/test.h>
. You may also find the functions in<sel4test/testutil.h>
handy. - Write your tests. Then, for each test you want to run, call one of the macros that define a test, such as the
DEFINE_TEST
macro. They are declared here. - Add your library as dependency to
libsel4testsupport
. Add a call to any function in your test file totestreporter.c
indummy_func()
. If you have multiple test files, then you need to call one function for each test file.
For an example, take a look at libsel4serialserver/src/test.c
in sel4_libs
.
Currently unit tests are assumed to be running sequentially, standalone (i.e. not multi-threaded). Some tests rely on being the highest priority running thread in the system.
To define a larger test in sel4test-tests
:
- Place your test in
apps/sel4test-tests/src/tests
. - Include
<../helpers.h>
. - Write your tests. Then, for each test you want to run, call one of the macros that define a test,
such as the
DEFINE_TEST
macro. They are declared here.
For an example, take a look at trivial.c
in sel4test
.
The files in this repository are release under standard open source licenses. Please see individual file headers and the LICENSE_BSD2
.txt file for details.