Fixes a problem with the BFD library running out of memory because it mistakenly
[deliverable/binutils-gdb.git] / binutils / testsuite / binutils-all / compress.exp
index 91ed7e41403ef377e256b8ed19673a26b6f4f3de..d74555dc75c2ace7551c5b9c5c1edd19bcf62599 100644 (file)
@@ -1,23 +1,22 @@
-#   Copyright 2010
-#   Free Software Foundation, Inc.
+#   Copyright (C) 2010-2014 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
 }
 
@@ -133,3 +132,54 @@ if ![string match "" $got] then {
        pass "$testname"
     }
 }
+
+set testname "objdump compress debug sections"
+set got [remote_exec host "$OBJDUMP -W $compressedfile" "" "/dev/null" "objdump.out"]
+if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+    fail "$testname"
+    send_log "$got\n"
+}
+if { [regexp_diff objdump.out $srcdir/$subdir/dw2-1.W] } then {
+    fail "$testname"
+} else {
+    pass "$testname"
+}
+
+set testfile tmpdir/dw2-emty.o
+
+if { ![binutils_assemble_flags $srcdir/$subdir/dw2-empty.S $testfile --nocompress-debug-sections] } then {
+    unsupported "compressed debug sections"
+    return
+}
+
+set testname "objcopy compress empty debug sections"
+set got [binutils_run $OBJCOPY "--compress-debug-sections $testfile ${copyfile}.o"]
+if ![string match "" $got] then {
+    fail "objcopy ($testname)"
+} else {
+    send_log "cmp $testfile ${copyfile}.o\n"
+    verbose "cmp $testfile ${copyfile}.o"
+    set src1 ${testfile}
+    set src2 ${copyfile}.o
+    set status [remote_exec build cmp "${src1} ${src2}"]
+    set exec_output [lindex $status 1]
+    set exec_output [prune_warnings $exec_output]
+
+    if [string match "" $exec_output] then {
+       pass "objcopy ($testname)"
+    } else {
+       send_log "$exec_output\n"
+       verbose "$exec_output" 1
+       fail "objcopy ($testname)"
+    }
+}
+
+if ![is_remote host] {
+    set tempfile tmpdir/debug_str.o
+    set copyfile tmpdir/debug_str.copy
+} else {
+    set tempfile [remote_download host tmpdir/debug_str.o]
+    set copyfile debug_str.copy
+}
+
+run_dump_test "debug_str"
This page took 0.025537 seconds and 4 git commands to generate.