From f70a4714c9e5eb00563878d1f764570828700e87 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 29 Mar 1993 13:27:13 +0000 Subject: [PATCH] First crack at a test suite. --- gas/.Sanitize | 6 +- gas/configure.in | 19 +++--- gas/testsuite/.Sanitize | 37 +++++++++++ gas/testsuite/Makefile.in | 104 ++++++++++++++++++++++++++++++ gas/testsuite/config/.Sanitize | 33 ++++++++++ gas/testsuite/config/unix-gas.exp | 1 + gas/testsuite/configure.in | 18 ++++++ gas/testsuite/gas/.Sanitize | 36 +++++++++++ gas/testsuite/gas/gas.exp | 38 +++++++++++ gas/testsuite/gas/p2425.s | 6 ++ gas/testsuite/gas/p2430.s | 3 + gas/testsuite/gas/t1.s | 36 +++++++++++ gas/testsuite/lib/.Sanitize | 33 ++++++++++ gas/testsuite/lib/gas-defs.exp | 69 ++++++++++++++++++++ 14 files changed, 430 insertions(+), 9 deletions(-) create mode 100644 gas/testsuite/.Sanitize create mode 100644 gas/testsuite/Makefile.in create mode 100644 gas/testsuite/config/.Sanitize create mode 100644 gas/testsuite/config/unix-gas.exp create mode 100644 gas/testsuite/configure.in create mode 100644 gas/testsuite/gas/.Sanitize create mode 100644 gas/testsuite/gas/gas.exp create mode 100644 gas/testsuite/gas/p2425.s create mode 100644 gas/testsuite/gas/p2430.s create mode 100644 gas/testsuite/gas/t1.s create mode 100644 gas/testsuite/lib/.Sanitize create mode 100644 gas/testsuite/lib/gas-defs.exp diff --git a/gas/.Sanitize b/gas/.Sanitize index 86f408a09dd..353297a95b1 100644 --- a/gas/.Sanitize +++ b/gas/.Sanitize @@ -85,6 +85,7 @@ symbols.c symbols.h tc.h testscripts +testsuite version.c write.c write.h @@ -107,7 +108,10 @@ fi # # # $Log$ -# Revision 1.15 1993/02/13 10:12:16 zoo +# Revision 1.16 1993/03/29 13:26:44 raeburn +# First crack at a test suite. +# +# Revision 1.15 1993/02/13 10:12:16 zoo # removing excess verbosity # # Revision 1.14 1993/01/08 14:40:59 raeburn diff --git a/gas/configure.in b/gas/configure.in index 22d9833f341..3ce9d81b1cf 100644 --- a/gas/configure.in +++ b/gas/configure.in @@ -30,7 +30,7 @@ srctrigger=as.c srcname="gas" need_bfd=no -configdirs=doc +configdirs="doc testsuite" # per-host: @@ -45,9 +45,9 @@ case "${host}" in esac ;; mips-dec-ultrix) - gas_host=decstation + gas_host=decstatn ;; - mips-*-bsd) + mips-*-bsd*) gas_host=mipsbsd ;; i[34]86-ibm-aix*) @@ -101,12 +101,15 @@ case ${target_cpu} in sparc64) cpu_type=sparc obj_format=aout ;; m680[01234]0) cpu_type=m68k ;; m683??) cpu_type=m68k ;; + i486) cpu_type=i386 ;; esac gas_target=${cpu_type} +generic_target=${cpu_type}-${target_vendor}-${target_os} + # assign object format -case ${target} in +case ${generic_target} in a29k-amd-udi) obj_format=coffbfd need_bfd=yes @@ -122,21 +125,21 @@ case ${target} in need_bfd=yes gas_target=ebmon29k ;; - i[34]86-ibm-aix*) + i386-ibm-aix*) obj_format=coffbfd need_bfd=yes gas_target=i386coff emulation=i386aix ;; - i[34]86-*-bsd*) + i386-*-bsd*) obj_format=aout ;; - i[34]86-*-coff | i[34]86-*-sysv* | i[34]86-*-sco* | i[34]86-*-isc*) + i386-*-coff | i386-*-sysv* | i386-*-sco* | i386-*-isc*) obj_format=coffbfd need_bfd=yes gas_target=i386coff ;; - i[34]86-*-go32) + i386-*-go32) obj_format=aout ;; i960-wrs-vxworks) diff --git a/gas/testsuite/.Sanitize b/gas/testsuite/.Sanitize new file mode 100644 index 00000000000..68d7272b2f6 --- /dev/null +++ b/gas/testsuite/.Sanitize @@ -0,0 +1,37 @@ +# Sanitize.in for devo. +# $Id$ +# + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Files-to-sed:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +Makefile.in +config +configure.in +gas +lib + +Do-last: + +# End of file. diff --git a/gas/testsuite/Makefile.in b/gas/testsuite/Makefile.in new file mode 100644 index 00000000000..8243c9a01b0 --- /dev/null +++ b/gas/testsuite/Makefile.in @@ -0,0 +1,104 @@ +srcdir = . +prefix = /usr/local + +exec_prefix = $(prefix) +bindir = $(exec_prefix)/bin +libdir = $(exec_prefix)/lib +tooldir = $(libdir)/$(target_alias) + +datadir = $(exec_prefix)/lib/deja-gnu +mandir = $(prefix)/man +man1dir = $(mandir)/man1 +man2dir = $(mandir)/man2 +man3dir = $(mandir)/man3 +man4dir = $(mandir)/man4 +man5dir = $(mandir)/man5 +man6dir = $(mandir)/man6 +man7dir = $(mandir)/man7 +man8dir = $(mandir)/man8 +man9dir = $(mandir)/man9 +infodir = $(prefix)/info +includedir = $(prefix)/include +gxx_includedir = $(tooldir)/g++-include +docdir = $(datadir)/doc +targetdir = $(datadir)/$(target_alias) + +SHELL = /bin/sh + +INSTALL = install -c +INSTALL_PROGRAM = $(INSTALL) +INSTALL_DATA = $(INSTALL) + +GCC = gcc +GCCFLAGS = -g -O + +LINK= ln -s + +RUNTEST = runtest +RUNTESTFLAGS = + +# The ugliness in the program_transform_name version seems necessary +# to work around some strange behavior of /bin/sh on 386bsd (0.1). +AS_FOR_TARGET = ` \ + if [ -f ../Makefile ] ; then \ + echo ../as.new ; \ + else \ + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \ + echo $(AS); \ + else \ + (set -e ; t='$(program_transform_name)'; echo as | sed -e '' $$t); \ + fi; \ + fi` + +#### host, target, and site specific Makefile frags come in here. + +all: + +.NOEXPORT: + +install: + +uninstall: force + +site.exp: ./Makefile + @echo "Making a new config file..." + -@rm -f ./tmp? + @touch site.exp + -@mv site.exp site.bak + @echo "## these variables are automatically generated by make ##" > ./tmp0 + @echo "# Do not edit here. If you wish to override these values" >> ./tmp0 + @echo "# add them to the last section" >> ./tmp0 + @echo "set host_os ${host_os}" >> ./tmp0 + @echo "set host_alias ${host_alias}" >> ./tmp0 + @echo "set host_cpu ${host_cpu}" >> ./tmp0 + @echo "set host_vendor ${host_vendor}" >> ./tmp0 + @echo "set target_os ${target_os}" >> ./tmp0 + @echo "set target_alias ${target_alias}" >> ./tmp0 + @echo "set target_cpu ${target_cpu}" >> ./tmp0 + @echo "set target_vendor ${target_vendor}" >> ./tmp0 + @echo "set target_canonical ${target_canonical}" >> ./tmp0 + @echo "set srcdir ${srcdir}" >> ./tmp0 + @echo "set exec_prefix ${exec_prefix}" >> ./tmp0 + @echo "set objdir `pwd`" >> ./tmp0 + @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0 + @cat ./tmp0 > site.exp + @cat site.bak | sed \ + -e '1,/^## All variables above are.*##/ d' >> site.exp + @rm -f ./tmp1 ./tmp0 + +check: site.exp + $(RUNTEST) $(RUNTESTFLAGS) --tool gas AS=$(AS_FOR_TARGET) + +force: + +clean: + -rm -f *~ core *.o a.out xgdb *.x a.out b.out + +distclean: clean + -rm -f *~ core + -rm -f Makefile config.status + -rm -fr *.log summary detail + +Makefile : $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag) + $(SHELL) ./config.status + diff --git a/gas/testsuite/config/.Sanitize b/gas/testsuite/config/.Sanitize new file mode 100644 index 00000000000..2674e6012b4 --- /dev/null +++ b/gas/testsuite/config/.Sanitize @@ -0,0 +1,33 @@ +# Sanitize.in for devo. +# $Id$ +# + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Files-to-sed:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +unix-gas.exp + +Do-last: + +# End of file. diff --git a/gas/testsuite/config/unix-gas.exp b/gas/testsuite/config/unix-gas.exp new file mode 100644 index 00000000000..a3b7387efba --- /dev/null +++ b/gas/testsuite/config/unix-gas.exp @@ -0,0 +1 @@ +load_lib gas-defs.exp diff --git a/gas/testsuite/configure.in b/gas/testsuite/configure.in new file mode 100644 index 00000000000..f0c67462cb7 --- /dev/null +++ b/gas/testsuite/configure.in @@ -0,0 +1,18 @@ +# This file is a shell script fragment that supplies the information +# necessary to tailor a template configure script into the configure +# script appropriate for this directory. For more information, check +# any existing configure script. + +srctrigger=Makefile.in +srcname="DejaGnu" + +# per-host: + +# per-target: + +# All the tests are run on the host, which we're assuming is unix. +# But it looks like dejagnu wants `where the tests are run' to be +# in target_abbrev. +target_abbrev=unix + +# post-target: diff --git a/gas/testsuite/gas/.Sanitize b/gas/testsuite/gas/.Sanitize new file mode 100644 index 00000000000..84be40353f9 --- /dev/null +++ b/gas/testsuite/gas/.Sanitize @@ -0,0 +1,36 @@ +# Sanitize.in for devo. +# $Id$ +# + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Files-to-sed:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +gas.exp +p2425.s +p2430.s +t1.s + +Do-last: + +# End of file. diff --git a/gas/testsuite/gas/gas.exp b/gas/testsuite/gas/gas.exp new file mode 100644 index 00000000000..003f4c66db6 --- /dev/null +++ b/gas/testsuite/gas/gas.exp @@ -0,0 +1,38 @@ +# syntax: +# +# gas_test_stdout args regexp testname +# looks for regexp on stdout +# +# gas_test args testname +# just checks that exit status is zero +# + +set testdir $srcdir/gas + +# +# Test empty file, and version number +# +#gas_test_stdout "" "GNU assembler version .* (.*)" + +# +# Target-independent tests +# + +gas_test "$testdir/p2425.s" "pcrel values in assignment" + +gas_test "-al $testdir/p2425.s" "pcrel values in assignment, with listing" + +# +# Some m68k-coff tests +# +if [istarget m68k-*-coff] then { + # + # Local branch in non-text section + # + gas_test "$testdir/p2430.s" "local branch not in text section" + + # + # Multiple (implicit) .file directives + # + gas_test "$testdir/t1.s" "multiple .file directives" +} diff --git a/gas/testsuite/gas/p2425.s b/gas/testsuite/gas/p2425.s new file mode 100644 index 00000000000..c3476a46d05 --- /dev/null +++ b/gas/testsuite/gas/p2425.s @@ -0,0 +1,6 @@ + .text + .globl _frobnitz +_frobnitz: + .long 1, 2, 3, 4, 5, 6, 7, GRUMP, 42 +GRUMP=.-_frobnitz +HALFGRUMP=GRUMP/2 diff --git a/gas/testsuite/gas/p2430.s b/gas/testsuite/gas/p2430.s new file mode 100644 index 00000000000..4ba2f160583 --- /dev/null +++ b/gas/testsuite/gas/p2430.s @@ -0,0 +1,3 @@ + .sect foo +tag: + bra tag diff --git a/gas/testsuite/gas/t1.s b/gas/testsuite/gas/t1.s new file mode 100644 index 00000000000..cc015f2a0de --- /dev/null +++ b/gas/testsuite/gas/t1.s @@ -0,0 +1,36 @@ +# 1 "libgcc1.S" +# 42 "libxyz1.S" +# 259 "libgcc1.S" + .text + .proc +|#PROC# 04 + .globl __mulsi3 + __mulsi3 : +|#PROLOGUE# 0 + link %a6 ,#0 + addl #-LF14, %sp + moveml #LS14, %sp @ +|#PROLOGUE# 1 + movew %a6 @(0x8), %d0 + muluw %a6 @(0xe), %d0 + movew %a6 @(0xa), %d1 + muluw %a6 @(0xc), %d1 + addw %d1 , %d0 + lsll #8, %d0 + lsll #8, %d0 + movew %a6 @(0xa), %d1 + muluw %a6 @(0xe), %d1 + addl %d1 , %d0 + jra LE14 +LE14: +|#PROLOGUE# 2 + moveml %sp @, #LS14 + unlk %a6 +|#PROLOGUE# 3 + rts + LF14 = 4 + LS14 = 0x0002 + LFF14 = 0 +# 354 "libgcc1.S" + LSS14 = 0x0 + LV14 = 0 diff --git a/gas/testsuite/lib/.Sanitize b/gas/testsuite/lib/.Sanitize new file mode 100644 index 00000000000..7ee4960eea8 --- /dev/null +++ b/gas/testsuite/lib/.Sanitize @@ -0,0 +1,33 @@ +# Sanitize.in for devo. +# $Id$ +# + +# Each directory to survive it's way into a release will need a file +# like this one called "./.Sanitize". All keyword lines must exist, +# and must exist in the order specified by this file. Each directory +# in the tree will be processed, top down, in the following order. + +# Hash started lines like this one are comments and will be deleted +# before anything else is done. Blank lines will also be squashed +# out. + +# The lines between the "Do-first:" line and the "Things-to-keep:" +# line are executed as a /bin/sh shell script before anything else is +# done in this + +Do-first: + + +# All files listed between the "Things-to-keep:" line and the +# "Files-to-sed:" line will be kept. All other files will be removed. +# Directories listed in this section will have their own Sanitize +# called. Directories not listed will be removed in their entirety +# with rm -rf. + +Things-to-keep: + +gas-defs.exp + +Do-last: + +# End of file. diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp new file mode 100644 index 00000000000..9669ee1e212 --- /dev/null +++ b/gas/testsuite/lib/gas-defs.exp @@ -0,0 +1,69 @@ +# Copyright (C) 1993 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# DejaGnu@cygnus.com + +# This file was written by Ken Raeburn (raeburn@cygnus.com). + +proc gas_version {} { + global AS + set tmp [exec $AS -version < /dev/null] + # Should find a way to discard constant parts, keep whatever's + # left, so the version string could be almost anything at all... + regexp " \[0-9\]\[0-9\.a-zA-Z-\]+" $tmp version + set tmp $version + regexp "\[0-9\.a-zA-Z-\]+" $tmp version + clone_output "[which $AS] version $version\n" + unset tmp + unset version +} + +proc gas_start { prog } { + global verbose + global AS + global ASFLAGS + global comp_output + + if $verbose>1 then { + send_user "Executing $AS $ASFLAGS $prog\n" + } + catch "exec $AS $ASFLAGS $prog" comp_output + if ![string match "" $comp_output] then { + send_log "$comp_output\n" + if $verbose>1 then { + send_user "$comp_output\n" + } + } +} + +proc gas_test { arg testname } { + global verbose + global comp_output + + gas_start $arg + if ![string match "" $comp_output] then { + send_log "$comp_output\n" + if $verbose>3 then { + send_user "|$comp_output|\n" + } + } + if [string match "" $comp_output] then { + pass "$testname" + } else { + fail "$testname" + } +} -- 2.30.2