Hazard3/test/sim/sw_testcases
Luke Wren 88fea7acfa Fix lockup on misaligned AMO. Add tests for misaligned/faulting AMOs. 2021-12-12 18:28:23 +00:00
..
include Fix lockup on misaligned AMO. Add tests for misaligned/faulting AMOs. 2021-12-12 18:28:23 +00:00
.gitignore Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
Makefile Fix lockup on misaligned AMO. Add tests for misaligned/faulting AMOs. 2021-12-12 18:28:23 +00:00
Readme.md Add IRQ tests. Disable waves by default in runtests 2021-12-12 15:53:04 +00:00
amo_fault.c Fix lockup on misaligned AMO. Add tests for misaligned/faulting AMOs. 2021-12-12 18:28:23 +00:00
amo_misalign.c Fix lockup on misaligned AMO. Add tests for misaligned/faulting AMOs. 2021-12-12 18:28:23 +00:00
amo_smoke.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
amo_smoke.gtkw Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
amo_timer_irq.c Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
amo_timer_irq.gtkw Illegal instruction test 2021-12-10 00:11:18 +00:00
cleantests Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
csr_id.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
csr_mcycle.c Similarly for minstret 2021-12-11 22:25:12 +00:00
csr_minstret.c Similarly for minstret 2021-12-11 22:25:12 +00:00
csr_readable.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
csr_writable.c Add CSR writable test 2021-12-12 14:23:34 +00:00
ebreak.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
ecall_simple.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
ecall_simple.gtkw Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
hellow.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
illegal_instr.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
instr_access_fault.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
irq_individual_enable.c Add IRQ tests. Disable waves by default in runtests 2021-12-12 15:53:04 +00:00
irq_individual_pend.c Add IRQ tests. Disable waves by default in runtests 2021-12-12 15:53:04 +00:00
irq_set_all.c Add IRQ tests. Disable waves by default in runtests 2021-12-12 15:53:04 +00:00
load_misalign_halfword.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
load_misalign_word.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
load_store_fault.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
lr_sc_bypass.c Add test for lr/sc RAW stalls 2021-12-11 19:16:41 +00:00
lr_sc_fault.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
lr_sc_smoke.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
lr_sc_smoke.gtkw Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00
runtests Add IRQ tests. Disable waves by default in runtests 2021-12-12 15:53:04 +00:00
soft_irq.c Allow IRQs to be set/cleared by sw in tb. Add soft IRQ test 2021-12-12 14:58:50 +00:00
store_misalign_halfword.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
store_misalign_word.c Add test for readability of all implemented CSRs 2021-12-11 17:50:12 +00:00
wfi_loop.c Move expected_output into tests inline 2021-12-11 16:58:25 +00:00
wfi_loop.expected_output Add test script to make it easier to add software testcases 2021-12-09 22:25:18 +00:00

Readme.md

Software Testcases

A smorgasbord of software testcases for various features and cases that aren't well-covered by upstream tests such as riscv-arch-test, the riscv-test end-to-end debug tests or riscv-formal. Each test consists of one C file.

Some tests have an expected text output associated with them -- the test passes if this text output matches, and main() exits with a zero return code. Other tests are completely self-checking, reporting pass/fail only with the return code from main(). This means there is no point running these tests if the processor is in a fundamentally broken state (e.g. doesn't pass ISA compliance) and can't be trusted to check itself.

For example, hellow.c:

#include "tb_cxxrtl_io.h"

/*EXPECTED-OUTPUT***************************************************************

Hello world from Hazard3 + CXXRTL!

*******************************************************************************/

int main() {
	tb_puts("Hello world from Hazard3 + CXXRTL!\n");
	return 0;
}

The contents of the EXPECTED-OUTPUT comment is simply compared with the logged text from tb_puts, tb_printf etc. Tests might log a range of output here, such as mcause values in exceptions. The contents of this comment may have inline // comments embedded within, and these are stripped by the test script before comparing with the output. This is useful if some of the test output requires some brief inline explanation in the test source.

To run the tests:

./runtests

This will first rebuild the simulator (../tb_cxxrtl/) if needed, then build and run all the software testcases, then print out a summary of test pass/fail status. The ./run_tests executable itself returns a successful exit code if and only if all tests passed. A printf log will be created for each test, with the same name as the test, at tmp/test_name.log.

VCD waveform dumping is not enabled by default, because tests run faster without waves, and dumping waves for all tests uses > 1 GB of disk space. To re-run a failing test and get wave output, run:

make APP=test_name

This creates a VCD file at tmp/test_name_run.vcd.

To clean up the junk:

./cleantests