aboutsummaryrefslogtreecommitdiff
path: root/sim/testsuite
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2015-04-05 04:37:44 -0400
committerMike Frysinger <vapier@gentoo.org>2015-04-05 04:37:44 -0400
commit20cc97536046f8aa883c3fba16aa1c9a2762f183 (patch)
tree4a293e6faa972cfb8584a0c5a177ff583dabb7c2 /sim/testsuite
parent024305f7f28b3b322ae26c5c1c2d23ca6f5c11bb (diff)
downloadgdb-20cc97536046f8aa883c3fba16aa1c9a2762f183.zip
gdb-20cc97536046f8aa883c3fba16aa1c9a2762f183.tar.gz
gdb-20cc97536046f8aa883c3fba16aa1c9a2762f183.tar.bz2
sim: moxie: fix running after nrun conversion
The nrun conversion was slightly incorrect in how it stopped when an exception occurred. We still set cpu.asregs.exception, but nothing was checking it anymore. Convert all of that to sim_engine_halt. To keep things from regressing again, add a basic testsuite too.
Diffstat (limited to 'sim/testsuite')
-rw-r--r--sim/testsuite/sim/moxie/ChangeLog3
-rw-r--r--sim/testsuite/sim/moxie/allinsn.exp15
-rw-r--r--sim/testsuite/sim/moxie/pass.s7
-rw-r--r--sim/testsuite/sim/moxie/testutils.inc46
4 files changed, 71 insertions, 0 deletions
diff --git a/sim/testsuite/sim/moxie/ChangeLog b/sim/testsuite/sim/moxie/ChangeLog
new file mode 100644
index 0000000..d3f8b9d
--- /dev/null
+++ b/sim/testsuite/sim/moxie/ChangeLog
@@ -0,0 +1,3 @@
+2015-04-05 Mike Frysinger <vapier@gentoo.org>
+
+ * pass.s, allinsn.exp, testutils.inc: New files.
diff --git a/sim/testsuite/sim/moxie/allinsn.exp b/sim/testsuite/sim/moxie/allinsn.exp
new file mode 100644
index 0000000..1a6af8b
--- /dev/null
+++ b/sim/testsuite/sim/moxie/allinsn.exp
@@ -0,0 +1,15 @@
+# moxie simulator testsuite
+
+if [istarget moxie-*] {
+ # all machines
+ set all_machs "moxie"
+
+ 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/moxie/pass.s b/sim/testsuite/sim/moxie/pass.s
new file mode 100644
index 0000000..4d8e385
--- /dev/null
+++ b/sim/testsuite/sim/moxie/pass.s
@@ -0,0 +1,7 @@
+# check that the sim doesn't die immediately.
+# mach: moxie
+
+.include "testutils.inc"
+
+ start
+ pass
diff --git a/sim/testsuite/sim/moxie/testutils.inc b/sim/testsuite/sim/moxie/testutils.inc
new file mode 100644
index 0000000..dbdcf7c
--- /dev/null
+++ b/sim/testsuite/sim/moxie/testutils.inc
@@ -0,0 +1,46 @@
+# MACRO: exit
+ .macro exit nr
+ ldi.l $r0, \nr;
+ # Trap function 1: exit().
+ swi 1;
+ .endm
+
+# MACRO: pass
+# Write 'pass' to stdout and quit
+ .macro pass
+ # Use stdout.
+ ldi.b $r0, 1;
+ # Point to the string.
+ ldi.l $r1, 1f;
+ # Number of bytes to write.
+ ldi.s $r2, 5;
+ # Trap function 5: write().
+ swi 5;
+ exit 0
+ .data
+ 1: .asciz "pass\n"
+ .endm
+
+# MACRO: fail
+# Write 'fail' to stdout and quit
+ .macro fail
+ # Use stdout.
+ ldi.b $r0, 1;
+ # Point to the string.
+ ldi.l $r1, 1f;
+ # Number of bytes to write.
+ ldi.s $r2, 5;
+ # Trap function 5: write().
+ swi 5;
+ 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