From d193d76268b095cecc49781bc101baaecf98f009 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Mon, 28 Feb 1994 20:00:10 +0000 Subject: [PATCH] * lib/gas-defs.exp (objdump): New proc. (objdump_start): Deleted unused proc. (objdump_start_common): Merged into objdump_start_no_subdir. * gas/alpha/fp.exp: Use objdump instead of objdump_start_no_subdir, since the former actually waits for objdump to finish. Specify .rdata section only. Make comment indicate Alpha architecture rather than SPARC. * gas/alpha/fp.d: Omit .reginfo patterns. Just use "." to match against ASCII code 0x2a ("*", special in regexp). * gas/sun4/addend.exp: Use objdump instead of objdump_start_no_subdir. --- gas/testsuite/ChangeLog | 15 ++++++ gas/testsuite/gas/alpha/fp.exp | 5 +- gas/testsuite/lib/gas-defs.exp | 89 ++++++++++++++++++++++++++++------ 3 files changed, 92 insertions(+), 17 deletions(-) diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index a4f78fab984..5513c7dbfc4 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,18 @@ +Mon Feb 28 14:10:04 1994 Ken Raeburn (raeburn@cujo.cygnus.com) + + * lib/gas-defs.exp (objdump): New proc. + (objdump_start): Deleted unused proc. + (objdump_start_common): Merged into objdump_start_no_subdir. + + * gas/alpha/fp.exp: Use objdump instead of + objdump_start_no_subdir, since the former actually waits for + objdump to finish. Specify .rdata section only. Make comment + indicate Alpha architecture rather than SPARC. + * gas/alpha/fp.d: Omit .reginfo patterns. Just use "." to match + against ASCII code 0x2a ("*", special in regexp). + * gas/sun4/addend.exp: Use objdump instead of + objdump_start_no_subdir. + Thu Feb 24 07:11:57 1994 Jeffrey A. Law (law@snake.cs.utah.edu) * gas/hppa/more.parse/parse.exp (no subspace test): Only expect diff --git a/gas/testsuite/gas/alpha/fp.exp b/gas/testsuite/gas/alpha/fp.exp index 5517dcf21b9..4969f38124c 100644 --- a/gas/testsuite/gas/alpha/fp.exp +++ b/gas/testsuite/gas/alpha/fp.exp @@ -1,12 +1,11 @@ # -# SunOS4 on SPARC tests +# Alpha OSF/1 tests # if [istarget alpha-*-osf1*] then { set testname "fp constants (part 2)" if [gas_test_old "fp.s" "" "fp constants (part 1)"] then { - objdump_start_no_subdir "a.out > a.dump" "-s" - objdump_finish + objdump "-s -j .rdata > a.dump" if { [regexp_diff "a.dump" "$srcdir/$subdir/fp.d"] == 0 } then { pass $testname } else { diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp index d666f05d9c6..1ea35128922 100644 --- a/gas/testsuite/lib/gas-defs.exp +++ b/gas/testsuite/lib/gas-defs.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1993 Free Software Foundation, Inc. +# Copyright (C) 1993, 1994 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 @@ -171,30 +171,28 @@ proc gas_init {} { return } -proc objdump_start_common { prog objdump_opts prefix } { +proc objdump { opts } { + global OBJDUMP + global comp_output + + catch "exec $OBJDUMP $opts" comp_output + verbose "objdump output=$comp_output\n" 3 +} + +proc objdump_start_no_subdir { prog opts } { global OBJDUMP global srcdir global spawn_id - verbose "Starting $OBJDUMP $objdump_opts $prog" 2 + verbose "Starting $OBJDUMP $opts $prog" 2 catch { - spawn -noecho -nottyinit $srcdir/lib/run $OBJDUMP $objdump_opts $prefix$prog + spawn -noecho -nottyinit $srcdir/lib/run $OBJDUMP $opts $prog } foo if ![regexp {^[0-9]+} $foo] then { error "Can't run $prog: $foo" } } -proc objdump_start { prog opts } { - global subdir - global objdir - objdump_start_common $prog $opts "$objdir/$subdir/" -} - -proc objdump_start_no_subdir { prog opts } { - objdump_start_common $prog $opts "" -} - proc objdump_finish { } { global spawn_id @@ -207,3 +205,66 @@ expect_after { buffer_full { error "buffer full" } eof { error "eof" } } + +# regexp_diff, based on simple_diff taken from ld test suite +# compares two files line-by-line +# file1 contains strings, file2 contains regexps and #-comments +# blank lines are ignored in either file +# returns non-zero if differences exist +# +proc regexp_diff { file_1 file_2 } { + + set eof -1 + set end 0 + set differences 0 + + if [file exists $file_1] then { + set file_a [open $file_1 r] + } else { + warning "$file_1 doesn't exist" + return + } + + if [file exists $file_2] then { + set file_b [open $file_2 r] + } else { + fail "$file_2 doesn't exist" + close $file_a + return + } + + verbose " Regexp-diff'ing: $file_1 $file_2" 2 + + while { $differences == 0 && $end == 0 } { + set line_a "" + set line_b "" + while { [string length $line_a] == 0 } { + if { [gets $file_a line_a] == $eof } { + set end 1 + break + } + } + while { [string length $line_b] == 0 || [string match "#*" $line_b] } { + if { [gets $file_b line_b] == $eof } { + set end 1 + break + } + } + if { $end } { break } + verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 + if [regexp "^$line_b$" "$line_a\n"] { + verbose "no match" 3 + set differences 1 + } + } + + if { $differences == 0 && [eof $file_a] != [eof $file_b] } { + verbose "different lengths" 3 + set differences 1 + } + + close $file_a + close $file_b + + return $differences +} -- 2.30.2