aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-03-29 03:35:29 -0400
committerMike Frysinger <vapier@gentoo.org>2015-03-29 04:14:27 -0400
commit36cb69e0ed76e5381c723ed4e7137bb981deafd1 (patch)
tree7467f6981aa281068575eb35a29e7f39298d1413 /sim/testsuite
parentaac18a6996e57cd1d1c32d3fd418c4950c5001bf (diff)
downloadgdb-36cb69e0ed76e5381c723ed4e7137bb981deafd1.zip
gdb-36cb69e0ed76e5381c723ed4e7137bb981deafd1.tar.gz
gdb-36cb69e0ed76e5381c723ed4e7137bb981deafd1.tar.bz2
sim: mcore: add a basic testsuite
Diffstat (limited to 'sim/testsuite')
-rw-r--r--sim/testsuite/sim/mcore/ChangeLog3
-rw-r--r--sim/testsuite/sim/mcore/allinsn.exp15
-rw-r--r--sim/testsuite/sim/mcore/pass.s7
-rw-r--r--sim/testsuite/sim/mcore/testutils.inc52
4 files changed, 77 insertions, 0 deletions
diff --git a/sim/testsuite/sim/mcore/ChangeLog b/sim/testsuite/sim/mcore/ChangeLog
new file mode 100644
index 0000000..2aa1f2c
--- /dev/null
+++ b/sim/testsuite/sim/mcore/ChangeLog
@@ -0,0 +1,3 @@
+2015-03-29 Mike Frysinger <vapier@gentoo.org>
+
+ * pass.s, allinsn.exp, testutils.inc: New files.
diff --git a/sim/testsuite/sim/mcore/allinsn.exp b/sim/testsuite/sim/mcore/allinsn.exp
new file mode 100644
index 0000000..5921cfc
--- /dev/null
+++ b/sim/testsuite/sim/mcore/allinsn.exp
@@ -0,0 +1,15 @@
+# mcore simulator testsuite
+
+if [istarget mcore-*] {
+ # all machines
+ set all_machs "mcore"
+
+ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.s]] {
+ # If we're only testing specific files and this isn't one of them,
+ # skip it.
+ if ![runtest_file_p $runtests $src] {
+ continue
+ }
+ run_sim_test $src $all_machs
+ }
+}
diff --git a/sim/testsuite/sim/mcore/pass.s b/sim/testsuite/sim/mcore/pass.s
new file mode 100644
index 0000000..92fada0
--- /dev/null
+++ b/sim/testsuite/sim/mcore/pass.s
@@ -0,0 +1,7 @@
+# check that the sim doesn't die immediately.
+# mach: mcore
+
+.include "testutils.inc"
+
+ start
+ pass
diff --git a/sim/testsuite/sim/mcore/testutils.inc b/sim/testsuite/sim/mcore/testutils.inc
new file mode 100644
index 0000000..0b82942
--- /dev/null
+++ b/sim/testsuite/sim/mcore/testutils.inc
@@ -0,0 +1,52 @@
+# MACRO: exit
+ .macro exit nr
+ movi r2, \nr
+ # The exit utility function.
+ .byte 0x00
+ # The debug insn class.
+ .byte 0x50
+ .endm
+
+# MACRO: pass
+# Write 'pass' to stdout and quit
+ .macro pass
+ # Trap function 4: write().
+ movi r1, 4;
+ # Use stdout.
+ movi r2, 1;
+ # Point to the string.
+ lrw r3, 1f;
+ # Number of bytes to write.
+ movi r4, 5;
+ # Trigger OS trap.
+ trap 1;
+ exit 0
+ .data
+ 1: .asciz "pass\n"
+ .endm
+
+# MACRO: fail
+# Write 'fail' to stdout and quit
+ .macro fail
+ # Trap function 4: write().
+ movi r1, 4;
+ # Use stdout.
+ movi r2, 1;
+ # Point to the string.
+ lrw r3, 1f;
+ # Number of bytes to write.
+ movi r4, 5;
+ # Trigger OS trap.
+ trap 1;
+ exit 0
+ .data
+ 1: .asciz "fail\n"
+ .endm
+
+# MACRO: start
+# All assembler tests should start with a call to "start"
+ .macro start
+ .text
+.global _start
+_start:
+ .endm