Explorar o código

tests: improve error checking mechanism

Nathalie Furmento %!s(int64=13) %!d(string=hai) anos
pai
achega
066bdda80c
Modificáronse 2 ficheiros con 9 adicións e 4 borrados
  1. 6 2
      tests/common/helper.h
  2. 3 2
      tests/datawizard/scratch.c

+ 6 - 2
tests/common/helper.h

@@ -23,8 +23,12 @@
 //
 //#define STARPU_CHECK_MALLOC(ptr) {if (!ptr) { fprintf(stderr, "starpu_malloc failed\n"); return 1; }}
 //#define STARPU_CHECK_MALLOC_HAS_FAILED(ptr) {if (ptr) { fprintf(stderr, "starpu_malloc should have failed\n"); return 1; }}
-#define STARPU_CHECK_RETURN_VALUE(err, message) {if (err < 0) { perror(message); STARPU_ASSERT(0); }}
-#define STARPU_CHECK_RETURN_VALUE_IS(err, value, message) {if (err != value) { perror(message); return 1; }}
+#define STARPU_CHECK_RETURN_VALUE(err, message) {if (err < 0) { \
+			fprintf(stderr, "StarPU function <%s> returned unexpected value: <%s>\n", message, strerror(err)); \
+			STARPU_ASSERT(0); }}
+#define STARPU_CHECK_RETURN_VALUE_IS(err, value, message) {if (err != value) { \
+			fprintf(stderr, "StarPU function <%s> returned unexpected value: <%s>\n", message, strerror(err)); \
+			STARPU_ASSERT(0); }}
 //
 //#define STARPU_CHECK_MALLOC_THREAD(ptr) {if (!ptr) { fprintf(stderr, "starpu_malloc failed\n"); return ALL_IS_NOT_OK; }}
 //#define STARPU_CHECK_MALLOC_HAS_FAILED_THREAD(ptr) {if (ptr) { fprintf(stderr, "starpu_malloc should have failed\n"); return ALL_IS_NOT_OK; }}

+ 3 - 2
tests/datawizard/scratch.c

@@ -113,7 +113,8 @@ enodev:
 	starpu_data_unregister(A_handle);
 	starpu_data_unregister(B_handle);
 	starpu_shutdown();
-	/* No one can execute that task, this is not a bug, just an incomplete
-	 * test :) */
+	/* yes, we do not perform the computation but we did detect that no one
+ 	 * could perform the kernel, so this is not an error from StarPU */
+	fprintf(stderr, "WARNING: No one can execute this task\n");
 	return 77;
 }