Reorganized test hierarchy to categorize tests.
authorKen Raeburn <raeburn@cygnus>
Mon, 10 May 1993 18:58:50 +0000 (18:58 +0000)
committerKen Raeburn <raeburn@cygnus>
Mon, 10 May 1993 18:58:50 +0000 (18:58 +0000)
New test procs support examining listing output from assembler.
New tests added.

29 files changed:
gas/testsuite/.Sanitize
gas/testsuite/Makefile.in
gas/testsuite/config/unix-gas.exp
gas/testsuite/gas/.Sanitize
gas/testsuite/gas/all/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/all/comment.s [new file with mode: 0644]
gas/testsuite/gas/all/p2425.s [moved from gas/testsuite/gas/p2425.s with 100% similarity]
gas/testsuite/gas/all/x930509.s [new file with mode: 0644]
gas/testsuite/gas/gas.exp [deleted file]
gas/testsuite/gas/ieee.fp/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/ieee.fp/x930509a.exp [new file with mode: 0644]
gas/testsuite/gas/ieee.fp/x930509a.s [new file with mode: 0644]
gas/testsuite/gas/m68k-coff/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/m68k-coff/confidential/p2411.s [moved from gas/testsuite/gas/p2411.s with 100% similarity]
gas/testsuite/gas/m68k-coff/gas.exp [new file with mode: 0644]
gas/testsuite/gas/m68k-coff/p2389.s [moved from gas/testsuite/gas/p2389.s with 100% similarity]
gas/testsuite/gas/m68k-coff/p2389a.s [moved from gas/testsuite/gas/p2389a.s with 100% similarity]
gas/testsuite/gas/m68k-coff/p2430.s [moved from gas/testsuite/gas/p2430.s with 100% similarity]
gas/testsuite/gas/m68k-coff/p2430a.s [moved from gas/testsuite/gas/p2430a.s with 100% similarity]
gas/testsuite/gas/m68k-coff/t1.s [moved from gas/testsuite/gas/t1.s with 100% similarity]
gas/testsuite/gas/m68k/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/m68k/p2663.s [new file with mode: 0644]
gas/testsuite/gas/m68k/t2.s [moved from gas/testsuite/gas/t2.s with 100% similarity]
gas/testsuite/gas/p2425a.s [deleted file]
gas/testsuite/gas/sparc-solaris/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/sparc-solaris/gas.exp [new file with mode: 0644]
gas/testsuite/gas/sparc-solaris/sol-cc.s [moved from gas/testsuite/gas/sol-cc.s with 100% similarity]
gas/testsuite/gas/sparc-solaris/sol-gcc.s [moved from gas/testsuite/gas/sol-gcc.s with 100% similarity]
gas/testsuite/gas/template [new file with mode: 0644]

index fe17f29..98f98a3 100644 (file)
@@ -24,6 +24,8 @@ Do-first:
 # called.  Directories not listed will be removed in their entirety
 # with rm -rf.
 
+# The entire "gas.confidential" directory should get deleted.
+
 Things-to-keep:
 
 ChangeLog
index 8243c9a..b134253 100644 (file)
@@ -76,6 +76,8 @@ site.exp: ./Makefile
        @echo "set target_alias ${target_alias}" >> ./tmp0
        @echo "set target_cpu ${target_cpu}" >> ./tmp0
        @echo "set target_vendor ${target_vendor}" >> ./tmp0
+       @echo "set host_triplet ${host_canonical}" >> ./tmp0
+       @echo "set target_triplet ${target_canonical}" >> ./tmp0
        @echo "set target_canonical ${target_canonical}" >> ./tmp0
        @echo "set srcdir ${srcdir}" >> ./tmp0
        @echo "set exec_prefix ${exec_prefix}" >> ./tmp0
@@ -87,7 +89,7 @@ site.exp: ./Makefile
        @rm -f ./tmp1 ./tmp0
 
 check:  site.exp
-       $(RUNTEST) $(RUNTESTFLAGS) --tool gas AS=$(AS_FOR_TARGET)
+       $(RUNTEST) $(RUNTESTFLAGS) --tool gas AS=$(AS_FOR_TARGET) ASFLAGS=
 
 force:
 
index b52d970..f6a7a2a 100644 (file)
@@ -24,21 +24,16 @@ Do-first:
 # called.  Directories not listed will be removed in their entirety
 # with rm -rf.
 
-# Currently, p2411.s and p2425a.s should be sanitized away.
-# All else should stay.
-
 Things-to-keep:
 
-gas.exp
-p2389.s
-p2389a.s
-p2425.s
-p2430.s
-p2430a.s
-sol-cc.s
-sol-gcc.s
-t1.s
-t2.s
+all
+i386-bsd
+ieee.fp
+m68k
+m68k-coff
+sparc
+sparc-solaris
+template
 
 Do-last:
 
diff --git a/gas/testsuite/gas/all/.Sanitize b/gas/testsuite/gas/all/.Sanitize
new file mode 100644 (file)
index 0000000..98aa749
--- /dev/null
@@ -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
+comment.s
+p2425.s
+x930509.s
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/all/comment.s b/gas/testsuite/gas/all/comment.s
new file mode 100644 (file)
index 0000000..76bc641
--- /dev/null
@@ -0,0 +1,3 @@
+# This test file is to see whether comments get written into listings
+# correctly.  The file has no real contents.
+/* C comments too! */
diff --git a/gas/testsuite/gas/all/x930509.s b/gas/testsuite/gas/all/x930509.s
new file mode 100644 (file)
index 0000000..6d04aa5
--- /dev/null
@@ -0,0 +1,3 @@
+       .long L1-L2
+L1:    .long 0x1234
+L2:    .long 0x5678
diff --git a/gas/testsuite/gas/gas.exp b/gas/testsuite/gas/gas.exp
deleted file mode 100644 (file)
index 9816cc7..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-# syntax:
-#
-# gas_test_stdout args regexp testname
-#      looks for regexp on stdout
-#
-# gas_test args testname
-#      just checks that exit status is zero
-#
-
-gas_init
-
-# List of optional assembler options that are likely to alter the assembler's
-# behavior.  Keep this set small, since its power set generates the list of
-# test cases run.  Suggested: listings (shouldn't affect outcome drastically
-# but does), pic?, ...
-set stdoptlist "-a>"
-
-#
-# Target-independent tests
-#
-
-gas_test "p2425.s" "" $stdoptlist "pcrel values in assignment"
-
-#
-# Some m68k-coff tests
-#
-if [istarget m68*-*-coff] then {
-    gas_test "p2430.s" "" $stdoptlist "local branch not in text section"
-
-    gas_test "p2430a.s" "" $stdoptlist "local branch not in text section"
-
-    gas_test "t1.s" "" $stdoptlist "multiple .file directives"
-
-    gas_test "p2389.s" "" $stdoptlist "bss fill"
-    gas_test_error "p2389a.s" "" "detect bss fill with non-zero data"
-
-    if [file exists "$testdir/p2411.s"] then {
-       gas_test "p2411.s" "" $stdoptlist "PR 2411"
-    }
-}
-
-#
-# Some generic m68k tests
-#
-if [istarget m68*-*-*] then {
-    #
-    # Operand size dependent on offset computed using operand size
-    #
-    if [file exists "$testdir/p2425a.s"] then {
-       gas_test "p2425a.s" "" $stdoptlist "PR 2425"
-    }
-
-    gas_test "t2.s" "" $stdoptlist "cross-section branch"
-}
-
-#
-# Solaris-2 on SPARC tests
-#
-# The two compilers, cc and gcc, generate quite different debugging
-# records.  Verify that we can accept both.
-#
-if [istarget sparc-*-solaris2*] then {
-    gas_test "sol-cc.s"  "" $stdoptlist "SPARC Solaris cc -g"
-    gas_test "sol-gcc.s" "" $stdoptlist "SPARC Solaris gcc -g"
-}
diff --git a/gas/testsuite/gas/ieee.fp/.Sanitize b/gas/testsuite/gas/ieee.fp/.Sanitize
new file mode 100644 (file)
index 0000000..6dfe50e
--- /dev/null
@@ -0,0 +1,34 @@
+# 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:
+
+x930509a.exp
+x930509a.s
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/ieee.fp/x930509a.exp b/gas/testsuite/gas/ieee.fp/x930509a.exp
new file mode 100644 (file)
index 0000000..53b13b5
--- /dev/null
@@ -0,0 +1,21 @@
+# Reported 93/05/09 by Jim Wilson: IEEE single-precision FLT_MIN value gets
+# assembled incorrectly.  (Off by one ulp.)
+
+proc dotest {} {
+    set testname "IEEE FLT_MIN, single-precision"
+    set x 0
+    gas_start "x930509a.s" "-al"
+    while 1 {
+       expect {
+           -re " 00008000 +.single" { pass $testname; set x 1 }
+           -re " ........ +.single" { fail $testname; set x 1 }
+           -re "\[^\n\]*\n" { }
+           timeout { error "timeout\n"; break }
+           eof { break }
+       }
+    }
+    gas_finish
+    if !$x then { fail "$testname (listing didn't match)" }
+}
+
+dotest
diff --git a/gas/testsuite/gas/ieee.fp/x930509a.s b/gas/testsuite/gas/ieee.fp/x930509a.s
new file mode 100644 (file)
index 0000000..4a8d730
--- /dev/null
@@ -0,0 +1,5 @@
+        .global _flt_min
+.data
+        .align 4
+_flt_min:
+        .single 0r1.17549435e-38
diff --git a/gas/testsuite/gas/m68k-coff/.Sanitize b/gas/testsuite/gas/m68k-coff/.Sanitize
new file mode 100644 (file)
index 0000000..4ec325f
--- /dev/null
@@ -0,0 +1,38 @@
+# 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
+p2389.s
+p2389a.s
+p2430.s
+p2430a.s
+t1.s
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/m68k-coff/gas.exp b/gas/testsuite/gas/m68k-coff/gas.exp
new file mode 100644 (file)
index 0000000..aa069fa
--- /dev/null
@@ -0,0 +1,14 @@
+#
+# Some m68k-coff tests
+#
+if [istarget m68*-*-coff] then {
+    gas_test "p2430.s" "" $stdoptlist "local branch not in text section"
+
+    gas_test "p2430a.s" "" $stdoptlist "local branch not in text section"
+
+    gas_test "t1.s" "" $stdoptlist "multiple .file directives"
+
+    gas_test "p2389.s" "" $stdoptlist "bss fill"
+    gas_test_error "p2389a.s" "" "detect bss fill with non-zero data"
+
+}
diff --git a/gas/testsuite/gas/m68k/.Sanitize b/gas/testsuite/gas/m68k/.Sanitize
new file mode 100644 (file)
index 0000000..5d0fbc5
--- /dev/null
@@ -0,0 +1,35 @@
+# 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:
+
+all.exp
+p2663.s
+t2.s
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/m68k/p2663.s b/gas/testsuite/gas/m68k/p2663.s
new file mode 100644 (file)
index 0000000..9f3650f
--- /dev/null
@@ -0,0 +1,16 @@
+|
+| This code generates an incorrect pc relative offset 
+|
+bug:       movel  #4,%d7
+           jsr    table(%pc,%d7.w)            | wrong
+           jsr    %pc@(table-.-2:b,%d7:w)     | correct but cryptic
+           nop
+           nop
+table:
+           bra    junk
+           bra    junk
+           bra    junk
+
+junk:
+    nop
+    rts
diff --git a/gas/testsuite/gas/p2425a.s b/gas/testsuite/gas/p2425a.s
deleted file mode 100644 (file)
index 261c868..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-WORDSIZE=4
-
-       .text
-       .globl _doworm
-
-_doworm:
-       moveml %a2-%a4,%sp@-
-       movl _memsize,%d0
-       subl #CODESIZE,%d0
-       addl  #0x0,%d0
-       movl %d0,%a3
-       movl %a3,%a4
-       addl #WORMSIZE,%a4
-       movl #CODESIZE,%sp@-
-       movl %a3,%sp@-
-       movl #worm,%sp@-
-       jsr _bcopy
-       addl #12,%sp
-       movl %a4,%a0
-       subl #WORDSIZE,%a0
-       movl %sp@(16),%a0@
-       jsr %a3@
-       moveml %sp@+,%a2-%a4
-       rts
-
-
-worm:
-       jsr _t_disable
-       movl #LONGWORMSIZE,%d0
-       movl %a3,%a0
-       movl #worm,%a2
-       lea %a3@(-WORDSIZE),%a1
-crawl:
-       movl %a0@+,%a1@
-       cmpml %a1@+,%a2@+
-       dbne %d0,crawl
-       jsr _t_enable
-       subl #WORDSIZE,%a3
-       jmp %a4@
-       nop
-       .long 0
-WORMSIZE=.-worm
-LONGWORMSIZE=WORMSIZE/4
-
-
-manager:
-       tstw %d0
-       bgt manerr
-       cmpl _baseaddr,%a3
-       beq manfin
-       jmp %a3@
-manerr:
-       cmpw #1,_noiselevel
-       blt manerr1
-       movl %a1,%d1
-       subl #4,%d1
-       movl %d1,%sp@-
-       movl %d0,%sp@-
-       pea errmsg
-       jsr _printf
-       addl #12,%sp
-manerr1:
-       moveq #0,%d0
-       bra manret
-manfin:
-       moveq #1,%d0
-manret:
-       rts
-       nop
-CODESIZE=.-worm
-
-errmsg: .asciz " Premature termination (%d) at %#x"
diff --git a/gas/testsuite/gas/sparc-solaris/.Sanitize b/gas/testsuite/gas/sparc-solaris/.Sanitize
new file mode 100644 (file)
index 0000000..3b4e44a
--- /dev/null
@@ -0,0 +1,35 @@
+# 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
+sol-cc.s
+sol-gcc.s
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/sparc-solaris/gas.exp b/gas/testsuite/gas/sparc-solaris/gas.exp
new file mode 100644 (file)
index 0000000..63af691
--- /dev/null
@@ -0,0 +1,10 @@
+#
+# Solaris-2 on SPARC tests
+#
+# The two compilers, cc and gcc, generate quite different debugging
+# records.  Verify that we can accept both.
+#
+if [istarget sparc-*-solaris2*] then {
+    gas_test "sol-cc.s"  "" $stdoptlist "SPARC Solaris cc -g"
+    gas_test "sol-gcc.s" "" $stdoptlist "SPARC Solaris gcc -g"
+}
diff --git a/gas/testsuite/gas/template b/gas/testsuite/gas/template
new file mode 100644 (file)
index 0000000..41c4dc9
--- /dev/null
@@ -0,0 +1,96 @@
+#
+# This is sort of a prototype test case, which parses the listing output
+# from the assembler.  Later, more prototypes should be added for cases
+# where objdump gets run over the .o file, and anything else like that...
+#
+# When you write a test case that uses the listing output, just copy this
+# file (trimming down the overly-verbose comments a little), and
+# adjust it to do what you need.
+#
+# Remember that any ".exp" file found in the tree will be processed by
+# dejagnu.
+
+#
+# FIRST SAMPLE TEST CASE
+#
+
+proc do_foo {} {
+# This string is used below when printing out a success or failure message.
+# If more than one test is run by a given .exp file, it'd be nice to include
+# the name of the input file.
+    set testname "foo.s: multi-register tweaking and frobnication"
+
+# I use this as a flag to record whether the test case passed.  If this
+# flag is still clear when EOF is reached, this test fails.  If there are
+# two or more patterns, and I need to see all of them, I'll create N variables
+# and check if the sum is N.
+    set x 0
+
+# Call gas_start with two arguments: The input file name (which it'll search
+# for in $srcdir/$subdir, that is, the source directory where the .exp file
+# is), and a (possibly empty) string of options to pass to the assembler.
+    gas_start "foo.s" "-al"
+
+# Now I just iterate over all the output lines, looking for what I want
+# to see.  Since each pattern explicitly will not span line breaks, there's
+# also a pattern for lines that don't match anything else.   (Is it safe to
+# use ".*" for patterns not crossing line breaks? I don't think "$" does the
+# right thing for that, in any case.  I should check into whether the extra
+# pattern is even needed.
+
+# Apparently CRLF is received when using ptys for subprocesses; hence the
+# \r\n for matching line number 3.
+
+# Note that if you use "{ ... }" for the expect clause, you can't have
+# comments inside it.
+
+# This test case is kinda bogus in that seeing either a word of all zeros
+# at address zero or a C-style comment on line three that says "Looking for
+# C comments" (with very specific punctuation and whitespace) will cause
+# it to pass this test.  Usually 
+    while 1 {
+       expect {
+           -re "^ +\[0-9\]+ 0000 00000000\[^\n\]*\n"           { set x 1 }
+           -re "^ +3\[ \t\]+/. Looking for C comments. ./\r\n" { set x 1 }
+           -re "\[^\n\]*\n"                            { }
+           timeout                             { error "timeout\n"; break }
+           eof                                 { break }
+       }
+    }
+# This was intended to do any cleanup necessary.  It kinda looks like it isn't
+# needed, but just in case, please keep it in for now.
+    gas_finish
+
+# Did we find what we were looking for?  If not, flunk it.
+    if $x then { pass $testname } else { fail $testname }
+}
+
+# Now actually run the test.  It can be conditionalized if the test is
+# not appropriate for all targets.  The proc "istarget" checks a generalized
+# form of the target name, so that (e.g.) "m68332-unknown-aout" would match
+# here.  So far, I think only the CPU name is actually ever altered.
+if [istarget m68k-*] then {
+    do_foo
+}
+
+
+
+
+#
+# SECOND SAMPLE TEST CASE
+#
+
+# This is a tiny bit like the C compiler torture tests, in that it'll run
+# the assembler with the power set of the list of options supplied.
+#
+# The first argument is the test file name; the second is arguments that
+# are always to be provided; the third is a space-separated list of options
+# which are optional (ending in ">" if output should be ignored, like "-a>");
+# the fourth is the name of the test.  So far, only binary options are handled
+# this way; N-way options (like CPU type for m68k) aren't handled yet.
+#
+# The variable $stdoptlist usually has a reasonable set of optional options
+# for this target.
+
+# No, PIC isn't supported yet.  This is only an example.
+gas_test "quux.s" "-K" $stdoptlist "use of quuxes in PIC mode"