sim: mcore: add a basic testsuite

This commit is contained in:
Mike Frysinger 2015-03-29 03:35:29 -04:00
parent aac18a6996
commit 36cb69e0ed
4 changed files with 77 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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