This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: convert gdb.asm


I'm checking this in.

This converts gdb.asm to use the new test suite procs.

It also fixes a bug where gdb.asm built the object files directly in
".".  This is wrong because it can cause hidden parallelization bugs,
should any other test case happen to use the same file names.  (Unlikely
in this instance, but still.)

Regtested on x86-64 Fedora 16.

Tom

2012-06-25  Tom Tromey  <tromey@redhat.com>

	* gdb.asm/asm-source.exp: Use standard_output_file,
	standard_testfile.  Construct .o files in proper subdir.

Index: gdb.asm/asm-source.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.asm/asm-source.exp,v
retrieving revision 1.86
diff -u -r1.86 asm-source.exp
--- gdb.asm/asm-source.exp	16 Jan 2012 16:21:44 -0000	1.86
+++ gdb.asm/asm-source.exp	25 Jun 2012 20:09:39 -0000
@@ -27,12 +27,14 @@
 set link-flags "-e _start"
 set debug-flags ""
 
+set obj_include -I[standard_output_file {}]
+
 switch -glob -- [istarget] {
     "alpha*-*-*" {
         set asm-arch alpha
 	# ??? Won't work with ecoff systems like Tru64, but then we also
 	# don't have any other -g flag that creates mdebug output.
-        set asm-flags "-no-mdebug -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-no-mdebug -I${srcdir}/${subdir} $obj_include"
 	set debug-flags "-gdwarf-2"
     }
     "arm*-*-*" {
@@ -72,7 +74,7 @@
     }
     "m6811-*-*" {
         set asm-arch m68hc11
-        set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-mshort-double -m68hc11 --no-warn -I${srcdir}/${subdir} $obj_include"
 	set debug-flags "-gdwarf-2"
 	# This asm test is specific and uses the linker directly.
 	# We must not use the target board linker script defined for other
@@ -83,7 +85,7 @@
     }
     "m6812-*-*" {
         set asm-arch m68hc11
-        set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-mshort-double -m68hc12 --no-warn -I${srcdir}/${subdir} $obj_include"
 	set debug-flags "-gdwarf-2"
 	# This asm test is specific and uses the linker directly.
 	# We must not use the target board linker script defined for other
@@ -98,11 +100,11 @@
     "powerpc*-*" {
         if { [is_lp64_target] } {
             set asm-arch powerpc64
-            set asm-flags "-a64 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            set asm-flags "-a64 -I${srcdir}/${subdir} $obj_include"
             append link-flags " -m elf64ppc"
         } else {
             set asm-arch powerpc
-            set asm-flags "-a32 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+            set asm-flags "-a32 -I${srcdir}/${subdir} $obj_include"
             append link-flags " -m elf32ppc"
         }
     }
@@ -115,12 +117,12 @@
     }
     "sparc64-*-*" {
         set asm-arch sparc64
-        set asm-flags "-xarch=v9 -I${srcdir}/${subdir} -I${objdir}/${subdir}"
+        set asm-flags "-xarch=v9 -I${srcdir}/${subdir} $obj_include"
 	set debug-flags "-gdwarf-2"
     }
     "spu*-*-*" {
        set asm-arch spu
-       set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir} --no-warn"
+       set asm-flags "-I${srcdir}/${subdir} $obj_include --no-warn"
        set debug-flags "-gdwarf-2"
     }
     "xstormy16-*-*" {
@@ -196,10 +198,7 @@
 	 }
 }
 
-set testfile "asm-source"
-set binfile ${objdir}/${subdir}/${testfile}
-set srcfile1 asmsrc1.s
-set srcfile2 asmsrc2.s
+standard_testfile asmsrc1.s asmsrc2.s
 
 remote_exec build "rm -f ${subdir}/arch.inc"
 remote_download host ${srcdir}/${subdir}/${asm-arch}.inc ${subdir}/arch.inc
@@ -207,7 +206,7 @@
 remote_download host ${srcdir}/${subdir}/${asm-note}.inc ${subdir}/note.inc
 
 if { [string equal ${asm-flags} ""] } {
-    set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
+    set asm-flags "-I${srcdir}/${subdir} $obj_include"
 }
 
 if { [string equal ${debug-flags} ""] } {
@@ -239,11 +238,14 @@
 # The GNU assembler does not support level options like "-g2" or "-g3".
 regsub "--" "-g\[0-9\]" "${debug-flags}" "" debug-flags
 
-if {[target_assemble ${srcdir}/${subdir}/${srcfile1} asmsrc1.o "${asm-flags} ${debug-flags}"] != ""} then {
+set asm1obj [standard_output_file asmrc1.o]
+set asm2obj [standard_output_file asmrc2.o]
+
+if {[target_assemble ${srcdir}/${subdir}/${srcfile} $asm1obj "${asm-flags} ${debug-flags}"] != ""} then {
      untested asm-source.exp
      return -1
 }
-if {[target_assemble ${srcdir}/${subdir}/${srcfile2} asmsrc2.o "${asm-flags} ${debug-flags}"] != ""} then {
+if {[target_assemble ${srcdir}/${subdir}/${srcfile2} $asm2obj "${asm-flags} ${debug-flags}"] != ""} then {
      untested asm-source.exp
      return -1
 }
@@ -254,7 +256,7 @@
 # code here that provides its own startup code.  Using target_link
 # also avoids a lot of problems on many systems, most notably on
 # *-*-*bsd* and *-*-solaris2*.
-if {[target_link "asmsrc1.o asmsrc2.o" "${binfile}" ${link-flags}] != "" } then {
+if {[target_link [list $asm1obj $asm2obj] "${binfile}" ${link-flags}] != "" } then {
      untested asm-source.exp
      return -1
 }
@@ -264,8 +266,6 @@
     set_board_info ldscript $old_ldscript
 }
 
-remote_exec build "mv asmsrc1.o asmsrc2.o ${objdir}/${subdir}"
-
 # Collect some line numbers.
 set line_main       [expr [gdb_get_line_number "main start" "asmsrc1.s"] + 1]
 set line_call_foo2  [expr [gdb_get_line_number "call foo2"  "asmsrc1.s"] + 1]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]