]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: avr: start a basic testsuite
authorMike Frysinger <vapier@gentoo.org>
Sat, 28 Mar 2015 08:28:46 +0000 (04:28 -0400)
committerMike Frysinger <vapier@gentoo.org>
Sat, 28 Mar 2015 08:28:46 +0000 (04:28 -0400)
Just enough to know the sim isn't totally broken.

sim/ChangeLog
sim/configure
sim/configure.tgt
sim/testsuite/ChangeLog
sim/testsuite/configure
sim/testsuite/sim/avr/ChangeLog [new file with mode: 0644]
sim/testsuite/sim/avr/allinsn.exp [new file with mode: 0644]
sim/testsuite/sim/avr/pass.s [new file with mode: 0644]
sim/testsuite/sim/avr/testutils.inc [new file with mode: 0644]

index 8b7fcb356f3f089c9425303074a1218b31f66f45..e3b0e665e975361703627c7ca92f2ba66a9763c3 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-28  Mike Frysinger  <vapier@gentoo.org>
+
+       * configure: Regenerate.
+       * configure.tgt (avr*-*-*): Set sim_testsuite=yes.
+
 2015-03-28  James Bowman  <james.bowman@ftdichip.com>
 
        * configure.tgt: Add FT32 entry.
index 740042a7f12e1920e86741a2edde917fa8828711..a40c7fd7c5712f22307067c3774a8c10550d68c6 100755 (executable)
@@ -3642,6 +3642,7 @@ subdirs="$subdirs arm"
   subdirs="$subdirs avr"
 
 
+       sim_testsuite=yes
        ;;
    bfin-*-*)
 
index 026b81fe92d7852e476b4da3ef19a58e8bb7c7a7..ce46d3fb2e989aba765455f11df0dcf8868ec281 100644 (file)
@@ -22,6 +22,7 @@ case "${target}" in
        ;;
    avr*-*-*)
        SIM_ARCH(avr)
+       sim_testsuite=yes
        ;;
    bfin-*-*)
        SIM_ARCH(bfin)
index 7580586c585777fa68175a963eb03dde56b97f4d..6b0433922130cba431691d31402c03e00f17906d 100644 (file)
@@ -1,3 +1,7 @@
+2015-03-28  Mike Frysinger  <vapier@gentoo.org>
+
+       * configure: Regenerate.
+
 2015-03-28  James Bowman  <james.bowman@ftdichip.com>
 
        * configure: Regenerate.
index 1dcaa410e1cfea4333b35111666c74e1f724e94f..7b91f41144918c03beb136699069d4e430661ad8 100755 (executable)
@@ -1829,6 +1829,7 @@ case "${target}" in
        ;;
    avr*-*-*)
        sim_arch=avr
+       sim_testsuite=yes
        ;;
    bfin-*-*)
        sim_arch=bfin
diff --git a/sim/testsuite/sim/avr/ChangeLog b/sim/testsuite/sim/avr/ChangeLog
new file mode 100644 (file)
index 0000000..a5e9c9c
--- /dev/null
@@ -0,0 +1,3 @@
+2015-03-28  Mike Frysinger  <vapier@gentoo.org>
+
+       * pass.s, allinsn.exp, testutils.inc: New files.
diff --git a/sim/testsuite/sim/avr/allinsn.exp b/sim/testsuite/sim/avr/allinsn.exp
new file mode 100644 (file)
index 0000000..584a93d
--- /dev/null
@@ -0,0 +1,15 @@
+# avr simulator testsuite
+
+if [istarget avr-*] {
+    # all machines
+    set all_machs "avr"
+
+    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/avr/pass.s b/sim/testsuite/sim/avr/pass.s
new file mode 100644 (file)
index 0000000..fbcc485
--- /dev/null
@@ -0,0 +1,7 @@
+# check that the sim doesn't die immediately.
+# mach: avr
+
+.include "testutils.inc"
+
+       start
+       pass
diff --git a/sim/testsuite/sim/avr/testutils.inc b/sim/testsuite/sim/avr/testutils.inc
new file mode 100644 (file)
index 0000000..95a14fc
--- /dev/null
@@ -0,0 +1,41 @@
+# MACRO: outc
+# Write byte to stdout
+       .macro outc ch
+       ldi r16, \ch
+       out 0x32, r16
+       .endm
+
+# MACRO: exit
+       .macro exit nr
+       ldi r16, \nr
+       out 0x2f, r16
+       .endm
+
+# MACRO: pass
+# Write 'pass' to stdout and quit
+       .macro pass
+       outc 'p'
+       outc 'a'
+       outc 's'
+       outc 's'
+       outc '\n'
+       exit 0
+       .endm
+
+# MACRO: fail
+# Write 'fail' to stdout and quit
+       .macro fail
+       outc 'f'
+       outc 'a'
+       outc 'i'
+       outc 'l'
+       outc '\n'
+       exit 1
+       .endm
+
+# MACRO: start
+# All assembler tests should start with a call to "start"
+       .macro start
+       .text
+__start:
+       .endm