From eeac86c9d8efa987e65a68dbc31541e7119a401b Mon Sep 17 00:00:00 2001 From: Michael Neuling Date: Thu, 28 Jul 2022 15:29:25 +1000 Subject: [PATCH] test: Add test for metavalues Make sure they don't increase in future Signed-off-by: Michael Neuling --- scripts/run_test_console.sh | 12 ++++++++++-- tests/test_decrementer.metavalue | 1 + tests/test_fpu.metavalue | 1 + tests/test_illegal.metavalue | 1 + tests/test_misc.metavalue | 1 + tests/test_mmu.metavalue | 1 + tests/test_modes.metavalue | 1 + tests/test_pmu.metavalue | 1 + tests/test_privileged.metavalue | 1 + tests/test_reservation.metavalue | 1 + tests/test_sc.metavalue | 1 + tests/test_spr_read.metavalue | 1 + tests/test_trace.metavalue | 1 + tests/test_xics.metavalue | 1 + tests/update_console_tests | 5 +++-- 15 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 tests/test_decrementer.metavalue create mode 100644 tests/test_fpu.metavalue create mode 100644 tests/test_illegal.metavalue create mode 100644 tests/test_misc.metavalue create mode 100644 tests/test_mmu.metavalue create mode 100644 tests/test_modes.metavalue create mode 100644 tests/test_pmu.metavalue create mode 100644 tests/test_privileged.metavalue create mode 100644 tests/test_reservation.metavalue create mode 100644 tests/test_sc.metavalue create mode 100644 tests/test_spr_read.metavalue create mode 100644 tests/test_trace.metavalue create mode 100644 tests/test_xics.metavalue diff --git a/scripts/run_test_console.sh b/scripts/run_test_console.sh index 01a89ec..95c2495 100755 --- a/scripts/run_test_console.sh +++ b/scripts/run_test_console.sh @@ -23,7 +23,15 @@ cd $TMPDIR cp ${MICROWATT_DIR}/tests/${TEST}.bin main_ram.bin -${MICROWATT_DIR}/core_tb > /dev/null 2> test1.out || true +${MICROWATT_DIR}/core_tb > console.out 2> test1.out || true + +# check metavalues aren't increasing +COUNT=$(grep -c 'metavalue' console.out) +EXP=$(cat ${MICROWATT_DIR}/tests/${TEST}.metavalue) +if [[ $COUNT -gt $EXP ]] ; then + echo "$TEST FAIL ******** metavalues increased from $EXP to $COUNT" + exit 1 +fi grep -v "Failed to bind debug socket" test1.out > test.out @@ -31,5 +39,5 @@ cp ${MICROWATT_DIR}/tests/${TEST}.console_out exp.out diff -q test.out exp.out && echo "$TEST PASS" && exit 0 -echo "$TEST FAIL ********" +echo "$TEST FAIL ******** Console output changed" exit 1 diff --git a/tests/test_decrementer.metavalue b/tests/test_decrementer.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_decrementer.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_fpu.metavalue b/tests/test_fpu.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_fpu.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_illegal.metavalue b/tests/test_illegal.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_illegal.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_misc.metavalue b/tests/test_misc.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_misc.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_mmu.metavalue b/tests/test_mmu.metavalue new file mode 100644 index 0000000..a29644e --- /dev/null +++ b/tests/test_mmu.metavalue @@ -0,0 +1 @@ +144 diff --git a/tests/test_modes.metavalue b/tests/test_modes.metavalue new file mode 100644 index 0000000..492dff0 --- /dev/null +++ b/tests/test_modes.metavalue @@ -0,0 +1 @@ +152 diff --git a/tests/test_pmu.metavalue b/tests/test_pmu.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_pmu.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_privileged.metavalue b/tests/test_privileged.metavalue new file mode 100644 index 0000000..492dff0 --- /dev/null +++ b/tests/test_privileged.metavalue @@ -0,0 +1 @@ +152 diff --git a/tests/test_reservation.metavalue b/tests/test_reservation.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_reservation.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_sc.metavalue b/tests/test_sc.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_sc.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_spr_read.metavalue b/tests/test_spr_read.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_spr_read.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_trace.metavalue b/tests/test_trace.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_trace.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/test_xics.metavalue b/tests/test_xics.metavalue new file mode 100644 index 0000000..415196e --- /dev/null +++ b/tests/test_xics.metavalue @@ -0,0 +1 @@ +118 diff --git a/tests/update_console_tests b/tests/update_console_tests index b168e8d..d0613c8 100755 --- a/tests/update_console_tests +++ b/tests/update_console_tests @@ -9,6 +9,7 @@ for i in sc illegal decrementer xics privileged mmu misc modes pmu reservation t cd - cp $i/$i.bin test_$i.bin ln -s test_$i.bin main_ram.bin - ../core_tb > /dev/null 2> test_$i.console_out - rm main_ram.bin + ../core_tb > test_$i.log_out 2> test_$i.console_out + grep -c metavalue test_$i.log_out > test_$i.metavalue + rm main_ram.bin test_$i.log_out done -- 2.30.2