sim: avr: start a basic testsuite

Just enough to know the sim isn't totally broken.
This commit is contained in:
Mike Frysinger 2015-03-28 04:28:46 -04:00
parent 510d27512c
commit eca5fe422e
9 changed files with 78 additions and 0 deletions

View 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.

1
sim/configure vendored
View File

@ -3642,6 +3642,7 @@ subdirs="$subdirs arm"
subdirs="$subdirs avr"
sim_testsuite=yes
;;
bfin-*-*)

View File

@ -22,6 +22,7 @@ case "${target}" in
;;
avr*-*-*)
SIM_ARCH(avr)
sim_testsuite=yes
;;
bfin-*-*)
SIM_ARCH(bfin)

View 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.

View File

@ -1829,6 +1829,7 @@ case "${target}" in
;;
avr*-*-*)
sim_arch=avr
sim_testsuite=yes
;;
bfin-*-*)
sim_arch=bfin

View File

@ -0,0 +1,3 @@
2015-03-28 Mike Frysinger <vapier@gentoo.org>
* pass.s, allinsn.exp, testutils.inc: New files.

View File

@ -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
}
}

View File

@ -0,0 +1,7 @@
# check that the sim doesn't die immediately.
# mach: avr
.include "testutils.inc"
start
pass

View File

@ -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