From 659518555272d23be5bc8a4950ad565d95b7b6a0 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 27 Nov 2012 17:26:11 +0000 Subject: [PATCH] binutils/testsuite/ * 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. gas/testsuite/ * lib/gas-defs.exp (run_dump_test): If as options include --compress-debug-sections and zlib is not available, report the test as unsupported. ld/testsuite/ * ld-elf/compress.exp: Bail out if zlib is not supported. * lib/ld-lib.exp (run_dump_test): If as options include --compress-debug-sections and zlib is not available, report the test as unsupported. --- binutils/testsuite/ChangeLog | 11 ++++++ binutils/testsuite/binutils-all/compress.exp | 8 ++--- binutils/testsuite/binutils-all/objdump.exp | 8 ++--- binutils/testsuite/binutils-all/readelf.exp | 35 +++++++++++--------- binutils/testsuite/lib/binutils-common.exp | 25 ++++++++++++++ binutils/testsuite/lib/utils-lib.exp | 22 +++++++----- gas/testsuite/ChangeLog | 6 ++++ gas/testsuite/lib/gas-defs.exp | 20 +++++++---- ld/testsuite/ChangeLog | 7 ++++ ld/testsuite/ld-elf/compress.exp | 4 +++ ld/testsuite/lib/ld-lib.exp | 6 ++++ 11 files changed, 114 insertions(+), 38 deletions(-) diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index b6ddda63d5d..626948e54ee 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2012-11-27 Roland McGrath + + * 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 PR binutils/14567 diff --git a/binutils/testsuite/binutils-all/compress.exp b/binutils/testsuite/binutils-all/compress.exp index 420794bb14d..8cf613856c1 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 14d18606e96..b330a321c26 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 e611cb2cdd9..c1d7286de55 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 0054184eef1..68efb90c782 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 b96043b4d76..3fe6c14b094 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 { diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 963ed8f0cc4..17374f5846b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-11-27 Roland McGrath + + * lib/gas-defs.exp (run_dump_test): If as options include + --compress-debug-sections and zlib is not available, report + the test as unsupported. + 2012-11-23 Alan Modra * gas/ppc/astest2.d: Pass -Mppc to objdump. diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp index 234789ac5cd..cb81c18fb4e 100644 --- a/gas/testsuite/lib/gas-defs.exp +++ b/gas/testsuite/lib/gas-defs.exp @@ -1,5 +1,5 @@ # Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# 2004, 2005, 2007, 2008, 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 @@ -71,7 +71,7 @@ proc gas_host_run { cmd redir } { set return_contents_of "gas.stderr" } elseif [regexp ">&.*" $redir] then { # See PR 5322 for why the following line is used. - regsub ">&" $redir "" output_file + regsub ">&" $redir "" output_file set command "$cmd 2>&1" } elseif [regexp "2>.*" $redir] then { set output_file "gas.out" @@ -582,7 +582,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 } @@ -597,25 +597,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 sourcefile ${file}.s diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c859e894c92..12026a9361a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -3,6 +3,13 @@ * ld-elf/flags1.d: Add *-*-nacl* to xfail list. * ld-elf/orphan-region.d: Likewise. +2012-11-27 Roland McGrath + + * ld-elf/compress.exp: Bail out if zlib is not supported. + * lib/ld-lib.exp (run_dump_test): If as options include + --compress-debug-sections and zlib is not available, report + the test as unsupported. + 2012-11-23 Alan Modra * ld-powerpc/plt1.d: Update for default "at" branch hints. diff --git a/ld/testsuite/ld-elf/compress.exp b/ld/testsuite/ld-elf/compress.exp index 1e133943d95..55269eed60b 100644 --- a/ld/testsuite/ld-elf/compress.exp +++ b/ld/testsuite/ld-elf/compress.exp @@ -25,6 +25,10 @@ if ![is_elf_format] { return } +if ![is_zlib_supported] { + return +} + # The following tests require running the executable generated by ld. if ![isnative] { return diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 49837dd4b17..3cb8ee187f1 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -757,6 +757,12 @@ proc run_dump_test { name {extra_options {}} } { set dfile $srcdir/$subdir/$opts(dump) } + if { [string match "*--compress-debug-sections*" $opts(as)] \ + && ![is_zlib_supported] } { + unsupported $testname + return + } + # Time to setup xfailures. foreach targ $opts(xfail) { setup_xfail $targ -- 2.30.2