* [patch]: Improve spu-info testcase
@ 2008-06-20 12:23 Markus Deuling
2008-06-24 19:30 ` Ulrich Weigand
0 siblings, 1 reply; 4+ messages in thread
From: Markus Deuling @ 2008-06-20 12:23 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 590 bytes --]
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
[-- Attachment #2: diff-spu-info --]
[-- Type: text/plain, Size: 1329 bytes --]
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 ();
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch]: Improve spu-info testcase
2008-06-20 12:23 [patch]: Improve spu-info testcase Markus Deuling
@ 2008-06-24 19:30 ` Ulrich Weigand
2008-06-25 12:43 ` Markus Deuling
0 siblings, 1 reply; 4+ messages in thread
From: Ulrich Weigand @ 2008-06-24 19:30 UTC (permalink / raw)
To: Markus Deuling; +Cc: GDB Patches
Markus Deuling wrote:
> 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).
speid isn't really guaranteed to be different (it's just a pointer to an allocated
structure of libspe2) ...
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).
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch]: Improve spu-info testcase
2008-06-24 19:30 ` Ulrich Weigand
@ 2008-06-25 12:43 ` Markus Deuling
2008-07-16 19:29 ` Ulrich Weigand
0 siblings, 1 reply; 4+ messages in thread
From: Markus Deuling @ 2008-06-25 12:43 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: GDB Patches
[-- 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
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch]: Improve spu-info testcase
2008-06-25 12:43 ` Markus Deuling
@ 2008-07-16 19:29 ` Ulrich Weigand
0 siblings, 0 replies; 4+ messages in thread
From: Ulrich Weigand @ 2008-07-16 19:29 UTC (permalink / raw)
To: Markus Deuling; +Cc: GDB Patches
Markus Deuling wrote:
> * 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.
Sorry for the late reply ...
> @@ -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");
I'd prefer this gets passed *always* as argument, and the .exp script
chooses the name ...
> +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" "" ""
> +}
... because I think we should just use a name in the directory where
the tests execute anyway. Other tests do it likewise (e.g. the corefile
tests).
> 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)"
> - "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)"
This seem to be unrelated changes; are they deliberate?
If so, they need to be mentioned in the ChangeLog.
> +if { [file exists $tmp_file] } then {
> + file delete $tmp_file
> +}
This will not work for remote tests; you should use
remote_file build delete
like e.g. corefile.exp does.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-07-16 19:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 12:23 [patch]: Improve spu-info testcase Markus Deuling
2008-06-24 19:30 ` Ulrich Weigand
2008-06-25 12:43 ` Markus Deuling
2008-07-16 19:29 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox