Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [patch]: Improve spu-info testcase
Date: Wed, 25 Jun 2008 12:43:00 -0000	[thread overview]
Message-ID: <4861E262.909@de.ibm.com> (raw)
In-Reply-To: <200806241915.m5OJFML0013250@d12av02.megacenter.de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 959 bytes --]

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


[-- Attachment #2: diff-spu-info --]
[-- Type: text/plain, Size: 3590 bytes --]

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

  reply	other threads:[~2008-06-25  6:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 12:23 Markus Deuling
2008-06-24 19:30 ` Ulrich Weigand
2008-06-25 12:43   ` Markus Deuling [this message]
2008-07-16 19:29     ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4861E262.909@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox