]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/testsuite/binutils-all/x86-64/objects.exp
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / binutils / testsuite / binutils-all / x86-64 / objects.exp
1 # Expect script for x86-64 object tests.
2 # Copyright (C) 2017-2022 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
17 # MA 02110-1301, USA.
18
19 if {![istarget "x86_64-*-linux*"] || [is_remote host]} {
20 return
21 }
22
23 set tempfile tmpdir/x86-64-object-temp.o
24 set copyfile tmpdir/x86-64-object-copy.o
25
26 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.o.bz2]]
27 foreach t $test_list {
28 # We need to strip the ".bz2", but can leave the dirname.
29 set test $subdir/[file tail $t]
30 set testname [file rootname $test]
31 verbose $testname
32 if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
33 untested "bzip2 -dc ($testname)"
34 continue
35 }
36 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile $copyfile"]
37 if ![string equal "" $got] then {
38 fail "objcopy ($testname)"
39 } else {
40 set got [remote_exec host "$READELF -a $tempfile" "" "/dev/null" "${tempfile}.out"]
41 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
42 fail "objcopy ($testname)"
43 continue
44 }
45 set got [remote_exec host "$READELF -a $copyfile" "" "/dev/null" "${copyfile}.out"]
46 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
47 fail "objcopy ($testname)"
48 continue
49 }
50 set got [binutils_run cmp "${tempfile}.out ${copyfile}.out"]
51 if ![string equal "" $got] then {
52 fail "objcopy ($testname)"
53 continue
54 }
55 pass "objcopy ($testname)"
56 }
57 }