X-Git-Url: https://oss.titaniummirror.com/gitweb?p=msp430-binutils.git;a=blobdiff_plain;f=binutils%2Ftestsuite%2Fbinutils-all%2Fobjcopy.exp;fp=binutils%2Ftestsuite%2Fbinutils-all%2Fobjcopy.exp;h=de9b11670eaf9d12034662fa53ff1d55047332e5;hp=e05e622fb26e60ad9f4a39abc6addeb9cc9b7097;hb=88750007d7869f178f0ba528f41efd3b74c424cf;hpb=6df9443a374e2b81278c61b8afc0a1eef7db280b diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index e05e622..de9b116 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -1,5 +1,5 @@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -# 2004, 2006, 2007 +# 2004, 2006, 2007, 2009 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify @@ -194,7 +194,7 @@ if ![string match "" $got] then { verbose $line fail "objcopy -O srec" } else { - set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"] + set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"] if ![regexp "file format srec" $got] then { send_log "objdump failed\n" fail "objcopy -O srec" @@ -485,6 +485,7 @@ proc copy_setup { } { global subdir global gcc_gas_flag global test_prog + global host_triplet set res [build_wrapper testglue.o] set flags { debug } @@ -513,8 +514,11 @@ proc copy_setup { } { set status [lindex $result 0] if { $status != "pass" } { - send_log "cannot run executable, status = ${status}\n" - return 3 + send_log "cannot run executable, status = ${status} on ${host_triplet}\n" + if { [istarget $host_triplet] } { + return 3 + } + set status "pass" } return 0 @@ -524,6 +528,7 @@ proc copy_setup { } { proc copy_executable { prog flags test1 test2 } { global test_prog + global host_triplet if [is_remote host] { set testfile [remote_download host tmpdir/$test_prog] @@ -578,6 +583,8 @@ proc copy_executable { prog flags test1 test2 } { setup_xfail "arm*-*-pe" setup_xfail "thumb*-*-coff" setup_xfail "thumb*-*-pe" + setup_xfail "x86_64-*-mingw*" + setup_xfail "*-*-cygwin*" fail $test1 } @@ -588,6 +595,9 @@ proc copy_executable { prog flags test1 test2 } { set output [remote_load target tmpdir/copyprog] set status [lindex $output 0] + if { ![istarget $host_triplet] } { + set status "pass" + } if { $status != "pass" } { fail $test2 } else { @@ -600,7 +610,9 @@ proc copy_executable { prog flags test1 test2 } { proc strip_executable { prog flags test } { global NM global NMFLAGS + global host_triplet + remote_file build delete tmpdir/striprog remote_download build tmpdir/copyprog tmpdir/striprog if [is_remote host] { set copyfile [remote_download host tmpdir/striprog] @@ -620,6 +632,9 @@ proc strip_executable { prog flags test } { 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 @@ -638,7 +653,9 @@ proc strip_executable { prog flags test } { proc strip_executable_with_saving_a_symbol { prog flags test } { global NM global NMFLAGS + global host_triplet + remote_file build delete tmpdir/striprog remote_download build tmpdir/copyprog tmpdir/striprog if [is_remote host] { set copyfile [remote_download host tmpdir/striprog] @@ -658,6 +675,9 @@ proc strip_executable_with_saving_a_symbol { prog flags test } { 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 @@ -681,10 +701,41 @@ proc strip_executable_with_saving_a_symbol { prog flags test } { pass $test } +# Test keeping only debug symbols of an executable + +proc keep_debug_symbols_and_test_copy { prog1 flags1 test1 prog2 flags2 test2 } { + global NM + global NMFLAGS + + remote_file build delete tmpdir/striprog + remote_download build tmpdir/copyprog tmpdir/striprog + if [is_remote host] { + set copyfile [remote_download host tmpdir/striprog] + } else { + set copyfile tmpdir/striprog + } + + set exec_output [binutils_run $prog1 "$flags1 ${copyfile}"] + if ![string match "" $exec_output] { + fail $test1 + return + } + pass $test1 + + set exec_output [binutils_run $prog2 "$flags2 ${copyfile}"] + if ![string match "" $exec_output] { + fail $test2 + return + } + pass $test2 +} + set test1 "simple objcopy of executable" set test2 "run objcopy of executable" set test3 "run stripped executable" set test4 "run stripped executable with saving a symbol" +set test5 "keep only debug data" +set test6 "simple objcopy of debug data" switch [copy_setup] { "1" { @@ -695,17 +746,23 @@ switch [copy_setup] { untested $test2 untested $test3 untested $test4 + untested $test5 + untested $test6 } "3" { copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "" unsupported $test2 unsupported $test3 unsupported $test4 + unsupported $test5 + unsupported $test6 } "0" { copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2" strip_executable "$STRIP" "$STRIPFLAGS" "$test3" strip_executable_with_saving_a_symbol "$STRIP" "-K main -K _main $STRIPFLAGS" "$test4" + keep_debug_symbols_and_test_copy "$STRIP" "--only-keep-debug $STRIPFLAGS" "$test5" \ + "$OBJCOPY" "$OBJCOPYFLAGS" "$test6" } } @@ -722,23 +779,32 @@ proc objcopy_test_readelf {testname srcfile} { } verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o" - catch "exec $OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o" exec_output - if ![string match "" $exec_output] then { + set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"] + if { [lindex $exec_output 0] != 0 + || ![string match "" [lindex $exec_output 1]] } then { fail "objcopy ($testname)" return } verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out" - catch "exec $READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out" exec_output - set exec_output [prune_warnings $exec_output] + set exec_output [remote_exec host "$READELF -a tmpdir/bintest.o" "" "/dev/null" "tmpdir/bintest.o.out"] + if { [lindex $exec_output 0] != 0 } then { + unresolved "objcopy ($testname)" + return + } + set exec_output [prune_warnings [lindex $exec_output 1]] if ![string match "" $exec_output] then { unresolved "objcopy ($testname)" return } verbose -log "$READELF -a tmpdir/copy.o > tmpdir/copy.o.out" - catch "exec $READELF -a tmpdir/copy.o > tmpdir/copy.o.out" exec_output - set exec_output [prune_warnings $exec_output] + set exec_output [remote_exec host "$READELF -a tmpdir/copy.o" "" "/dev/null" "tmpdir/copy.o.out"] + if { [lindex $exec_output 0] != 0 } then { + unresolved "objcopy ($testname)" + return + } + set exec_output [prune_warnings [lindex $exec_output 1]] if ![string match "" $exec_output] then { unresolved "objcopy ($testname)" return @@ -765,16 +831,27 @@ if { ([istarget "ia64-*-elf*"] if [is_elf_format] { objcopy_test "ELF unknown section type" unknown.s objcopy_test_readelf "ELF group" group.s + objcopy_test_readelf "ELF group" group-2.s + objcopy_test_readelf "ELF group" group-3.s + objcopy_test_readelf "ELF group" group-4.s run_dump_test "copy-1" } run_dump_test "copy-2" run_dump_test "copy-3" +run_dump_test "copy-4" if [is_elf_format] { run_dump_test "strip-1" run_dump_test "strip-2" run_dump_test "strip-3" + run_dump_test "strip-4" + run_dump_test "strip-5" + run_dump_test "strip-6" + run_dump_test "strip-7" + run_dump_test "strip-8" + run_dump_test "strip-9" + run_dump_test "strip-10" if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } { # Check to make sure we don't strip a symbol named in relocations. @@ -796,5 +873,7 @@ if [is_elf_format] { } run_dump_test "localize-hidden-1" + run_dump_test "testranges" + run_dump_test "testranges-ia64" } run_dump_test "localize-hidden-2"