aboutsummaryrefslogtreecommitdiff
path: root/tests/cpu_trap
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-01-01 20:46:28 +0100
committerKarel Kočí <cynerd@email.cz>2018-01-01 20:47:36 +0100
commitbcb508498caa64a7c92a1c11bc85acdefa6209cc (patch)
tree786f6dc5d110c7984b3fddcbcd7c0683239fe9ac /tests/cpu_trap
parent128ce1ee2115b54d43db1334e12410b1cc216f10 (diff)
downloadqtmips-bcb508498caa64a7c92a1c11bc85acdefa6209cc.tar.gz
qtmips-bcb508498caa64a7c92a1c11bc85acdefa6209cc.tar.bz2
qtmips-bcb508498caa64a7c92a1c11bc85acdefa6209cc.zip
Add cpu_trap test
Diffstat (limited to 'tests/cpu_trap')
-rw-r--r--tests/cpu_trap/Makefile5
-rwxr-xr-xtests/cpu_trap/test.sh14
-rw-r--r--tests/cpu_trap/trap.S8
3 files changed, 27 insertions, 0 deletions
diff --git a/tests/cpu_trap/Makefile b/tests/cpu_trap/Makefile
new file mode 100644
index 0000000..920fa45
--- /dev/null
+++ b/tests/cpu_trap/Makefile
@@ -0,0 +1,5 @@
+include ../test.mk
+
+SRC_cpu_trap = trap.S
+
+$(eval $(call MIPS_ELF,cpu_trap))
diff --git a/tests/cpu_trap/test.sh b/tests/cpu_trap/test.sh
new file mode 100755
index 0000000..430af14
--- /dev/null
+++ b/tests/cpu_trap/test.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+TEST_NAME="cpu_trap"
+
+# Load common test shell functions
+. "$(dirname "$0")/../test.sh"
+
+# Build cli binary
+qtmips_make sub-qtmips_cli
+
+# Compile mips binary
+mips_make_test
+
+# Run test
+qtmips_run qtmips_cli/qtmips_cli --fail-match O "$TEST_DIR/cpu_trap"
diff --git a/tests/cpu_trap/trap.S b/tests/cpu_trap/trap.S
new file mode 100644
index 0000000..9581f7e
--- /dev/null
+++ b/tests/cpu_trap/trap.S
@@ -0,0 +1,8 @@
+.text
+.globl _start
+
+_start:
+ addi $1, $0, 1
+loop:
+ add $1, $1, $1
+ j loop