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]

Re: [patch]: Improve spu-info testcase


Ulrich Weigand schrieb:
Can we change the test to either use a pre-existing file (/dev/zero ?), or else
move allocating/deleting the file to the DejaGnu script instead and pass the
file name to the test case?  That way we can probably more easily adapt to
local vs. cross debugging, and make sure the file is deleted in every case
(even if debugging crashes).

The testcase now defines (and deletes after usage) a temporary file which is given to the SPU binary as command line argument. If the SPU binary doesn't receive a command line
argument it falls back to the default file in /var/tmp.


Ok ?

ChangeLog:

	* gdb.arch/spu-info.exp (tmp_file): Introduce temporary file and set
	it as command line argument for test binary.  Delete after usage.
	* gdb.arch/spu-info.c (main): Receive command line arguments.
	(do_dma_test): Add file paramater.


Regards, Markus

--
 Markus Deuling
 GNU Toolchain for Linux on Cell BE
 deuling@de.ibm.com

diff -urpN src/gdb/testsuite/gdb.arch/spu-info.c dev/gdb/testsuite/gdb.arch/spu-info.c
--- src/gdb/testsuite/gdb.arch/spu-info.c	2008-01-01 23:53:18.000000000 +0100
+++ dev/gdb/testsuite/gdb.arch/spu-info.c	2008-06-25 08:01:40.000000000 +0200
@@ -124,14 +124,13 @@ do_event_test ()
 }
 
 int
-do_dma_test ()
+do_dma_test (char *file)
 {
   #define MAP_FAILED      (-1ULL)
   #define PROT_READ       0x1
   #define MAP_PRIVATE     0x002
   #define BSIZE 128
   static char buf[BSIZE] __attribute__ ((aligned (128)));
-  char *file = "/var/tmp/tmp_buf";
   struct stat fdstat;
   int fd, cnt;
   unsigned long long src;
@@ -211,9 +210,7 @@ do_signal_test ()
   return 0;
 }
 
-int
-main (unsigned long long speid, unsigned long long argp, 
-      unsigned long long envp)
+int main (int argc, char **argv)
 {
   int res;
 
@@ -221,7 +218,10 @@ main (unsigned long long speid, unsigned
   res = do_event_test ();
 
   /* info spu dma  */
-  res = do_dma_test ();
+  if (argc == 2)
+    res = do_dma_test (argv[1]);
+  else
+    res = do_dma_test ("/var/tmp/tmp_buf");
 
   /* info spu mailbox  */
   res = do_mailbox_test ();
diff -urpN src/gdb/testsuite/gdb.arch/spu-info.exp dev/gdb/testsuite/gdb.arch/spu-info.exp
--- src/gdb/testsuite/gdb.arch/spu-info.exp	2008-03-31 10:34:42.000000000 +0200
+++ dev/gdb/testsuite/gdb.arch/spu-info.exp	2008-06-25 08:07:51.000000000 +0200
@@ -31,7 +31,7 @@ set srcfile ${testfile}.c
 set binfile ${objdir}/${subdir}/${testfile}
 set sources ${srcdir}/${subdir}/${srcfile}
 
-if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
+if { [gdb_compile $sources ${binfile} executable { debug additional_flags=-mstdmain }] != "" } {
   return -1
 }
 
@@ -40,6 +40,13 @@ gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
+set tmp_file ""
+if { [info exists env(PWD)] &&
+     [info exists env(USER)] } then {
+  set tmp_file $env(PWD)/gdb_spu_info_$env(USER)
+  gdb_test "set args $tmp_file" "" ""
+}
+
 # Continue to MARKER
 proc c_to { marker } {
   global srcfile
@@ -52,8 +59,6 @@ proc c_to { marker } {
 	   "continue to $line"
 }
 
-
-
 if ![runto_main] then {
   fail "Can't run to main"
   return 0
@@ -186,14 +191,14 @@ gdb_test "info spu event" \
 # 'info spu dma' should be empty.
 c_to "Marker DMA"
 gdb_test "info spu dma" \
-	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000000.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \
+	 "Tag-Group Status.*0x00000001.*Tag-Group Mask.*0x00000001.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*0.*0.*0.*0.*0x00000 0x00000.*" \
 	 "info spu dma (empty)"
 
 # 'info spu dma' should be filled with some data.
 c_to "Marker DMAWait"
 gdb_test "next" "" "next"
 gdb_test "info spu dma" \
-	 "Tag-Group Status.*0x00000000.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \
+	 "Tag-Group Status.*0x00000001.*Tag-Group Mask.*0x00000020.*Stall-and-Notify.*0x00000000.*Atomic Cmd Status.*0x00000000.*Opcode.*Tag.*TId.*RId.*EA.*LSA.*Size.*LstAddr.*LstSize.*E.*getl.*putllc.*get.*mfcsync.*get.*0.*0.*0.*0.*0x00000 0x00000.*" \
 	 "info spu dma (non-empty)"
 gdb_test "finish" "" "finish"
 
@@ -245,5 +250,7 @@ gdb_test "info spu signal" \
 
 
 gdb_exit
-
+if { [file exists $tmp_file] } then {
+  file delete $tmp_file
+}
 return 0

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