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]

[patch]: Improve spu-info testcase


Hello,

if multiple users on the same machine run the testsuite for spu-gdb, gdb.arch/spu-info will fail because of access priviliges to the temporary file. This file is created in /var/tmp currently. With this patch I changed
the naming of the file (using speid to seperate different runs) and the location (user dir).


Ok ?


ChangeLog:


	* gdb.arch/spu-info.c  (do_dma_test): Add speid paramter. Change name
	of temporary file to include speid. Delete it after use.
	(main): Update call to do_dma_test.



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

diff -urpN src-orig/gdb/testsuite/gdb.arch/spu-info.c src/gdb/testsuite/gdb.arch/spu-info.c
--- src-orig/gdb/testsuite/gdb.arch/spu-info.c	2008-01-01 23:53:18.000000000 +0100
+++ src/gdb/testsuite/gdb.arch/spu-info.c	2008-06-20 06:32:20.000000000 +0200
@@ -124,19 +124,20 @@ do_event_test ()
 }
 
 int
-do_dma_test ()
+do_dma_test (unsigned long long speid)
 {
   #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";
+  char file[32];
   struct stat fdstat;
   int fd, cnt;
   unsigned long long src;
 
   /* Create a file and fill it with some bytes.  */
+  snprintf (file, sizeof(file), "tmp_buf_%lld", speid);
   fd = open (file, O_CREAT | O_RDWR | O_TRUNC, 0777);
   if (fd == -1)
     return -1;
@@ -158,8 +159,9 @@ do_dma_test ()
   mfc_write_tag_mask (1<<5);   /* Marker DMAWait */
   spu_mfcstat (MFC_TAG_UPDATE_ALL);
 
-  /* Close the file.  */
+  /* Close and delete the file.  */
   close (fd);
+  unlink (file);
 
   return cnt;
 }
@@ -221,7 +223,7 @@ main (unsigned long long speid, unsigned
   res = do_event_test ();
 
   /* info spu dma  */
-  res = do_dma_test ();
+  res = do_dma_test (speid);
 
   /* info spu mailbox  */
   res = do_mailbox_test ();

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