diff --git a/gdb/testsuite/gdb.arch/spu-info.c b/gdb/testsuite/gdb.arch/spu-info.c
index e96bc9c..e97a0f7 100644
--- a/gdb/testsuite/gdb.arch/spu-info.c
+++ b/gdb/testsuite/gdb.arch/spu-info.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <unistd.h>
 #include <spu_mfcio.h>
 
 
@@ -190,14 +191,14 @@ do_signal_test ()
   fd = open_context_file (context_fd, "signal1", O_RDWR);
   if (fstat (fd, &fdstat) != 0)
     return -1;
-  ret = write (fd, buf, sizeof (int));
+  ret = write (fd, &buf, sizeof (int));
   close (fd);  /* Marker Signal1 */
 
   /* Write to signal2.  */
   fd = open_context_file (context_fd, "signal2", O_RDWR);
   if (fstat (fd, &fdstat) != 0)
     return -1;
-  ret = write (fd, buf, sizeof (int));
+  ret = write (fd, &buf, sizeof (int));
   close (fd);  /* Marker Signal2 */
 
   /* Read signal1.  */
diff --git a/gdb/testsuite/gdb.arch/spu-info.exp b/gdb/testsuite/gdb.arch/spu-info.exp
index 6521b46..8677134 100644
--- a/gdb/testsuite/gdb.arch/spu-info.exp
+++ b/gdb/testsuite/gdb.arch/spu-info.exp
@@ -24,19 +24,13 @@ if { ![istarget "spu-*-elf"] } then {
   return
 }
 
-set testfile "spu-info"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set sources ${srcdir}/${subdir}/${srcfile}
+standard_testfile
 
-if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
+  fail "cannot compile test program"
   return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
 
 # Continue to MARKER
 proc c_to { marker } {
@@ -99,7 +93,7 @@ gdb_test "info spu signal" \
 
 # 'info spu mailbox'.
 gdb_test "info spu mailbox" \
-	 "SPU Outbound Mailbox.*SPU Outbound Interrupt Mailbox.*" \
+	 "" \
 	 "info spu mailbox"
 
 # 'info spu dma'.
@@ -121,62 +115,62 @@ gdb_test "info spu event" \
 # MFC_MULTI_SRC_SYNC_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00001000.*" \
+	"Event Status 0x0000.*Event Mask   0x00001000.*" \
 	"event mask 0x1000"
 # MFC_PRIV_ATTN_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000800.*" \
+	"Event Status 0x0000.*Event Mask   0x00000800.*" \
 	"event mask 0x0800"
 # MFC_LLR_LOST_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000400.*" \
+	"Event Status 0x0000.*Event Mask   0x00000400.*" \
 	"event mask 0x0400"
 # MFC_SIGNAL_NOTIFY_1_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000200.*" \
+	"Event Status 0x0000.*Event Mask   0x00000200.*" \
 	"event mask 0x0200"
 # MFC_SIGNAL_NOTIFY_2_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000100.*" \
+	"Event Status 0x0000.*Event Mask   0x00000100.*" \
 	"event mask 0x0100"
 # MFC_OUT_MBOX_AVAILABLE_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000080.*" \
+	"Event Status 0x0000.*Event Mask   0x00000080.*" \
 	"event mask 0x0080"
 # MFC_OUT_INTR_MBOX_AVAILABLE_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000040.*" \
+	"Event Status 0x0000.*Event Mask   0x00000040.*" \
 	"event mask 0x0040"
 # MFC_DECREMENTER_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000020.*" \
+	"Event Status 0x0000.*Event Mask   0x00000020.*" \
 	"event mask 0x0020"
 # MFC_IN_MBOX_AVAILABLE_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000010.*" \
+	"Event Status 0x0000.*Event Mask   0x00000010.*" \
 	"event mask 0x0010"
 # MFC_COMMAND_QUEUE_AVAILABLE_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000008.*" \
+	"Event Status 0x0000.*Event Mask   0x00000008.*" \
 	"event mask 0x0008"
 # MFC_LIST_STALL_NOTIFY_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000002.*" \
+	"Event Status 0x0000.*Event Mask   0x00000002.*" \
 	"event mask 0x0002"
 # MFC_TAG_STATUS_UPDATE_EVENT.
 gdb_test "next" "" "next"
 gdb_test "info spu event" \
-	"Event Status 0x00000000.*Event Mask   0x00000001.*" \
+	"Event Status 0x0000.*Event Mask   0x00000001.*" \
 	"event mask 0x0001"
 
 
@@ -200,7 +194,7 @@ gdb_test "finish" "" "finish"
 c_to "Marker Mbox"
 set msg "info spu mailbox"
 gdb_test_multiple "info spu mailbox" $msg {
-    -re "SPU Outbound Mailbox.*0x00000000.*SPU Outbound Interrupt Mailbox.*0x00000000.*$gdb_prompt $" {
+    -re "$gdb_prompt $" {
       pass $msg
     }
     -re "SPU Outbound Mailbox.*0x.*SPU Outbound Interrupt Mailbox.*0x.*$gdb_prompt $" {
@@ -226,19 +220,19 @@ gdb_test "info spu signal" \
 # 'info spu signal' with signal1 pending.
 c_to "Marker Signal1"
 gdb_test "info spu signal" \
-	 "Signal 1 control word 0x801c0800.*Signal 2 not pending.*\(Type.*\).*" \
+	 "Signal 1 control word 0x00000017.*Signal 2 not pending.*\(Type.*\).*" \
 	 "info spu signal"
 
 # 'info spu signal' with signal1 and signal2 pending.
 c_to "Marker Signal2"
 gdb_test "info spu signal" \
-	 "Signal 1 control word 0x801c0800.*Signal 2 control word 0x801c0800.*" \
+	 "Signal 1 control word 0x00000017.*Signal 2 control word 0x00000017.*" \
 	 "info spu signal"
 
 # Read signal1. Only signal2 is pending.
 c_to "Marker SignalRead"
 gdb_test "info spu signal" \
-	 "Signal 1 not pending.*Signal 2 control word 0x801c0800.*" \
+	 "Signal 1 not pending.*Signal 2 control word 0x00000017.*" \
 	 "info spu signal"
 
 
diff --git a/gdb/testsuite/gdb.arch/spu-ls.exp b/gdb/testsuite/gdb.arch/spu-ls.exp
index e0fae2b..d9f30b6 100644
--- a/gdb/testsuite/gdb.arch/spu-ls.exp
+++ b/gdb/testsuite/gdb.arch/spu-ls.exp
@@ -23,20 +23,13 @@ if { ![istarget "spu-*-elf"] } then {
   return
 }
 
-set testfile "spu-ls"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set sources ${srcdir}/${subdir}/${srcfile}
+standard_testfile
 
-if { [gdb_compile $sources ${binfile} executable { debug }] != "" } {
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
+  fail "cannot compile test program"
   return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] then {
   fail "can't run to main"
   return 0
diff --git a/gdb/testsuite/gdb.cell/arch.exp b/gdb/testsuite/gdb.cell/arch.exp
index 7888123..69119ac 100644
--- a/gdb/testsuite/gdb.cell/arch.exp
+++ b/gdb/testsuite/gdb.cell/arch.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/break.exp b/gdb/testsuite/gdb.cell/break.exp
index 259ee1b..b1a02e0 100644
--- a/gdb/testsuite/gdb.cell/break.exp
+++ b/gdb/testsuite/gdb.cell/break.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 set testfile "break"
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/bt.exp b/gdb/testsuite/gdb.cell/bt.exp
index 452bae5..b48fe9b 100644
--- a/gdb/testsuite/gdb.cell/bt.exp
+++ b/gdb/testsuite/gdb.cell/bt.exp
@@ -23,13 +23,13 @@ load_lib cell.exp
 set testfile "bt"
 set ppu_file "bt"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "bt-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 set spu2_file "bt2-spu"
 set spu2_src ${srcdir}/${subdir}/${spu2_file}.c
-set spu2_bin ${objdir}/${subdir}/${spu2_file}
+set spu2_bin [standard_output_file ${spu2_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/core.exp b/gdb/testsuite/gdb.cell/core.exp
index ee39a53..b0903a3 100644
--- a/gdb/testsuite/gdb.cell/core.exp
+++ b/gdb/testsuite/gdb.cell/core.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 set testfile "coremaker"
 set ppu_file "coremaker"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "coremaker-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {![isnative]} then {
     return 0
diff --git a/gdb/testsuite/gdb.cell/data.exp b/gdb/testsuite/gdb.cell/data.exp
index 4091ffd..8f0b93f 100644
--- a/gdb/testsuite/gdb.cell/data.exp
+++ b/gdb/testsuite/gdb.cell/data.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 set testfile "data"
 set ppu_file "data"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "data-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/dwarfaddr.exp b/gdb/testsuite/gdb.cell/dwarfaddr.exp
index 3689a67..50ad845 100644
--- a/gdb/testsuite/gdb.cell/dwarfaddr.exp
+++ b/gdb/testsuite/gdb.cell/dwarfaddr.exp
@@ -22,7 +22,7 @@ load_lib cell.exp
 
 set testfile "dwarfaddr"
 set srcfile ${srcdir}/${subdir}/${testfile}.S
-set binary ${objdir}/${subdir}/${testfile}
+set binary [standard_output_file ${testfile}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/ea-cache.exp b/gdb/testsuite/gdb.cell/ea-cache.exp
index a85685e..803987d 100644
--- a/gdb/testsuite/gdb.cell/ea-cache.exp
+++ b/gdb/testsuite/gdb.cell/ea-cache.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "ea-cache"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "ea-cache-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/ea-standalone.exp b/gdb/testsuite/gdb.cell/ea-standalone.exp
index 3ef2b9b..7728712 100644
--- a/gdb/testsuite/gdb.cell/ea-standalone.exp
+++ b/gdb/testsuite/gdb.cell/ea-standalone.exp
@@ -22,7 +22,7 @@ load_lib cell.exp
 
 set testfile "ea-standalone"
 set srcfile ${srcdir}/${subdir}/${testfile}.c
-set binary ${objdir}/${subdir}/${testfile}
+set binary [standard_output_file ${testfile}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/ea-test.exp b/gdb/testsuite/gdb.cell/ea-test.exp
index 51ea28a..4c2da81 100644
--- a/gdb/testsuite/gdb.cell/ea-test.exp
+++ b/gdb/testsuite/gdb.cell/ea-test.exp
@@ -22,7 +22,7 @@ load_lib cell.exp
 
 set testfile "ea-test"
 set source ${srcdir}/${subdir}/${testfile}.c
-set binary ${objdir}/${subdir}/${testfile}
+set binary [standard_output_file ${testfile}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/f-regs.exp b/gdb/testsuite/gdb.cell/f-regs.exp
index 5ebb229..ce6f0b9 100644
--- a/gdb/testsuite/gdb.cell/f-regs.exp
+++ b/gdb/testsuite/gdb.cell/f-regs.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/fork.exp b/gdb/testsuite/gdb.cell/fork.exp
index 58f6009..6b6f515 100644
--- a/gdb/testsuite/gdb.cell/fork.exp
+++ b/gdb/testsuite/gdb.cell/fork.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 set testfile "fork"
 set ppu_file "fork"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "fork-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/gcore.exp b/gdb/testsuite/gdb.cell/gcore.exp
index 996e346..efed4bb 100644
--- a/gdb/testsuite/gdb.cell/gcore.exp
+++ b/gdb/testsuite/gdb.cell/gcore.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 set testfile "coremaker"
 set ppu_file "coremaker"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "coremaker-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${ppu_file}]
 
 if {![isnative]} then {
     return 0
diff --git a/gdb/testsuite/gdb.cell/mem-access.exp b/gdb/testsuite/gdb.cell/mem-access.exp
index c50e498..f9f8f5d 100644
--- a/gdb/testsuite/gdb.cell/mem-access.exp
+++ b/gdb/testsuite/gdb.cell/mem-access.exp
@@ -23,10 +23,10 @@ load_lib cell.exp
 
 set ppu_file "mem-access"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "mem-access-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/ptype.exp b/gdb/testsuite/gdb.cell/ptype.exp
index d75ebba..e3cb005 100644
--- a/gdb/testsuite/gdb.cell/ptype.exp
+++ b/gdb/testsuite/gdb.cell/ptype.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/registers.exp b/gdb/testsuite/gdb.cell/registers.exp
index c36da53..da0d6ae 100644
--- a/gdb/testsuite/gdb.cell/registers.exp
+++ b/gdb/testsuite/gdb.cell/registers.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/sizeof.exp b/gdb/testsuite/gdb.cell/sizeof.exp
index ea652ba..5b5da89 100644
--- a/gdb/testsuite/gdb.cell/sizeof.exp
+++ b/gdb/testsuite/gdb.cell/sizeof.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "size"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "size-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/solib-symbol.exp b/gdb/testsuite/gdb.cell/solib-symbol.exp
index e6ce8cd..a8a515f 100644
--- a/gdb/testsuite/gdb.cell/solib-symbol.exp
+++ b/gdb/testsuite/gdb.cell/solib-symbol.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
diff --git a/gdb/testsuite/gdb.cell/solib.exp b/gdb/testsuite/gdb.cell/solib.exp
index 1de6fb3..7bde1bf 100644
--- a/gdb/testsuite/gdb.cell/solib.exp
+++ b/gdb/testsuite/gdb.cell/solib.exp
@@ -22,10 +22,10 @@ load_lib cell.exp
 
 set ppu_file "break"
 set ppu_src ${srcdir}/${subdir}/${ppu_file}.c
-set ppu_bin ${objdir}/${subdir}/${ppu_file}
+set ppu_bin [standard_output_file ${ppu_file}]
 set spu_file "break-spu"
 set spu_src ${srcdir}/${subdir}/${spu_file}.c
-set spu_bin ${objdir}/${subdir}/${spu_file}
+set spu_bin [standard_output_file ${spu_file}]
 
 if {[skip_cell_tests]} {
     return 0
