binutils objcopy test tidy

The main aim of this patch is to perform more objcopy tests when we
can build executables but not run them.  ie. non-native with cross
compiler available.

	* binutils-all/objcopy.exp: Delete trailing whitespace.  Use
	"string equal" rather than "string match" when making simple
	string comparisons.  Revert 2008-07-08 host_triplet checks.
	Perform non-run tests when we can build executable.
	(strip_executable, strip_executable_with_saving_a_symbol): Move
	run test later.  Take extra param on whether to perform run test.
	Update callers.
	(keep_debug_symbols_and_test_copy): Delete unused vars.
This commit is contained in:
Alan Modra 2015-10-15 21:37:13 +10:30
parent 7b19bec22f
commit 21c40443ce
2 changed files with 126 additions and 109 deletions

View file

@ -1,3 +1,14 @@
2015-10-15 Alan Modra <amodra@gmail.com>
* binutils-all/objcopy.exp: Delete trailing whitespace. Use
"string equal" rather than "string match" when making simple
string comparisons. Revert 2008-07-08 host_triplet checks.
Perform non-run tests when we can build executable.
(strip_executable, strip_executable_with_saving_a_symbol): Move
run test later. Take extra param on whether to perform run test.
Update callers.
(keep_debug_symbols_and_test_copy): Delete unused vars.
2015-09-30 H.J. Lu <hongjiu.lu@intel.com> 2015-09-30 H.J. Lu <hongjiu.lu@intel.com>
* lib/utils-lib.exp (run_dump_test): Handle symbolic link when * lib/utils-lib.exp (run_dump_test): Handle symbolic link when

View file

@ -54,7 +54,7 @@ proc objcopy_test {testname srcfile} {
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS $tempfile ${copyfile}.o"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy ($testname)" fail "objcopy ($testname)"
} else { } else {
send_log "cmp $tempfile ${copyfile}.o\n" send_log "cmp $tempfile ${copyfile}.o\n"
@ -91,7 +91,7 @@ proc objcopy_test {testname srcfile} {
clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*" clear_xfail "hppa*-*-*n*bsd*" "hppa*-*-rtems*" "*-*-*elf*"
clear_xfail "m68*-*-sysv4*" clear_xfail "m68*-*-sysv4*"
if [string match "" $exec_output] then { if [string equal "" $exec_output] then {
pass "objcopy ($testname)" pass "objcopy ($testname)"
} else { } else {
send_log "$exec_output\n" send_log "$exec_output\n"
@ -112,7 +112,7 @@ objcopy_test "simple copy" bintest.s
set reversed ${tempfile}-reversed set reversed ${tempfile}-reversed
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -j .data --reverse-bytes=4 $tempfile $reversed"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --reverse-bytes" fail "objcopy --reverse-bytes"
} else { } else {
if [is_remote host] { if [is_remote host] {
@ -159,7 +159,7 @@ if [is_remote host] {
set got [binutils_run $OBJCOPY "-I binary -i 4 -b 0 --interleave-width 2 ${sequence_file} ${copyfile}"] set got [binutils_run $OBJCOPY "-I binary -i 4 -b 0 --interleave-width 2 ${sequence_file} ${copyfile}"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy -i --interleave-width" fail "objcopy -i --interleave-width"
} else { } else {
if [is_remote host] { if [is_remote host] {
@ -174,7 +174,7 @@ if ![string match "" $got] then {
send_log "$line\n" send_log "$line\n"
verbose $line verbose $line
if ![string match "1256" $line] then { if ![string equal "1256" $line] then {
fail "objcopy -i --interleave-width" fail "objcopy -i --interleave-width"
} }
pass "objcopy -i --interleave-width" pass "objcopy -i --interleave-width"
@ -197,7 +197,7 @@ if [is_remote host] {
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $tempfile ${srecfile}"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy -O srec" fail "objcopy -O srec"
} else { } else {
if [is_remote host] { if [is_remote host] {
@ -257,7 +257,7 @@ if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then {
set origstart "" set origstart ""
} else { } else {
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --set-start 0x7654 $tempfile ${copyfile}.srec"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --set-start" fail "objcopy --set-start"
} else { } else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
@ -274,7 +274,7 @@ if ![regexp "start address (\[0-9a-fA-FxX\]+)" $got all origstart] then {
} }
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-start 0x123 $tempfile ${copyfile}.srec"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --adjust-start" fail "objcopy --adjust-start"
} else { } else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
@ -319,7 +319,7 @@ if {$low == "" || $origstart == ""} then {
perror "objdump can not recognize bintest.o" perror "objdump can not recognize bintest.o"
} else { } else {
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec --adjust-vma 0x123 $tempfile ${copyfile}.srec"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --adjust-vma" fail "objcopy --adjust-vma"
} else { } else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"] set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -fh ${copyfile}.srec"]
@ -353,7 +353,7 @@ if {$low == "" || $origstart == ""} then {
} }
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $arg $tempfile ${copyfile}.srec"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --adjust-section-vma +" fail "objcopy --adjust-section-vma +"
} else { } else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
@ -373,7 +373,7 @@ if {$low == "" || $origstart == ""} then {
regsub -all "\\+4" $arg "=[expr $low + 4]" argeq regsub -all "\\+4" $arg "=[expr $low + 4]" argeq
set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"] set got [binutils_run $OBJCOPY "$OBJCOPYFLAGS -O srec $argeq $tempfile ${copyfile}.srec"]
if ![string match "" $got] then { if ![string equal "" $got] then {
fail "objcopy --adjust-section-vma =" fail "objcopy --adjust-section-vma ="
} else { } else {
set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"] set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -h ${copyfile}.srec"]
@ -437,21 +437,21 @@ proc strip_test { } {
remote_file build delete tmpdir/libstrip.a remote_file build delete tmpdir/libstrip.a
set exec_output [binutils_run $AR "rc $archive ${objfile}"] set exec_output [binutils_run $AR "rc $archive ${objfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
unresolved "$test preserving OS/ABI" unresolved "$test preserving OS/ABI"
return return
} }
set exec_output [binutils_run $STRIP "-g $archive"] set exec_output [binutils_run $STRIP "-g $archive"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
unresolved "$test preserving OS/ABI" unresolved "$test preserving OS/ABI"
return return
} }
set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"] set exec_output [binutils_run $STRIP "$STRIPFLAGS $archive"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
unresolved "$test preserving OS/ABI" unresolved "$test preserving OS/ABI"
return return
@ -485,7 +485,7 @@ proc strip_test { } {
} }
set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"] set exec_output [binutils_run $STRIP "$STRIPFLAGS $objfile"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
return return
} }
@ -526,7 +526,7 @@ proc strip_test_with_saving_a_symbol { } {
} }
set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"] set exec_output [binutils_run $STRIP "$STRIPFLAGS -K main -K _main $objfile"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
return return
} }
@ -587,11 +587,8 @@ proc copy_setup { } {
if { $status != "pass" } { if { $status != "pass" } {
send_log "cannot run executable, status = ${status} on ${host_triplet}\n" send_log "cannot run executable, status = ${status} on ${host_triplet}\n"
if { [istarget $host_triplet] } {
return 3 return 3
} }
set status "pass"
}
return 0 return 0
} }
@ -600,7 +597,6 @@ proc copy_setup { } {
proc copy_executable { prog flags test1 test2 } { proc copy_executable { prog flags test1 test2 } {
global test_prog global test_prog
global host_triplet
if [is_remote host] { if [is_remote host] {
set testfile [remote_download host tmpdir/$test_prog] set testfile [remote_download host tmpdir/$test_prog]
@ -613,9 +609,9 @@ proc copy_executable { prog flags test1 test2 } {
set exec_output [binutils_run $prog "$flags $testfile $testcopy"] set exec_output [binutils_run $prog "$flags $testfile $testcopy"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test1 fail $test1
if [string match "" $test2] { if [string equal "" $test2] {
return return
} }
fail $test2 fail $test2
@ -629,7 +625,7 @@ proc copy_executable { prog flags test1 test2 } {
set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"] set status [remote_exec build "cmp" "tmpdir/$test_prog tmpdir/copyprog"]
set exec_output [lindex $status 1] set exec_output [lindex $status 1]
if [string match "" $exec_output] then { if [string equal "" $exec_output] then {
pass $test1 pass $test1
} else { } else {
send_log "$exec_output\n" send_log "$exec_output\n"
@ -658,15 +654,12 @@ proc copy_executable { prog flags test1 test2 } {
fail $test1 fail $test1
} }
if [string match "" $test2] { if [string equal "" $test2] {
return return
} }
set output [remote_load target tmpdir/copyprog] set output [remote_load target tmpdir/copyprog]
set status [lindex $output 0] set status [lindex $output 0]
if { ![istarget $host_triplet] } {
set status "pass"
}
if { $status != "pass" } { if { $status != "pass" } {
fail $test2 fail $test2
} else { } else {
@ -676,11 +669,10 @@ proc copy_executable { prog flags test1 test2 } {
# Test stripping an executable # Test stripping an executable
proc strip_executable { prog flags test } { proc strip_executable { prog flags test1 test2 } {
global NM global NM
global NMFLAGS global NMFLAGS
global READELF global READELF
global host_triplet
remote_file build delete tmpdir/striprog remote_file build delete tmpdir/striprog
remote_download build tmpdir/copyprog tmpdir/striprog remote_download build tmpdir/copyprog tmpdir/striprog
@ -695,7 +687,7 @@ proc strip_executable { prog flags test } {
verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in" verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.in"
set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"] set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.in"]
if { [lindex $exec_output 0] != 0 } then { if { [lindex $exec_output 0] != 0 } then {
unresolved "$test preserving OS/ABI" unresolved "$test1 preserving OS/ABI"
set osabi_fail "true" set osabi_fail "true"
} else { } else {
verbose -log "grep OS/ABI tmpdir/osabi.in" verbose -log "grep OS/ABI tmpdir/osabi.in"
@ -704,8 +696,12 @@ proc strip_executable { prog flags test } {
} }
set exec_output [binutils_run $prog "$flags ${copyfile}"] set exec_output [binutils_run $prog "$flags ${copyfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test1
if [string equal "" $test2] {
return
}
fail $test2
return return
} }
@ -713,46 +709,47 @@ proc strip_executable { prog flags test } {
remote_upload host ${copyfile} tmpdir/striprog remote_upload host ${copyfile} tmpdir/striprog
} }
set result [remote_load target tmpdir/striprog]
set status [lindex $result 0]
if { ![istarget $host_triplet] } {
set status "pass"
}
if { $status != "pass" } {
fail $test
return
}
if { $osabi_fail != "true" && [is_elf_format] } { if { $osabi_fail != "true" && [is_elf_format] } {
verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out" verbose -log "$READELF -a ${copyfile} > tmpdir/osabi.out"
set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"] set exec_output [remote_exec host "$READELF -h ${copyfile}" "" "/dev/null" "tmpdir/osabi.out"]
if { [lindex $exec_output 0] != 0 } then { if { [lindex $exec_output 0] != 0 } then {
unresolved "$test preserving OS/ABI" unresolved "$test1 preserving OS/ABI"
} else { } else {
verbose -log "grep OS/ABI tmpdir/osabi.out" verbose -log "grep OS/ABI tmpdir/osabi.out"
catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out catch "exec grep OS/ABI tmpdir/osabi.out" osabi_out
if { "$osabi_in" == "$osabi_out" } { if { "$osabi_in" == "$osabi_out" } {
pass "$test preserving OS/ABI" pass "$test1 preserving OS/ABI"
} else { } else {
fail "$test preserving OS/ABI" fail "$test1 preserving OS/ABI"
} }
} }
} }
set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"] set exec_output [binutils_run $NM "$NMFLAGS ${copyfile}"]
if ![string match "*: no symbols*" $exec_output] { if ![string match "*: no symbols*" $exec_output] {
fail $test fail $test1
return return
} }
pass $test
if [string equal "" $test2] {
return
}
set result [remote_load target tmpdir/striprog]
set status [lindex $result 0]
if { $status != "pass" } {
fail $test2
return
}
pass $test2
} }
# Test stripping an executable with saving a symbol # Test stripping an executable with saving a symbol
proc strip_executable_with_saving_a_symbol { prog flags test } { proc strip_executable_with_saving_a_symbol { prog flags test1 test2 } {
global NM global NM
global NMFLAGS global NMFLAGS
global host_triplet
remote_file build delete tmpdir/striprog remote_file build delete tmpdir/striprog
remote_download build tmpdir/copyprog tmpdir/striprog remote_download build tmpdir/copyprog tmpdir/striprog
@ -763,22 +760,12 @@ proc strip_executable_with_saving_a_symbol { prog flags test } {
} }
set exec_output [binutils_run $prog "$flags ${copyfile}"] set exec_output [binutils_run $prog "$flags ${copyfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test1
if [string equal "" $test2] {
return return
} }
fail $test2
if [is_remote host] {
remote_upload host ${copyfile} tmpdir/striprog
}
set result [remote_load target tmpdir/striprog]
set status [lindex $result 0]
if { ![istarget $host_triplet] } {
set status "pass"
}
if { $status != "pass" } {
fail $test
return return
} }
@ -794,18 +781,31 @@ proc strip_executable_with_saving_a_symbol { prog flags test } {
if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \ if {![regexp {^([0-9a-fA-F]+)?[ ]+[TD] main} $exec_output] \
&& ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} { && ![regexp {^([0-9a-fA-F]+)?[ ]+[TD] _main} $exec_output]} {
fail $test fail $test1
return return
} }
pass $test
if [string equal "" $test2] {
return
}
if [is_remote host] {
remote_upload host ${copyfile} tmpdir/striprog
}
set result [remote_load target tmpdir/striprog]
set status [lindex $result 0]
if { $status != "pass" } {
fail $test2
return
}
pass $test2
} }
# Test keeping only debug symbols of an executable # Test keeping only debug symbols of an executable
proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } { proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } {
global NM
global NMFLAGS
remote_file build delete tmpdir/striprog remote_file build delete tmpdir/striprog
remote_download build tmpdir/copyprog tmpdir/striprog remote_download build tmpdir/copyprog tmpdir/striprog
if [is_remote host] { if [is_remote host] {
@ -815,14 +815,14 @@ proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 }
} }
set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"] set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test1 fail $test1
return return
} }
pass $test1 pass $test1
set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"] set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test2 fail $test2
return return
} }
@ -845,7 +845,7 @@ proc keep_debug_symbols_and_check_links { prog flags test } {
} }
set exec_output [binutils_run $prog "$flags ${copyfile}"] set exec_output [binutils_run $prog "$flags ${copyfile}"]
if ![string match "" $exec_output] { if ![string equal "" $exec_output] {
fail $test fail $test
return return
} }
@ -885,13 +885,15 @@ proc keep_debug_symbols_and_check_links { prog flags test } {
set test1 "simple objcopy of executable" set test1 "simple objcopy of executable"
set test2 "run objcopy of executable" set test1r "run objcopy of executable"
set test3 "run stripped executable" set test2 "strip executable"
set test4 "run stripped executable with saving a symbol" set test2r "run stripped executable"
set test5 "keep only debug data" set test3 "strip executable with saving a symbol"
set test6 "simple objcopy of debug data" set test3r "run stripped executable with saving a symbol"
set test4 "keep only debug data"
set test5 "simple objcopy of debug data"
if [is_elf_format] { if [is_elf_format] {
set test7 "NOBITS sections retain sh_link field" set test6 "NOBITS sections retain sh_link field"
} }
switch [copy_setup] { switch [copy_setup] {
@ -900,34 +902,38 @@ switch [copy_setup] {
} }
"2" { "2" {
untested $test1 untested $test1
untested $test1r
untested $test2 untested $test2
untested $test2r
untested $test3 untested $test3
untested $test3r
untested $test4 untested $test4
untested $test5 untested $test5
untested $test6
if [is_elf_format] { if [is_elf_format] {
untested $test7 untested $test6
} }
} }
"3" { "3" {
copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "" copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" ""
unsupported $test2 unsupported $test1r
unsupported $test3 strip_executable "$STRIP" "$STRIPFLAGS" "$test2" ""
unsupported $test4 unsupported $test2r
unsupported $test5 strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test3" ""
unsupported $test6 unsupported $test3r
keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test4" \
"$OBJCOPY" "$OBJCOPYFLAGS" "$test5"
if [is_elf_format] { if [is_elf_format] {
unsupported $test7 keep_debug_symbols_and_check_links "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test6"
} }
} }
"0" { "0" {
copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2" copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test1r"
strip_executable "$STRIP" "$STRIPFLAGS" "$test3" strip_executable "$STRIP" "$STRIPFLAGS" "$test2" "$test2r"
strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4" strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test3" "$test3r"
keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test5" \ keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test4" \
"$OBJCOPY" "$OBJCOPYFLAGS" "$test6" "$OBJCOPY" "$OBJCOPYFLAGS" "$test5"
if [is_elf_format] { if [is_elf_format] {
keep_debug_symbols_and_check_links "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test7" keep_debug_symbols_and_check_links "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test6"
} }
} }
} }
@ -947,7 +953,7 @@ proc objcopy_test_readelf {testname srcfile} {
verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o" verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"
set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"] set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"]
if { [lindex $exec_output 0] != 0 if { [lindex $exec_output 0] != 0
|| ![string match "" [lindex $exec_output 1]] } then { || ![string equal "" [lindex $exec_output 1]] } then {
fail "objcopy ($testname)" fail "objcopy ($testname)"
return return
} }
@ -959,7 +965,7 @@ proc objcopy_test_readelf {testname srcfile} {
return return
} }
set exec_output [prune_warnings [lindex $exec_output 1]] set exec_output [prune_warnings [lindex $exec_output 1]]
if ![string match "" $exec_output] then { if ![string equal "" $exec_output] then {
unresolved "objcopy ($testname)" unresolved "objcopy ($testname)"
return return
} }
@ -971,7 +977,7 @@ proc objcopy_test_readelf {testname srcfile} {
return return
} }
set exec_output [prune_warnings [lindex $exec_output 1]] set exec_output [prune_warnings [lindex $exec_output 1]]
if ![string match "" $exec_output] then { if ![string equal "" $exec_output] then {
unresolved "objcopy ($testname)" unresolved "objcopy ($testname)"
return return
} }
@ -980,7 +986,7 @@ proc objcopy_test_readelf {testname srcfile} {
catch "exec diff tmpdir/bintest.o.out tmpdir/copy.o.out" exec_output catch "exec diff tmpdir/bintest.o.out tmpdir/copy.o.out" exec_output
set exec_output [prune_warnings $exec_output] set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then { if [string equal "" $exec_output] then {
pass "objcopy ($testname)" pass "objcopy ($testname)"
} else { } else {
fail "objcopy ($testname)" fail "objcopy ($testname)"