This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] make check vs --without-zlib


On Mon, Nov 26, 2012 at 3:09 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> Generating special site.exp contents like this is bad for installed
> testing as it needs to replicate anything a particular tool's testsuite
> wants in site.exp; the more special things are used by particular
> testsuites, the more there is for installed testing to replicate.
> Something that actually tests by running a binutils binary whether it has
> zlib support or not would seem better.  (For example, --help or --version
> output could include a line indicating whether zlib support is present.)

as --help already gives the indication by including or omitting the
--compress-debug-sections switch.

Here's a version of the change using that instead of configure logic.

Ok for trunk?


Thanks,
Roland


binutils/testsuite/
2012-11-26  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.

gas/testsuite/
2012-11-26  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.

ld/testsuite/
2012-11-26  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.

--- a/binutils/testsuite/binutils-all/compress.exp
+++ b/binutils/testsuite/binutils-all/compress.exp
@@ -1,4 +1,4 @@
-#   Copyright 2010
+#   Copyright 2010, 2012
 #   Free Software Foundation, Inc.

 # This program is free software; you can redistribute it and/or modify
@@ -17,7 +17,7 @@

 # Test compressed .debug section.

-if { [is_remote host] || ![is_elf_format] } then {
+if { [is_remote host] || ![is_elf_format] || ![is_zlib_supported] } then {
     return
 }

--- a/binutils/testsuite/binutils-all/objdump.exp
+++ b/binutils/testsuite/binutils-all/objdump.exp
@@ -1,5 +1,5 @@
 #   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
@@ -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"
--- a/binutils/testsuite/binutils-all/readelf.exp
+++ b/binutils/testsuite/binutils-all/readelf.exp
@@ -220,6 +220,11 @@ proc readelf_compressed_wa_test {} {
     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."
--- 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.
 #
--- a/binutils/testsuite/lib/utils-lib.exp
+++ b/binutils/testsuite/lib/utils-lib.exp
@@ -1,5 +1,5 @@
 # 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
@@ -439,6 +439,12 @@ proc run_dump_test { name {extra_options {}} } {
 	}
     }

+    if { [string match "*--compress-debug-sections*" $opts(as)] \
+	 && ![is_zlib_supported] } {
+	unsupported $testname
+	return
+    }
+
     if { $opts(source) == "" } {
 	set srcfile ${file}.s
     } else {
--- 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
@@ -616,6 +616,12 @@ proc run_dump_test { name {extra_options {}} } {
 	}
     }

+    if { [string match "*--compress-debug-sections*" $opts(as)] \
+	 && ![is_zlib_supported] } {
+	unsupported $testname
+	return
+    }
+

     if { $opts(source) == "" } {
 	set sourcefile ${file}.s
--- 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
--- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]