test: Add test for metavalues
authorMichael Neuling <mikey@neuling.org>
Thu, 28 Jul 2022 05:29:25 +0000 (15:29 +1000)
committerMichael Neuling <mikey@neuling.org>
Thu, 28 Jul 2022 05:39:31 +0000 (15:39 +1000)
Make sure they don't increase in future

Signed-off-by: Michael Neuling <mikey@neuling.org>
15 files changed:
scripts/run_test_console.sh
tests/test_decrementer.metavalue [new file with mode: 0644]
tests/test_fpu.metavalue [new file with mode: 0644]
tests/test_illegal.metavalue [new file with mode: 0644]
tests/test_misc.metavalue [new file with mode: 0644]
tests/test_mmu.metavalue [new file with mode: 0644]
tests/test_modes.metavalue [new file with mode: 0644]
tests/test_pmu.metavalue [new file with mode: 0644]
tests/test_privileged.metavalue [new file with mode: 0644]
tests/test_reservation.metavalue [new file with mode: 0644]
tests/test_sc.metavalue [new file with mode: 0644]
tests/test_spr_read.metavalue [new file with mode: 0644]
tests/test_trace.metavalue [new file with mode: 0644]
tests/test_xics.metavalue [new file with mode: 0644]
tests/update_console_tests

index 01a89ec5dc447f389fe447cf8d9e608c4ed526bb..95c249562b2be7585d59150dec5fda936c7ea8aa 100755 (executable)
@@ -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 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_fpu.metavalue b/tests/test_fpu.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_illegal.metavalue b/tests/test_illegal.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_misc.metavalue b/tests/test_misc.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_mmu.metavalue b/tests/test_mmu.metavalue
new file mode 100644 (file)
index 0000000..a29644e
--- /dev/null
@@ -0,0 +1 @@
+144
diff --git a/tests/test_modes.metavalue b/tests/test_modes.metavalue
new file mode 100644 (file)
index 0000000..492dff0
--- /dev/null
@@ -0,0 +1 @@
+152
diff --git a/tests/test_pmu.metavalue b/tests/test_pmu.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_privileged.metavalue b/tests/test_privileged.metavalue
new file mode 100644 (file)
index 0000000..492dff0
--- /dev/null
@@ -0,0 +1 @@
+152
diff --git a/tests/test_reservation.metavalue b/tests/test_reservation.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_sc.metavalue b/tests/test_sc.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_spr_read.metavalue b/tests/test_spr_read.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_trace.metavalue b/tests/test_trace.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
diff --git a/tests/test_xics.metavalue b/tests/test_xics.metavalue
new file mode 100644 (file)
index 0000000..415196e
--- /dev/null
@@ -0,0 +1 @@
+118
index b168e8d3ca185b22e2294d77b37fdde2ad5dbc7f..d0613c8c0f17bf6cdce99ae04fded24bf6735198 100755 (executable)
@@ -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