]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - binutils/testsuite/binutils-all/x86-64/objects.exp
tcl global directive outside proc body does nothing (binutils)
[thirdparty/binutils-gdb.git] / binutils / testsuite / binutils-all / x86-64 / objects.exp
1 # Expect script for x86-64 object tests.
2 # Copyright (C) 2017-2020 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*"]
20 || [istarget "x86_64-*-nacl*"])
21 || [is_remote host]} {
22 return
23 }
24
25 set tempfile tmpdir/x86-64-object-temp.o
26 set copyfile tmpdir/x86-64-object-copy.o
27
28 set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.o.bz2]]
29 foreach t $test_list {
30 # We need to strip the ".bz2", but can leave the dirname.
31 set test $subdir/[file tail $t]
32 set testname [file rootname $test]
33 verbose $testname
34 if {[catch "system \"bzip2 -dc $t > $tempfile\""] != 0} {
35 untested "bzip2 -dc ($testname)"
36 continue
37 }
38 set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile $copyfile"]
39 if ![string equal "" $got] then {
40 fail "objcopy ($testname)"
41 } else {
42 set got [remote_exec host "$READELF -a $tempfile" "" "/dev/null" "${tempfile}.out"]
43 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
44 fail "objcopy ($testname)"
45 continue
46 }
47 set got [remote_exec host "$READELF -a $copyfile" "" "/dev/null" "${copyfile}.out"]
48 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
49 fail "objcopy ($testname)"
50 continue
51 }
52 set got [binutils_run cmp "${tempfile}.out ${copyfile}.out"]
53 if ![string equal "" $got] then {
54 fail "objcopy ($testname)"
55 continue
56 }
57 pass "objcopy ($testname)"
58 }
59 }