]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Add a test for PR binutils/22451
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 21 Nov 2017 21:41:10 +0000 (13:41 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 21 Nov 2017 21:41:51 +0000 (13:41 -0800)
Check in the object file generated from the older assembler as a
compressed file.

PR binutils/22451
* testsuite/binutils-all/x86-64/objects.exp: New file.
* testsuite/binutils-all/x86-64/pr22451.o.bz2: Likewise.

binutils/ChangeLog
binutils/testsuite/binutils-all/x86-64/objects.exp [new file with mode: 0644]
binutils/testsuite/binutils-all/x86-64/pr22451.o.bz2 [new file with mode: 0644]

index 126e696b8b7a0f66c1c0f6bc0833182e4c8d5822..53d85072f0d68d6f781d19c8b6c8760d7113e8c0 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/22451
+       * testsuite/binutils-all/x86-64/objects.exp: New file.
+       * testsuite/binutils-all/x86-64/pr22451.o.bz2: Likewise.
+
 2017-11-21  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * testsuite/binutils-all/arc/objdump.exp: Update pattern matching
diff --git a/binutils/testsuite/binutils-all/x86-64/objects.exp b/binutils/testsuite/binutils-all/x86-64/objects.exp
new file mode 100644 (file)
index 0000000..ba8e928
--- /dev/null
@@ -0,0 +1,62 @@
+# Expect script for x86-64 object tests.
+#   Copyright (C) 2017 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.
+
+if {!([istarget "x86_64-*-linux*"]
+      || [istarget "x86_64-*-nacl*"])
+    || [is_remote host]} {
+    return
+}
+
+global OBJCOPY
+global OBJCOPYFLAGS
+global READELF
+set tempfile tmpdir/x86-64-object-temp.o
+set copyfile tmpdir/x86-64-object-copy.o
+
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.o.bz2]]
+foreach t $test_list {
+    # We need to strip the ".bz2", but can leave the dirname.
+    set test $subdir/[file tail $t]
+    set testname [file rootname $test]
+    verbose $testname
+    if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
+       untested "bzip2 -dc ($testname)"
+       continue
+    }
+    set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile $copyfile"]
+    if ![string equal "" $got] then {
+       fail "objcopy ($testname)"
+    } else {
+       set got [remote_exec host "$READELF -a $tempfile" "" "/dev/null" "${tempfile}.out"]
+       if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+           fail "objcopy ($testname)"
+           continue
+       }
+       set got [remote_exec host "$READELF -a $copyfile" "" "/dev/null" "${copyfile}.out"]
+       if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
+           fail "objcopy ($testname)"
+           continue
+       }
+       set got [binutils_run cmp "${tempfile}.out ${copyfile}.out"]
+       if ![string equal "" $got] then {
+           fail "objcopy ($testname)"
+           continue
+       }
+       pass "objcopy ($testname)"
+    }
+}
diff --git a/binutils/testsuite/binutils-all/x86-64/pr22451.o.bz2 b/binutils/testsuite/binutils-all/x86-64/pr22451.o.bz2
new file mode 100644 (file)
index 0000000..0ba1762
Binary files /dev/null and b/binutils/testsuite/binutils-all/x86-64/pr22451.o.bz2 differ