WIP
riscv-hs-tests
is a HS-mode test suite.
Write a test like src/test_example.c
:
#include "test_helpers.h"
void test_example(void)
{
LOG("This is a test");
ASSERT(1, "This check will pass");
ASSERT(0, "This check will fail");
}
Add it to src/all_tests.c
:
void test_example(void);
test_case all_test_cases[] = { ..., test_example };
Add it to Makefile
objects += ... test_example.o
$ make
$ qemu-system-riscv64 -M virt -kernel build/riscv-hs-tests.elf
If you want to run riscv-hs-tests
with GDB debugging, use the provided .gdbinit
file:
$ qemu-system-riscv64 -M virt -kernel build/riscv-hs-tests.elf -s -S
$ gdb
More details in the wiki.
src/printf.{c,h}
: From mpaland/printf- josecm/riscv-hyp-tests for inspiration. This suite depends on M-mode so it does not test M-mode software