From patchwork Sat Mar 28 08:29:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Frysinger X-Patchwork-Id: 5868 Received: (qmail 3308 invoked by alias); 28 Mar 2015 08:29:38 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 3297 invoked by uid 89); 28 Mar 2015 08:29:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.gentoo.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 28 Mar 2015 08:29:36 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 5A9DD340A9A for ; Sat, 28 Mar 2015 08:29:34 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: avr: start a basic testsuite Date: Sat, 28 Mar 2015 04:29:32 -0400 Message-Id: <1427531372-18820-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Just enough to know the sim isn't totally broken. Committed. --- sim/ChangeLog | 5 +++++ sim/configure | 1 + sim/configure.tgt | 1 + sim/testsuite/ChangeLog | 4 ++++ sim/testsuite/configure | 1 + sim/testsuite/sim/avr/ChangeLog | 3 +++ sim/testsuite/sim/avr/allinsn.exp | 15 ++++++++++++++ sim/testsuite/sim/avr/pass.s | 7 +++++++ sim/testsuite/sim/avr/testutils.inc | 41 +++++++++++++++++++++++++++++++++++++ 9 files changed, 78 insertions(+) create mode 100644 sim/testsuite/sim/avr/ChangeLog create mode 100644 sim/testsuite/sim/avr/allinsn.exp create mode 100644 sim/testsuite/sim/avr/pass.s create mode 100644 sim/testsuite/sim/avr/testutils.inc diff --git a/sim/ChangeLog b/sim/ChangeLog index 8b7fcb3..e3b0e66 100644 --- a/sim/ChangeLog +++ b/sim/ChangeLog @@ -1,3 +1,8 @@ +2015-03-28 Mike Frysinger + + * configure: Regenerate. + * configure.tgt (avr*-*-*): Set sim_testsuite=yes. + 2015-03-28 James Bowman * configure.tgt: Add FT32 entry. diff --git a/sim/configure b/sim/configure index 740042a..a40c7fd 100755 --- a/sim/configure +++ b/sim/configure @@ -3642,6 +3642,7 @@ subdirs="$subdirs arm" subdirs="$subdirs avr" + sim_testsuite=yes ;; bfin-*-*) diff --git a/sim/configure.tgt b/sim/configure.tgt index 026b81f..ce46d3f 100644 --- a/sim/configure.tgt +++ b/sim/configure.tgt @@ -22,6 +22,7 @@ case "${target}" in ;; avr*-*-*) SIM_ARCH(avr) + sim_testsuite=yes ;; bfin-*-*) SIM_ARCH(bfin) diff --git a/sim/testsuite/ChangeLog b/sim/testsuite/ChangeLog index 7580586..6b04339 100644 --- a/sim/testsuite/ChangeLog +++ b/sim/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-28 Mike Frysinger + + * configure: Regenerate. + 2015-03-28 James Bowman * configure: Regenerate. diff --git a/sim/testsuite/configure b/sim/testsuite/configure index 1dcaa41..7b91f41 100755 --- a/sim/testsuite/configure +++ b/sim/testsuite/configure @@ -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 index 0000000..a5e9c9c --- /dev/null +++ b/sim/testsuite/sim/avr/ChangeLog @@ -0,0 +1,3 @@ +2015-03-28 Mike Frysinger + + * 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 index 0000000..584a93d --- /dev/null +++ b/sim/testsuite/sim/avr/allinsn.exp @@ -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 index 0000000..fbcc485 --- /dev/null +++ b/sim/testsuite/sim/avr/pass.s @@ -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 index 0000000..95a14fc --- /dev/null +++ b/sim/testsuite/sim/avr/testutils.inc @@ -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