[Cbe-oss-dev] [PATCH 5/5] libspe2: Add more informative error messages to tests

Kazunori Asayama asayama at sm.sony.co.jp
Thu Apr 24 22:44:05 EST 2008


This patch modifies the error messages to provide more detailed
information.

Signed-off-by: Kazunori Asayama <asayama at sm.sony.co.jp>
---
 tests/libspe2.c99/test_c99_main.c             |   11 ++--
 tests/libspe2.event/test_event_error.c        |    8 ++-
 tests/libspe2.mfc/test_dma.c                  |    8 +--
 tests/libspe2.mfc/test_dma_page_fault.c       |   14 +++---
 tests/libspe2.mfc/test_dma_stop.c             |    8 +--
 tests/libspe2.mfc/test_ibox.c                 |   11 +++-
 tests/libspe2.mfc/test_ibox_simultaneous.c    |   13 +++--
 tests/libspe2.mfc/test_ibox_stop.c            |   13 +++--
 tests/libspe2.mfc/test_mbox.c                 |   10 ++--
 tests/libspe2.mfc/test_mbox_all.c             |    7 +--
 tests/libspe2.mfc/test_mbox_simultaneous.c    |   12 +++--
 tests/libspe2.mfc/test_proxy_dma.c            |    4 -
 tests/libspe2.mfc/test_proxy_dma_poll.c       |    4 -
 tests/libspe2.mfc/test_signal.c               |    4 -
 tests/libspe2.mfc/test_wbox.c                 |    8 ++-
 tests/libspe2.mfc/test_wbox_simultaneous.c    |   13 +++--
 tests/libspe2.run/test_affinity.c             |   12 +++--
 tests/libspe2.run/test_affinity_error.c       |   59 ++++++++++++++------------
 tests/libspe2.run/test_context_create_error.c |    2 
 tests/libspe2.run/test_cpu_info.c             |   22 ++++-----
 tests/libspe2.run/test_direct_access.c        |   30 ++++++-------
 tests/libspe2.run/test_multiple_context.c     |    9 ++-
 tests/libspe2.run/test_ppe_assisted_call.c    |   15 +++---
 tests/libspe2.run/test_run_error.c            |   12 ++---
 tests/libspe2.run/test_run_image.c            |   15 +++---
 tests/libspe2.run/test_single_context.c       |   13 +++--
 tests/libspe2.run/test_single_gang_context.c  |   18 +++----
 tests/libspe2.run/test_stop.c                 |    7 +--
 28 files changed, 200 insertions(+), 162 deletions(-)

Index: b/tests/libspe2.run/test_affinity.c
===================================================================
--- a/tests/libspe2.run/test_affinity.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_affinity.c	2008-04-24 18:31:01.000000000 +0900
@@ -45,7 +45,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(spe, &spu_arg)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load: %s\n", strerror(errno));
     fatal();
   }
 
@@ -59,7 +59,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run: %s\n", strerror(errno));
     fatal();
   }
 
@@ -87,10 +87,12 @@ static int test_affinity(int mem_p, int 
     }
 
     for (j = 0; j < NUM_SPES; j++) {
-      spes[j] = spe_context_create_affinity(mem_p ? (j ? 0 : SPE_AFFINITY_MEMORY) : 0,
-					    spu_p ? (j ? spes[j - 1] : NULL) : NULL, gang);
+      unsigned int flags = mem_p ? (j ? 0 : SPE_AFFINITY_MEMORY) : 0;
+      spe_context_ptr_t neighbor = spu_p ? (j ? spes[j - 1] : NULL) : NULL;
+      spes[j] = spe_context_create_affinity(flags, neighbor, gang);
       if (!spes[j]) {
-	eprintf("spe_context_create_affinity: %s\n", strerror(errno));
+	eprintf("spe_context_create_affinity(0x%08x, %p, %p): %s\n",
+		flags, neighbor, gang, strerror(errno));
 	fatal();
       }
     }
Index: b/tests/libspe2.run/test_affinity_error.c
===================================================================
--- a/tests/libspe2.run/test_affinity_error.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_affinity_error.c	2008-04-24 18:31:01.000000000 +0900
@@ -41,7 +41,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(spes[ppe->index], &spu_null)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load: %s\n", strerror(errno));
     fatal();
   }
 
@@ -52,7 +52,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run: %s\n", strerror(errno));
     fatal();
   }
 
@@ -79,7 +79,8 @@ static int test(int argc, char **argv)
 
   spes[num_spes] = spe_context_create_affinity(SPE_AFFINITY_MEMORY, NULL, gang);
   if (!spes[num_spes]) {
-    eprintf("spe_context_create_affinity: %s\n", strerror(errno));
+    eprintf("spe_context_create_affinity(SPE_AFFINITY_MEMORY, NULL, %p): %s\n",
+	    gang, strerror(errno));
     fatal();
   }
   num_spes++;
@@ -87,59 +88,64 @@ static int test(int argc, char **argv)
   /* check # of SPEs */
   max_spes_per_be = spe_cpu_info_get(SPE_COUNT_USABLE_SPES, 0);
   if (max_spes_per_be < 0) {
-    eprintf("SPE_COUNT_USABLE_SPES, %s\n", strerror(errno));
+    eprintf("spe_cpu_info_get(SPE_COUNT_USABLE_SPES, 0): %s\n", strerror(errno));
     fatal();
   }
 
   /* check EEXIST cases */
   spes[num_spes] = spe_context_create_affinity(SPE_AFFINITY_MEMORY, NULL, gang);
   if (spes[num_spes]) {
-    eprintf("spe_context_create_affinity: unexpected success.\n");
+    eprintf("spe_context_create_affinity(SPE_AFFINITY_MEMORY, NULL, %p): unexpected success.\n",
+	    gang);
     fatal();
   }
   else if (errno != EEXIST) {
-    eprintf("spe_context_create_affinity: unexpected errno: %d (%s)\n",
-	    errno, strerror(errno));
+    eprintf("spe_context_create_affinity(SPE_AFFINITY_MEMORY, NULL, %p): unexpected errno: %d (%s)\n",
+	    gang, errno, strerror(errno));
     failed();
   }
 
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang);
   if (!spes[num_spes]) {
-    eprintf("spe_context_create_affinity: %s.\n", strerror(errno));
+    eprintf("spe_context_create_affinity(0, %p, %p): %s.\n",
+	    spes[num_spes - 1], gang, strerror(errno));
     fatal();
   }
   num_spes++;
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang);
   if (!spes[num_spes]) {
-    eprintf("spe_context_create_affinity: %s.\n", strerror(errno));
+    eprintf("spe_context_create_affinity(0, %p, %p): %s.\n",
+	    spes[num_spes - 1], gang, strerror(errno));
     fatal();
   }
   num_spes++;
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 2], gang);
   if (spes[num_spes]) {
-    eprintf("spe_context_create_affinity: unexpected success.\n");
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected success.\n",
+	    spes[num_spes - 2], gang);
     fatal();
   }
   else if (errno != EEXIST) {
-    eprintf("spe_context_create_affinity: unexpected errno: %d (%s)\n",
-	    errno, strerror(errno));
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected errno: %d (%s)\n",
+	    spes[num_spes - 2], gang, errno, strerror(errno));
     failed();
   }
 
   /* check ESRCH cases */
   gang2 = spe_gang_context_create(0);
   if (!gang2) {
-    eprintf("spe_gang_context_create: %s\n", strerror(errno));
+    eprintf("spe_gang_context_create(0): %s\n", strerror(errno));
     fatal();
   }
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang2);
   if (spes[num_spes]) {
-    eprintf("spe_context_create_affinity: unexpected success.\n");
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected success.\n",
+	    spes[num_spes - 1], gang2);
     fatal();
   }
   ret = spe_gang_context_destroy(gang2);
   if (ret) {
-    eprintf("spe_gang_context_destroy: %s\n", strerror(errno));
+    eprintf("spe_gang_context_destroy(%p): %s\n", gang2, strerror(errno));
     fatal();
   }
 
@@ -147,19 +153,21 @@ static int test(int argc, char **argv)
   for (i = num_spes; i < max_spes_per_be; i++) {
     spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang);
     if (!spes[num_spes]) {
-      eprintf("spe_context_create_affinity: %s.\n", strerror(errno));
+      eprintf("spe_context_create_affinity(0, %p, %p): %s.\n",
+	      spes[num_spes - 1], gang, strerror(errno));
       fatal();
     }
     num_spes++;
   }
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang);
   if (spes[num_spes]) {
-    eprintf("spe_context_create_affinity: unexpected success.\n");
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected success.\n",
+	    spes[num_spes - 1], gang);
     fatal();
   }
   else if (errno != EEXIST) {
-    eprintf("spe_context_create_affinity: unexpected errno: %d (%s)\n",
-	    errno, strerror(errno));
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected errno: %d (%s)\n",
+	    spes[num_spes - 1], gang, errno, strerror(errno));
     failed();
   }
 
@@ -167,7 +175,7 @@ static int test(int argc, char **argv)
   --num_spes;
   ret = spe_context_destroy(spes[num_spes]); /* remove a context from the gang. */
   if (ret) {
-    eprintf("spe_context_destroy: %s\n", strerror(errno));
+    eprintf("spe_context_destroy(%p): %s\n", spes[num_spes], strerror(errno));
     fatal();
   }
   /* run */
@@ -178,26 +186,27 @@ static int test(int argc, char **argv)
   /* try to add more context to the gang. */
   spes[num_spes] = spe_context_create_affinity(0, spes[num_spes - 1], gang);
   if (spes[num_spes]) {
-    eprintf("spe_context_create_affinity: unexpected success.\n");
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected success.\n",
+	    spes[num_spes - 1], gang);
     fatal();
   }
   else if (errno != EBUSY) {
-    eprintf("spe_context_create_affinity: unexpected errno: %d (%s)\n",
-	    errno, strerror(errno));
+    eprintf("spe_context_create_affinity(0, %p, %p): unexpected errno: %d (%s)\n",
+	    spes[num_spes - 1], gang, errno, strerror(errno));
     failed();
   }
 
   for (i = 0; i < num_spes; i++) {
     ret = spe_context_destroy(spes[i]);
     if (ret) {
-      eprintf("spe_context_destroy: %s\n", strerror(errno));
+      eprintf("spe_context_destroy(%p): %s\n", spes[i], strerror(errno));
       fatal();
     }
   }
 
   ret = spe_gang_context_destroy(gang);
   if (ret) {
-    eprintf("spe_gang_context_destroy: %s\n", strerror(errno));
+    eprintf("spe_gang_context_destroy(%p): %s\n", gang, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.c99/test_c99_main.c
===================================================================
--- a/tests/libspe2.c99/test_c99_main.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.c99/test_c99_main.c	2008-04-24 18:31:01.000000000 +0900
@@ -32,6 +32,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 
 #include "ppu_libspe2_test.h"
 
@@ -53,18 +54,18 @@ int main(int argc, char **argv)
 
   prog = spe_image_open(elf_filename);
   if (!prog) {
-    perror("spe_image_open");
+    eprintf("spe_image_open(\"%s\"): %s\n", elf_filename, strerror(errno));
     fatal();
   }
 
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, prog)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, %p): %s\n", spe, prog, strerror(errno));
     fatal();
   }
 
@@ -76,13 +77,13 @@ int main(int argc, char **argv)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run: %s\n", strerror(errno));
     fatal();
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.run/test_context_create_error.c
===================================================================
--- a/tests/libspe2.run/test_context_create_error.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_context_create_error.c	2008-04-24 18:31:01.000000000 +0900
@@ -47,7 +47,7 @@ static int check_open(int num)
 	eprintf("open: Resource (file descriptors) leak in spe_context_create\n");
       }
       else {
-	perror("open(" DUMMY_FILE ")");
+	eprintf("open(" DUMMY_FILE "): %s\n", strerror(errno));
       }
       return 1;
     }
Index: b/tests/libspe2.run/test_cpu_info.c
===================================================================
--- a/tests/libspe2.run/test_cpu_info.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_cpu_info.c	2008-04-24 18:31:01.000000000 +0900
@@ -35,27 +35,27 @@ static int test(int argc, char **argv)
 
   bes = spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, -1);
   if (bes < 0) {
-    perror("SPE_COUNT_PHYSICAL_CPU_NODES, -1");
+    eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, -1): %s\n", strerror(errno));
     failed();
   }
   else if (bes == 0) {
-    eprintf("SPE_COUNT_PHYSICAL_CPU_NODES, -1: unexpected result: %d\n", bes);
+    eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, -1): unexpected result: %d\n", bes);
     failed();
   }
   else {
-    tprintf("SPE_COUNT_PHYSICAL_CPU_NODES, -1: %d\n", bes);
+    tprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, -1): %d\n", bes);
   }
 
   /* must be failed */
   ret = spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, 0);
   if (ret < 0) {
     if (errno != EINVAL) {
-      perror("SPE_COUNT_PHYSICAL_CPU_NODES, 0");
+      eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, 0): %s\n", strerror(errno));
       failed();
     }
   }
   else {
-    eprintf("SPE_COUNT_PHYSICAL_CPU_NODES, 0: unexpected result: %d\n", ret);
+    eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_CPU_NODES, 0): unexpected result: %d\n", ret);
     failed();
   }
 
@@ -66,28 +66,28 @@ static int test(int argc, char **argv)
     int pspes, uspes;
     pspes = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, i);
     if (pspes < 0) {
-      eprintf("SPE_COUNT_PHYSICAL_SPES, %d: %s\n", i, strerror(errno));
+      eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, %d): %s\n", i, strerror(errno));
       failed();
     }
     else if (pspes == 0) {
-      eprintf("SPE_COUNT_PHYSICAL_SPES, %d: unexpected result: %d\n", i, pspes);
+      eprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, %d): unexpected result: %d\n", i, pspes);
       failed();
     }
     else {
-      tprintf("SPE_COUNT_PHYSICAL_SPES, %d: %d\n", i, pspes);
+      tprintf("spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, %d): %d\n", i, pspes);
     }
 
     uspes = spe_cpu_info_get(SPE_COUNT_USABLE_SPES, i);
     if (uspes < 0) {
-      eprintf("SPE_COUNT_USABLE_SPES, %d: %s\n", i, strerror(errno));
+      eprintf("spe_cpu_info_get(SPE_COUNT_USABLE_SPES, %d): %s\n", i, strerror(errno));
       failed();
     }
     else if (uspes > pspes) {
-      eprintf("SPE_COUNT_USABLE_SPES, %d: unexpected result: %d\n", i, uspes);
+      eprintf("spe_cpu_info_get(SPE_COUNT_USABLE_SPES, %d): unexpected result: %d\n", i, uspes);
       failed();
     }
     else {
-      tprintf("SPE_COUNT_USABLE_SPES, %d: %d\n", i, uspes);
+      tprintf("spe_cpu_info_get(SPE_COUNT_USABLE_SPES, %d): %d\n", i, uspes);
     }
   }
 
Index: b/tests/libspe2.run/test_direct_access.c
===================================================================
--- a/tests/libspe2.run/test_direct_access.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_direct_access.c	2008-04-24 18:31:01.000000000 +0900
@@ -44,33 +44,33 @@ static int test(int argc, char **argv)
   /* error (NULL as SPE context) */
   ret = spe_ls_size_get(NULL);
   if (ret >= 0) {
-    eprintf("spe_ls_size_get: Unexpected success.\n");
+    eprintf("spe_ls_size_get(NULL): Unexpected success.\n");
     fatal();
   }
   if (errno != ESRCH) {
-    eprintf("spe_ls_size_get: Unexpected errno: %d (%s)\n",
+    eprintf("spe_ls_size_get(NULL): Unexpected errno: %d (%s)\n",
 	    errno, strerror(errno));
     failed();
   }
 
   ptr = spe_ls_area_get(NULL);
   if (ptr) {
-    eprintf("spe_ls_area_get: Unexpected success.\n");
+    eprintf("spe_ls_area_get(NULL): Unexpected success.\n");
     fatal();
   }
   if (errno != ESRCH) {
-    eprintf("spe_ls_area_get: Unexpected errno: %d (%s)\n",
+    eprintf("spe_ls_area_get(NULL): Unexpected errno: %d (%s)\n",
 	    errno, strerror(errno));
     failed();
   }
 
   ptr = spe_ps_area_get(NULL, SPE_MFC_COMMAND_AREA);
   if (ptr) {
-    perror("spe_ps_area_get: Unexpected success.\n");
+    eprintf("spe_ps_area_get(NULL, SPE_MFC_COMMAND_AREA): Unexpected success.\n");
     fatal();
   }
   if (errno != ESRCH) {
-    eprintf("spe_ps_area_get: Unexpected errno: %d (%s)\n",
+    eprintf("spe_ps_area_get(NULL, SPE_MFC_COMMAND_AREA): Unexpected errno: %d (%s)\n",
 	    errno, strerror(errno));
     failed();
   }
@@ -78,20 +78,20 @@ static int test(int argc, char **argv)
   /* success */
   spe = spe_context_create(SPE_MAP_PS, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(SPE_MAP_PS, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   ret = spe_ls_size_get(spe);
   if (ret < 0) {
-    perror("spe_ls_size_get");
+    eprintf("spe_ls_size_get(%p): %s\n", spe, strerror(errno));
     fatal();
   }
   tprintf("LS size: 0x%x(%d)\n", ret, ret);
 
   ptr = spe_ls_area_get(spe);
   if (!ptr) {
-    perror("spe_ls_area_get");
+    eprintf("spe_ls_area_get(%p): %s\n", spe, strerror(errno));
     fatal();
   }
   tprintf("LS area: %p\n", ptr);
@@ -109,18 +109,18 @@ static int test(int argc, char **argv)
   /* error (Invalid PS area) */
   ptr = spe_ps_area_get(spe, -1);
   if (ptr != NULL) {
-    perror("spe_ps_area_get");
+    eprintf("spe_ps_area_get(%p, -1): %s\n", spe, strerror(errno));
     fatal();
   }
   if (errno != EINVAL) {
-    eprintf("spe_ps_area_get: Unexpected errno: %d (%s)\n",
-	    errno, strerror(errno));
+    eprintf("spe_ps_area_get(%p, -1): Unexpected errno: %d (%s)\n",
+	    spe, errno, strerror(errno));
     failed();
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -128,7 +128,7 @@ static int test(int argc, char **argv)
   /* error (PS map is disabled) */
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
@@ -148,7 +148,7 @@ static int test(int argc, char **argv)
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.run/test_run_image.c
===================================================================
--- a/tests/libspe2.run/test_run_image.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_run_image.c	2008-04-24 18:31:01.000000000 +0900
@@ -1,8 +1,8 @@
 /*
  *  libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
  *
- *  Copyright (C) 2007 Sony Computer Entertainment Inc.
- *  Copyright 2007 Sony Corp.
+ *  Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *  Copyright 2007,2008 Sony Corp.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 
 #include "ppu_libspe2_test.h"
 
@@ -43,18 +44,18 @@ static int test(int argc, char **argv)
 
   prog = spe_image_open(elf_filename);
   if (!prog) {
-    perror("spe_image_open");
+    eprintf("spe_image_open(%s): %s\n", elf_filename, strerror(errno));
     fatal();
   }
 
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, prog)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, %p): %s\n", spe, prog, strerror(errno));
     fatal();
   }
 
@@ -66,13 +67,13 @@ static int test(int argc, char **argv)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.run/test_multiple_context.c
===================================================================
--- a/tests/libspe2.run/test_multiple_context.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_multiple_context.c	2008-04-24 18:31:01.000000000 +0900
@@ -26,6 +26,7 @@
 #include <stdio.h>
 #include <stdint.h>
 #include <errno.h>
+#include <string.h>
 #include <pthread.h>
 
 #include "ppu_libspe2_test.h"
@@ -51,12 +52,12 @@ static void *spe_thread_proc(void *arg)
 
     spe = spe_context_create(0, 0);
     if (!spe) {
-      perror("spe_context_create");
+      eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
       fatal();
     }
 
     if (spe_program_load(spe, &spu_arg)) {
-      perror("spe_program_load");
+      eprintf("spe_program_load(%p, &spu_arg): %s\n", spe, strerror(errno));
       fatal();
     }
 
@@ -68,13 +69,13 @@ static void *spe_thread_proc(void *arg)
       }
     }
     else {
-      perror("spe_context_run");
+      eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
       fatal();
     }
 
     ret = spe_context_destroy(spe);
     if (ret) {
-      perror("spe_context_destroy");
+      eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
       fatal();
     }
   }
Index: b/tests/libspe2.mfc/test_dma.c
===================================================================
--- a/tests/libspe2.mfc/test_dma.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_dma.c	2008-04-24 18:31:01.000000000 +0900
@@ -51,12 +51,12 @@ static void *spe_thread_proc(void *arg)
 
   spe = spe_context_create(0, 0);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_dma)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_dma): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -70,13 +70,13 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_dma_page_fault.c
===================================================================
--- a/tests/libspe2.mfc/test_dma_page_fault.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_dma_page_fault.c	2008-04-24 18:31:01.000000000 +0900
@@ -55,12 +55,12 @@ static void *spe_thread_proc(void *arg)
 
   map_fd = tmpfile_open(map_file, "dma");
   if (map_fd == -1) {
-    eprintf("tmpfile_open: %s\n", strerror(errno));
+    eprintf("tmpfile_open(%s, \"dma\"): %s\n", map_file, strerror(errno));
     fatal();
   }
   ret = write(map_fd, dma_data, BUFFER_SIZE);
   if (ret == -1) {
-    eprintf("write: %s: %s\n", map_file, strerror(errno));
+    eprintf("write(%d, %p, %s): %s\n", map_fd, dma_data, map_file, strerror(errno));
     fatal();
   }
   if (ret != BUFFER_SIZE) {
@@ -76,18 +76,18 @@ static void *spe_thread_proc(void *arg)
 
     map = mmap(NULL, BUFFER_SIZE, PROT_READ, MAP_PRIVATE, map_fd, 0);
     if (map == MAP_FAILED) {
-      eprintf("mmap(%s): %s\n", map_file, strerror(errno));
+      eprintf("mmap(NULL, ...): %s\n", strerror(errno));
       fatal();
     }
 
     spe = spe_context_create(0, 0);
     if (!spe) {
-      perror("spe_context_create");
+      eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
       fatal();
     }
 
     if (spe_program_load(spe, &spu_dma)) {
-      perror("spe_program_load");
+      eprintf("spe_program_load(%p, &spu_dma): %s\n", spe, strerror(errno));
       fatal();
     }
 
@@ -101,13 +101,13 @@ static void *spe_thread_proc(void *arg)
       }
     }
     else {
-      perror("spe_context_run");
+      eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
       fatal();
     }
 
     ret = spe_context_destroy(spe);
     if (ret) {
-      perror("spe_context_destroy");
+      eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
       fatal();
     }
 
Index: b/tests/libspe2.run/test_ppe_assisted_call.c
===================================================================
--- a/tests/libspe2.run/test_ppe_assisted_call.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_ppe_assisted_call.c	2008-04-24 18:31:01.000000000 +0900
@@ -1,8 +1,8 @@
 /*
  *  libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
  *
- *  Copyright (C) 2007 Sony Computer Entertainment Inc.
- *  Copyright 2007 Sony Corp.
+ *  Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *  Copyright 2007,2008 Sony Corp.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -45,12 +45,12 @@ static int run(unsigned int call_num,
 
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     return 1;
   }
 
   if (spe_program_load(spe, &spu_ppe_assisted_call)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_ppe_assisted_call): %s\n", spe, strerror(errno));
     return 1;
   }
 
@@ -62,7 +62,7 @@ static int run(unsigned int call_num,
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     return 1;
   }
 
@@ -110,7 +110,7 @@ static int check_error_value(int ret, sp
 static int check_argument(int ret, spe_stop_info_t *stop_info)
 {
   if (ret != 0) {
-    perror("spe_context_run");
+    eprintf("spe_context_run: %s\n", strerror(errno));
     return 1;
   }
   return 0;
@@ -244,7 +244,8 @@ static int test_unused(int call_num)
   /*** normal conditions ***/
   ret = spe_callback_handler_register(handler_error, call_num, SPE_CALLBACK_NEW);
   if (ret) {
-    perror("spe_callback_handler_register");
+    eprintf("spe_callback_handler_register(handler_error, %u, SPE_CALLBACK_NEW): %s\n",
+	    call_num, strerror(errno));
     return -1;
   }
 
Index: b/tests/libspe2.run/test_run_error.c
===================================================================
--- a/tests/libspe2.run/test_run_error.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_run_error.c	2008-04-24 18:31:01.000000000 +0900
@@ -1,8 +1,8 @@
 /*
  *  libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
  *
- *  Copyright (C) 2007 Sony Computer Entertainment Inc.
- *  Copyright 2007 Sony Corp.
+ *  Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *  Copyright 2007,2008 Sony Corp.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -69,12 +69,12 @@ static int run(spe_program_handle_t *pro
 
   spe = spe_context_create(create_flags, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0x%08x, NULL): %s\n", create_flags, strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, prog)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, %p): %s\n", spe, prog, strerror(errno));
     fatal();
   }
 
@@ -83,7 +83,7 @@ static int run(spe_program_handle_t *pro
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -325,7 +325,7 @@ static int test(int argc, char **argv)
   ro_dma_buffer = mmap(NULL, MAX_DMA_SIZE, PROT_READ,
 		       MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
   if (ro_dma_buffer == MAP_FAILED) {
-    perror("mmap");
+    eprintf("mmap(NULL, ...): %s\n", strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.run/test_single_context.c
===================================================================
--- a/tests/libspe2.run/test_single_context.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_single_context.c	2008-04-24 18:31:01.000000000 +0900
@@ -1,8 +1,8 @@
 /*
  *  libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
  *
- *  Copyright (C) 2007 Sony Computer Entertainment Inc.
- *  Copyright 2007 Sony Corp.
+ *  Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *  Copyright 2007,2008 Sony Corp.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 
 #include "ppu_libspe2_test.h"
 
@@ -40,12 +41,12 @@ static int run(spe_program_handle_t *pro
 
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     return 1;
   }
 
   if (spe_program_load(spe, prog)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, %p): %s\n", spe, prog, strerror(errno));
     return 1;
   }
 
@@ -65,13 +66,13 @@ static int run(spe_program_handle_t *pro
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     return 1;
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     return 1;
   }
 
Index: b/tests/libspe2.run/test_single_gang_context.c
===================================================================
--- a/tests/libspe2.run/test_single_gang_context.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_single_gang_context.c	2008-04-24 18:31:01.000000000 +0900
@@ -1,8 +1,8 @@
 /*
  *  libspe2 - A wrapper library to adapt the JSRE SPU usage model to SPUFS
  *
- *  Copyright (C) 2007 Sony Computer Entertainment Inc.
- *  Copyright 2007 Sony Corp.
+ *  Copyright (C) 2008 Sony Computer Entertainment Inc.
+ *  Copyright 2007,2008 Sony Corp.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -41,7 +41,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(spe, &spu_arg)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_arg): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -54,7 +54,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -71,14 +71,14 @@ static int test(int argc, char **argv)
 
   gang = spe_gang_context_create(0);
   if (!gang) {
-    eprintf("spe_gang_context_create: %s\n", strerror(errno));
+    eprintf("spe_gang_context_create(0): %s\n", strerror(errno));
     fatal();
   }
 
   for (i = 0; i < NUM_SPES; i++) {
     spe[i] = spe_context_create(0, gang);
     if (!spe[i]) {
-      eprintf("spe_context_create: %s\n", strerror(errno));
+      eprintf("spe_context_create(0, %p): %s\n", gang, strerror(errno));
       fatal();
     }
   }
@@ -86,7 +86,7 @@ static int test(int argc, char **argv)
   for (i = 0; i < NUM_SPES; i++) {
     ret = pthread_create(thr + i, NULL, spe_thread_proc, spe[i]);
     if (ret) {
-      eprintf("pthread_create: %s\n", strerror(ret));
+      eprintf("pthread_create(thr + %d, ...): %s\n", i, strerror(ret));
       fatal();
     }
   }
@@ -95,14 +95,14 @@ static int test(int argc, char **argv)
     pthread_join(thr[i], NULL);
     ret = spe_context_destroy(spe[i]);
     if (ret) {
-      eprintf("spe_context_destroy: %s\n", strerror(errno));
+      eprintf("spe_context_destroy(%p): %s\n", spe[i], strerror(errno));
       fatal();
     }
   }
 
   ret = spe_gang_context_destroy(gang);
   if (ret) {
-    eprintf("spe_gang_context_destroy: %s\n", strerror(errno));
+    eprintf("spe_gang_context_destroy(%p): %s\n", gang, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.run/test_stop.c
===================================================================
--- a/tests/libspe2.run/test_stop.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.run/test_stop.c	2008-04-24 18:31:01.000000000 +0900
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 
 #include "ppu_libspe2_test.h"
 
@@ -42,12 +43,12 @@ static void *spe_thread_proc(void *arg)
 
   spe = spe_context_create(0, NULL);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_stop)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_stop): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -116,7 +117,7 @@ static void *spe_thread_proc(void *arg)
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_dma_stop.c
===================================================================
--- a/tests/libspe2.mfc/test_dma_stop.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_dma_stop.c	2008-04-24 18:31:01.000000000 +0900
@@ -52,12 +52,12 @@ static void *spe_thread_proc(void *arg)
 
   spe = spe_context_create(0, 0);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_dma_stop)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_dma_stop): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -80,14 +80,14 @@ static void *spe_thread_proc(void *arg)
       fatal();
     }
     else {
-      perror("spe_context_run");
+      eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
       fatal();
     }
   }
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_ibox.c
===================================================================
--- a/tests/libspe2.mfc/test_ibox.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_ibox.c	2008-04-24 18:31:01.000000000 +0900
@@ -59,7 +59,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_ibox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_ibox): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -73,7 +73,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -94,7 +94,8 @@ static void *ppe_thread_proc(void *arg)
   spe_params.ppe = ppe;
   spe_params.spe = spe_context_create(params->flags, 0);
   if (!spe_params.spe) {
-    eprintf("%s: spe_context_create: %s\n", params->name, strerror(errno));
+    eprintf("%s: spe_context_create(0x%08x, NULL): %s\n",
+	    params->name, params->flags, strerror(errno));
     fatal();
   }
 
@@ -145,7 +146,9 @@ static void *ppe_thread_proc(void *arg)
     /* read outbound mailbox */
     ret = spe_out_intr_mbox_read(spe_params.spe, data, num_data, behavior);
     if (ret == -1) {
-      eprintf("%s: spe_out_intr_mbox_read: %s.\n", params->name, strerror(errno));
+      eprintf("%s: spe_out_intr_mbox_read(%p, %p, %u, %s): %s.\n",
+	      params->name, spe_params.spe, data, num_data, mbox_behavior_symbol(behavior),
+	      strerror(errno));
       fatal();
     }
     if (ret > num_data) {
Index: b/tests/libspe2.mfc/test_ibox_simultaneous.c
===================================================================
--- a/tests/libspe2.mfc/test_ibox_simultaneous.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_ibox_simultaneous.c	2008-04-24 18:31:01.000000000 +0900
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <pthread.h>
 #include <stdint.h>
 
@@ -84,7 +85,9 @@ static void *ppe_thread_proc(void *arg)
 
     ret = spe_out_intr_mbox_read(params->spe, data, num_data, behavior);
     if (ret == -1) {
-      perror("spe_out_intr_mbox_read");
+      eprintf("spe_out_intr_mbox_read(%p, %p, %u, %s): %s\n",
+	      params->spe, data, num_data, mbox_behavior_symbol(behavior),
+	      strerror(errno));
       fatal();
     }
     if (ret > num_data) {
@@ -130,12 +133,12 @@ static int test(int argc, char **argv)
 
   spe = spe_context_create(0, 0);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_ibox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_ibox): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -155,7 +158,7 @@ static int test(int argc, char **argv)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -163,7 +166,7 @@ static int test(int argc, char **argv)
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_ibox_stop.c
===================================================================
--- a/tests/libspe2.mfc/test_ibox_stop.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_ibox_stop.c	2008-04-24 18:31:01.000000000 +0900
@@ -62,7 +62,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(spe, &spu_ibox_stop)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_ibox_stop): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -81,7 +81,7 @@ static void *spe_thread_proc(void *arg)
       /* continue */
     }
     else {
-      perror("spe_context_run");
+      eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
       fatal();
     }
   }
@@ -101,7 +101,8 @@ static void *ppe_thread_proc(void *arg)
   spe_params.ppe = ppe;
   spe_params.spe = spe_context_create(params->flags, 0);
   if (!spe_params.spe) {
-    eprintf("%s: spe_context_create: %s\n", params->name, strerror(errno));
+    eprintf("%s: spe_context_create(0x%08x, NULL): %s\n",
+	    params->name, params->flags, strerror(errno));
     fatal();
   }
 
@@ -118,7 +119,8 @@ static void *ppe_thread_proc(void *arg)
     unsigned int data;
     ret = spe_out_intr_mbox_read(spe_params.spe, &data, 1, SPE_MBOX_ANY_BLOCKING);
     if (ret == -1) {
-      eprintf("%s: spe_out_intr_mbox_read: %s\n", params->name, strerror(errno));
+      eprintf("%s: spe_out_intr_mbox_read(%p, %p, 1, SPE_MBOX_ANY_BLOCKING): %s\n",
+	      params->name, spe_params.spe, &data, strerror(errno));
       fatal();
     }
 
@@ -132,7 +134,8 @@ static void *ppe_thread_proc(void *arg)
   pthread_join(tid, NULL);
   ret = spe_context_destroy(spe_params.spe);
   if (ret) {
-    eprintf("%s: spe_context_destroy: %s\n", params->name, strerror(errno));
+    eprintf("%s: spe_context_destroy(%p): %s\n",
+	    params->name, spe_params.spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_mbox.c
===================================================================
--- a/tests/libspe2.mfc/test_mbox.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_mbox.c	2008-04-24 18:31:01.000000000 +0900
@@ -58,7 +58,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_mbox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_mbox): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -72,7 +72,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -93,7 +93,8 @@ static void *ppe_thread_proc(void *arg)
   spe_params.ppe = ppe;
   spe_params.spe = spe_context_create(params->flags, 0);
   if (!spe_params.spe) {
-    eprintf("%s: spe_context_create: %s\n", params->name, strerror(errno));
+    eprintf("%s: spe_context_create(0x%08x, NULL): %s\n",
+	    params->name, params->flags, strerror(errno));
     fatal();
   }
 
@@ -130,7 +131,8 @@ static void *ppe_thread_proc(void *arg)
     /* read outbound mailbox */
     ret = spe_out_mbox_read(spe_params.spe, data, num_data);
     if (ret == -1) {
-      eprintf("%s: spe_out_mbox_read: %s.\n", params->name, strerror(errno));
+      eprintf("%s: spe_out_mbox_read(%p, %p, %u): %s.\n",
+	      params->name, spe_params.spe, data, num_data, strerror(errno));
       fatal();
     }
     if (ret > num_data) {
Index: b/tests/libspe2.mfc/test_mbox_all.c
===================================================================
--- a/tests/libspe2.mfc/test_mbox_all.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_mbox_all.c	2008-04-24 18:31:01.000000000 +0900
@@ -59,7 +59,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_mbox_all)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_mbox_all): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -73,7 +73,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -93,7 +93,8 @@ static void *ppe_thread_proc(void *arg)
   spe_params.ppe = ppe;
   spe_params.spe = spe_context_create(params->flags, 0);
   if (!spe_params.spe) {
-    eprintf("%s: spe_context_create: %s\n", params->name, strerror(errno));
+    eprintf("%s: spe_context_create(0x%08x, NULL): %s\n",
+	    params->name, params->flags, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_mbox_simultaneous.c
===================================================================
--- a/tests/libspe2.mfc/test_mbox_simultaneous.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_mbox_simultaneous.c	2008-04-24 18:31:01.000000000 +0900
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <pthread.h>
 #include <stdint.h>
 
@@ -70,7 +71,8 @@ static void *ppe_thread_proc(void *arg)
 
     ret = spe_out_mbox_read(params->spe, data, num_data);
     if (ret == -1) {
-      perror("spe_out_mbox_read");
+      eprintf("spe_out_mbox_read(%p, %p, %u): %s\n",
+	      params->spe, data, num_data, strerror(errno));
       fatal();
     }
     if (ret > num_data) {
@@ -100,12 +102,12 @@ static int test(int argc, char **argv)
 
   spe = spe_context_create(0, 0);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_mbox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spe_mbox): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -125,7 +127,7 @@ static int test(int argc, char **argv)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -133,7 +135,7 @@ static int test(int argc, char **argv)
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_proxy_dma.c
===================================================================
--- a/tests/libspe2.mfc/test_proxy_dma.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_proxy_dma.c	2008-04-24 18:31:01.000000000 +0900
@@ -61,7 +61,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_proxy_dma)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_proxy_dma): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -72,7 +72,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_proxy_dma_poll.c
===================================================================
--- a/tests/libspe2.mfc/test_proxy_dma_poll.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_proxy_dma_poll.c	2008-04-24 18:31:01.000000000 +0900
@@ -61,7 +61,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_proxy_dma)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_proxy_dma): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -72,7 +72,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_signal.c
===================================================================
--- a/tests/libspe2.mfc/test_signal.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_signal.c	2008-04-24 18:31:01.000000000 +0900
@@ -59,7 +59,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_signal)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_signal): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -73,7 +73,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.mfc/test_wbox.c
===================================================================
--- a/tests/libspe2.mfc/test_wbox.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_wbox.c	2008-04-24 18:31:01.000000000 +0900
@@ -57,7 +57,7 @@ static void *spe_thread_proc(void *arg)
   spe_stop_info_t stop_info;
 
   if (spe_program_load(params->spe, &spu_wbox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_wbox): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -71,7 +71,7 @@ static void *spe_thread_proc(void *arg)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p): %s\n", params->spe, strerror(errno));
     fatal();
   }
 
@@ -148,7 +148,9 @@ static void *ppe_thread_proc(void *arg)
     /* read outbound mailbox */
     ret = spe_in_mbox_write(spe_params.spe, data, num_data, behavior);
     if (ret == -1) {
-      eprintf("%s: spe_in_mbox_write: %s.\n", params->name, strerror(errno));
+      eprintf("%s: spe_in_mbox_write(%p, %p, %u, %s): %s.\n",
+	      params->name, spe_params.spe, data, num_data, mbox_behavior_symbol(behavior),
+	      strerror(errno));
       fatal();
     }
     if (ret > num_data) {
Index: b/tests/libspe2.mfc/test_wbox_simultaneous.c
===================================================================
--- a/tests/libspe2.mfc/test_wbox_simultaneous.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.mfc/test_wbox_simultaneous.c	2008-04-24 18:31:01.000000000 +0900
@@ -26,6 +26,7 @@
 
 #include <stdio.h>
 #include <errno.h>
+#include <string.h>
 #include <pthread.h>
 #include <stdint.h>
 
@@ -81,7 +82,9 @@ static void *ppe_thread_proc(void *arg)
 
     ret = spe_in_mbox_write(spe, data, num_data, behavior);
     if (ret == -1) {
-      perror("spe_in_mbox_write");
+      eprintf("spe_in_mbox_write(%p, %p, %u, %s): %s\n",
+	      spe, data, num_data, mbox_behavior_symbol(behavior),
+	      strerror(errno));
       fatal();
     }
     if (ret > num_data) {
@@ -121,12 +124,12 @@ static int test(int argc, char **argv)
 
   spe = spe_context_create(0, 0);
   if (!spe) {
-    perror("spe_context_create");
+    eprintf("spe_context_create(0, NULL): %s\n", strerror(errno));
     fatal();
   }
 
   if (spe_program_load(spe, &spu_wbox)) {
-    perror("spe_program_load");
+    eprintf("spe_program_load(%p, &spu_wbox): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -145,7 +148,7 @@ static int test(int argc, char **argv)
     }
   }
   else {
-    perror("spe_context_run");
+    eprintf("spe_context_run(%p, ...): %s\n", spe, strerror(errno));
     fatal();
   }
 
@@ -153,7 +156,7 @@ static int test(int argc, char **argv)
 
   ret = spe_context_destroy(spe);
   if (ret) {
-    perror("spe_context_destroy");
+    eprintf("spe_context_destroy(%p): %s\n", spe, strerror(errno));
     fatal();
   }
 
Index: b/tests/libspe2.event/test_event_error.c
===================================================================
--- a/tests/libspe2.event/test_event_error.c	2008-04-24 18:30:58.000000000 +0900
+++ b/tests/libspe2.event/test_event_error.c	2008-04-24 18:31:01.000000000 +0900
@@ -135,7 +135,8 @@ static int test(int argc, char **argv)
   event.events = SPE_EVENT_SPE_STOPPED;
   ret = spe_event_handler_register(evhandler, &event);
   if (ret) {
-    perror("spe_event_handler_register");
+    eprintf("spe_event_handler_register(%p, %p): %s\n",
+	    evhandler, &event, strerror(errno));
     failed();
   }
 
@@ -194,13 +195,14 @@ static int test(int argc, char **argv)
   event.events = SPE_EVENT_SPE_STOPPED;
   ret = spe_event_handler_deregister(evhandler, &event);
   if (ret) {
-    perror("spe_event_handler_deregister");
+    eprintf("spe_event_handler_deregister(%p, %p): %s\n",
+	    evhandler, &event, strerror(errno));
     fatal();
   }
 
   ret = spe_event_handler_destroy(evhandler);
   if (ret) {
-    perror("spe_event_handler_destroy");
+    eprintf("spe_event_handler_destroy(%p): %s\n", evhandler, strerror(errno));
     fatal();
   }
 




More information about the cbe-oss-dev mailing list