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.
This commit is contained in:
Roland McGrath 2012-11-27 17:26:11 +00:00
parent 2a64e9e88d
commit 6595185552
11 changed files with 114 additions and 38 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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"

View File

@ -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.

View File

@ -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.
#

View File

@ -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 {

View File

@ -1,3 +1,9 @@
2012-11-27 Roland McGrath <mcgrathr@google.com>
* 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 <amodra@gmail.com>
* gas/ppc/astest2.d: Pass -Mppc to objdump.

View File

@ -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

View File

@ -3,6 +3,13 @@
* ld-elf/flags1.d: Add *-*-nacl* to xfail list.
* ld-elf/orphan-region.d: Likewise.
2012-11-27 Roland McGrath <mcgrathr@google.com>
* 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 <amodra@gmail.com>
* ld-powerpc/plt1.d: Update for default "at" branch hints.

View File

@ -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

View File

@ -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