+
+ * binutils-all/objcopy.exp: If assembly fails, call unresolved.
+ Test running objcopy and strip on a final executable.
+ * binutils-all/testprog.c: New file.
+ * config/default.exp (STRIP, STRIPFLAGS): Define.
+ (binutils_compile): New procedure.
+ * lib/utils-lib.exp (default_binutils_compile): New procedure.
+
+
+ * lib/utils-lib.exp (default_binutils_run): Don't use verbose
+ -log, reverting part of Oct 2 change.
+
Wed Nov 1 15:09:57 1995 Manfred Hollstein KS/EF4A 60/1F/110 #40283 <
[email protected]>
* binutils-all/objcopy.exp: Add setup_xfails for
send_user "Version [binutil_version $OBJCOPY]"
-
if {![binutils_assemble $AS $srcdir$subdir/bintest.s tmpdir/bintest.o]} then {
+ unresolved "objcopy (simple copy)"
return
}
setup_xfail "sh-*-coff" "sh-*-hms"
setup_xfail "arm-*-pe"
setup_xfail "m68*-*-hpux*" "m68*-*-sunos*" "m68*-*-coff" "m68*-*-vxworks*"
- setup_xfail "m68*-ericsson-ose" "m68k*-motorola-sysv3*"
+ setup_xfail "m68*-ericsson-ose" "m68k*-motorola-sysv*"
setup_xfail "i*86-*-linuxaout*" "i*86-*-aout*"
setup_xfail "i*86-*-sysv*" "i*86-*-isc*" "i*86-*-sco*" "i*86-*-coff"
setup_xfail "i*86-*-aix*" "i*86-*-go32*"
setup_xfail "h8500-*-hms" "h8500-*-coff"
setup_xfail "hppa*-*-*"
clear_xfail "hppa*-*-*elf*"
- setup_xfail "m88*-*-coff" "m88*-motorola-sysv3*"
+ setup_xfail "m88*-*-coff" "m88*-motorola-sysv*"
setup_xfail "z8*-*-coff"
if [string match "" $exec_output] then {
}
}
}
+
+# Test stripping an object.
+
+proc strip_test { } {
+ global CC
+ global STRIP
+ global STRIPFLAGS
+ global NM
+ global NMFLAGS
+ global srcdir
+ global subdir
+
+ set test "strip"
+
+ if { [which $CC] == 0 } {
+ untested $test
+ return
+ }
+
+ if ![binutils_compile $CC "-g -c" $srcdir/$subdir/testprog.c tmpdir/testprog.o] {
+ unresolved $test
+ return
+ }
+
+ set exec_output [binutils_run $STRIP "$STRIPFLAGS tmpdir/testprog.o"]
+ if ![string match "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run $NM "-a $NMFLAGS tmpdir/testprog.o"]
+ if ![string match "No symbols in *" $exec_output] {
+ fail $test
+ return
+ }
+
+ pass $test
+}
+
+strip_test
+
+# Build a final executable.
+
+proc copy_setup { } {
+ global CC
+ global srcdir
+ global subdir
+
+ if ![isnative] {
+ return 1
+ }
+
+ if { [which $CC] == 0 } {
+ return 2
+ }
+
+ if ![binutils_compile $CC "-g" $srcdir/$subdir/testprog.c tmpdir/testprog] {
+ return 3
+ }
+
+ set exec_output [binutils_run tmpdir/testprog ""]
+ if ![string match "ok" $exec_output] {
+ return 3
+ }
+
+ return 0
+}
+
+# Test copying an executable.
+
+proc copy_executable { prog flags test1 test2 } {
+
+ set exec_output [binutils_run $prog "$flags tmpdir/testprog tmpdir/copyprog"]
+ if ![string match "" $exec_output] {
+ fail $test1
+ fail $test2
+ return
+ }
+
+ set exec_output [binutils_run "cmp" "tmpdir/testprog tmpdir/copyprog"]
+
+ if [string match "" $exec_output] then {
+ pass $test1
+ } else {
+ send_log "$exec_output\n"
+ verbose "$exec_output"
+ # This will fail for many reasons. For example, it will most
+ # likely fail if the system linker is used. Therefore, we do
+ # not insist that it pass. If you are using an assembler and
+ # linker based on the same BFD as objcopy, it is worth
+ # investigating to see why this failure occurs.
+ setup_xfail "*-*-*"
+ fail $test1
+ }
+
+ set exec_output [binutils_run tmpdir/copyprog ""]
+ if ![string match "ok" $exec_output] {
+ fail $test2
+ } else {
+ pass $test2
+ }
+}
+
+# Test stripping an executable
+
+proc strip_executable { prog flags test } {
+
+ set exec_output [binutils_run $prog "$flags tmpdir/copyprog"]
+ if ![string match "" $exec_output] {
+ fail $test
+ return
+ }
+
+ set exec_output [binutils_run tmpdir/copyprog ""]
+ if ![string match "ok" $exec_output] {
+ fail $test
+ } else {
+ pass $test
+ }
+}
+
+set test1 "simple objcopy of executable"
+set test2 "run objcopy of executable"
+set test3 "run stripped executable"
+
+switch [copy_setup] {
+ "1" {
+ # do nothing
+ }
+ "2" {
+ untested $test1
+ untested $test2
+ untested $test3
+ }
+ "3" {
+ unresolved $test1
+ unresolved $test2
+ unresolved $test3
+ }
+ "0" {
+ copy_executable "$OBJCOPY" "$OBJCOPYFLAGS" "$test1" "$test2"
+ strip_executable "$STRIP" "$STRIPFLAGS" "$test3"
+ }
+}