diff options
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/testsuite/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/compress.exp | 8 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/objdump.exp | 8 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/readelf.exp | 35 | ||||
-rw-r--r-- | binutils/testsuite/lib/binutils-common.exp | 25 | ||||
-rw-r--r-- | binutils/testsuite/lib/utils-lib.exp | 22 |
6 files changed, 78 insertions, 31 deletions
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index b6ddda6..626948e 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2012-11-27 Roland McGrath <mcgrathr@google.com> + + * lib/binutils-common.exp (is_zlib_supported): New function. + * lib/utils-lib.exp (run_dump_test): If as options include + --compress-debug-sections and zlib is not available, report + the test as unsupported. + * binutils-all/compress.exp: Bail out if zlib is not available. + * binutils-all/objdump.exp (objdump compressed debug): + Mark unsupported if zlib is not available. + * binutils-all/readelf.exp (readelf_compressed_wa_test): Likewise. + 2012-11-06 H.J. Lu <hongjiu.lu@intel.com> PR binutils/14567 diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp index 420794b..8cf6138 100644 --- a/binutils/testsuite/binutils-all/compress.exp +++ b/binutils/testsuite/binutils-all/compress.exp @@ -1,23 +1,23 @@ -# Copyright 2010 +# Copyright 2010, 2012 # 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. # Test compressed .debug section. -if { [is_remote host] || ![is_elf_format] } then { +if { [is_remote host] || ![is_elf_format] || ![is_zlib_supported] } then { return } diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 14d1860..b330a32 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -1,17 +1,17 @@ # Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2007, 2008, 2009, 2011 +# 2003, 2004, 2007, 2008, 2009, 2011, 2012 # 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. @@ -160,7 +160,7 @@ if [regexp $want $got] then { # Test objdump -s on a file that contains a compressed .debug section -if { ![is_elf_format] } then { +if { ![is_elf_format] || ![is_zlib_supported] } then { unsupported "objdump compressed debug" } elseif { ![binutils_assemble $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.o] } then { fail "objdump compressed debug" diff --git a/binutils/testsuite/binutils-all/readelf.exp b/binutils/testsuite/binutils-all/readelf.exp index e611cb2..c1d7286 100644 --- a/binutils/testsuite/binutils-all/readelf.exp +++ b/binutils/testsuite/binutils-all/readelf.exp @@ -5,12 +5,12 @@ # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. @@ -84,7 +84,7 @@ proc readelf_test { options binary_file regexp_file xfails } { global readelf_size global srcdir global subdir - + send_log "exec $READELF $READELFFLAGS $options $binary_file > readelf.out\n" set got [remote_exec host "$READELF $READELFFLAGS $options $binary_file" "" "/dev/null" "readelf.out"] @@ -146,7 +146,7 @@ proc readelf_wi_test {} { global READELFFLAGS global srcdir global subdir - + # Compile the second test file. if { [target_compile $srcdir/$subdir/testprog.c tmpdir/testprog.o object debug] != "" } { verbose "Unable to compile test file." @@ -164,7 +164,7 @@ proc readelf_wi_test {} { set output [remote_upload host readelf.out] file_on_host delete $tempfile - + # Strip any superflous warnings. set got [prune_readelf_wi_warnings [lindex $got 1]] @@ -182,7 +182,7 @@ proc readelf_wi_test {} { untested "readelf -wi" return } - + # Search for strings that should be in the output. set sought { ".*DW_TAG_compile_unit.*" @@ -195,8 +195,8 @@ proc readelf_wi_test {} { ".*DW_AT_name.*(main|indirect string).*" ".*\(DW_OP_addr: 0\).*" } - - foreach looked_for $sought { + + foreach looked_for $sought { set lines [grep $output $looked_for] if ![llength $lines] then { fail "readelf -wi: missing: $looked_for" @@ -206,7 +206,7 @@ proc readelf_wi_test {} { } file_on_host delete $output - + # All done. pass "readelf -wi" } @@ -219,7 +219,12 @@ proc readelf_compressed_wa_test {} { global READELFFLAGS global srcdir global subdir - + + if { ![is_zlib_supported] } { + unsupported "readelf -wa (compressed)" + return + } + # Compile the compressed-debug-section test file. if { [target_compile $srcdir/$subdir/dw2-compressed.S tmpdir/dw2-compressed.o object debug] != "" } { verbose "Unable to compile test file." @@ -237,7 +242,7 @@ proc readelf_compressed_wa_test {} { set output [remote_upload host readelf.out] file_on_host delete $tempfile - + if { [string compare [file_contents readelf.out] [file_contents $srcdir/$subdir/readelf.wa]] != 0 } then { fail "readelf -wa (compressed)" verbose "output is \n[file_contents readelf.out]" 2 @@ -255,7 +260,7 @@ proc readelf_dump_test {} { global READELFFLAGS global srcdir global subdir - + # Assemble the dump test file. if {![binutils_assemble $srcdir/$subdir/dumptest.s tmpdir/dumptest.o]} then { unresolved "readelf -p: failed to assemble dump test file" @@ -283,8 +288,8 @@ proc readelf_dump_test {} { set sought { ".*test_string.*" } - - foreach looked_for $sought { + + foreach looked_for $sought { set lines [grep $output $looked_for] if ![llength $lines] then { fail "readelf -p: missing: $looked_for" @@ -293,7 +298,7 @@ proc readelf_dump_test {} { } } - file_on_host delete $tempfile + file_on_host delete $tempfile file_on_host delete $output # All done. diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 0054184..68efb90 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -152,6 +152,31 @@ proc is_elf64 { binary_file } { return 0 } +# True if the build supports zlib compression. +proc is_zlib_supported {} { + + # This replicates the AS selection logic of dejagnu's target_assemble. + global AS_FOR_TARGET + if [info exists AS_FOR_TARGET] { + set AS $AS_FOR_TARGET + } else { + if {![board_info target exists assembler]} { + set AS [find_gas] + } else { + set AS [board_info target assembler] + } + } + + set as_output [remote_exec host "$AS --help"] + + set have_zlib 0 + if {[string first "--compress-debug-sections" $as_output] >= 0} { + set have_zlib 1 + } + + return $have_zlib +} + # Compare two files line-by-line. FILE_1 is the actual output and FILE_2 # is the expected output. Ignore blank lines in either file. # diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp index b96043b..3fe6c14 100644 --- a/binutils/testsuite/lib/utils-lib.exp +++ b/binutils/testsuite/lib/utils-lib.exp @@ -1,16 +1,16 @@ # Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004, 2006, 2007, -# 2009, 2010 Free Software Foundation, Inc. +# 2009, 2010, 2012 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 3 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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. @@ -405,7 +405,7 @@ proc run_dump_test { name {extra_options {}} } { if { $opts(not-skip) != "" } then { set skip 1 foreach glob $opts(not-skip) { - if {[istarget $glob]} { + if {[istarget $glob]} { set skip 0 break } @@ -420,25 +420,31 @@ proc run_dump_test { name {extra_options {}} } { } set skip 1 foreach glob $opts(target) { - if {[istarget $glob]} { + if {[istarget $glob]} { set skip 0 break } } - if {$skip} { + if {$skip} { unsupported $testname - return + return } } if { $opts(not-target) != "" } then { foreach glob $opts(not-target) { if {[istarget $glob]} { unsupported $testname - return + return } } } + if { [string match "*--compress-debug-sections*" $opts(as)] \ + && ![is_zlib_supported] } { + unsupported $testname + return + } + if { $opts(source) == "" } { set srcfile ${file}.s } else { |