Browse Source

multiformat_handle_conversion && multiformat_data_release : make sure these tests do not fail if there are no opencl and no cuda workers.

Cyril Roelandt 13 years ago
parent
commit
4f4aac21e3
2 changed files with 20 additions and 6 deletions
  1. 11 3
      tests/core/multiformat_data_release.c
  2. 9 3
      tests/core/multiformat_handle_conversion.c

+ 11 - 3
tests/core/multiformat_data_release.c

@@ -241,7 +241,7 @@ test(void)
 		print_stats(&global_stats);
 		FPRINTF(stderr ,"\n");
 		print_stats(&expected_stats);
-		return 1;
+		return -ENODEV;
 	}
 #endif /* !STARPU_USE_CUDA */
 
@@ -259,7 +259,7 @@ test(void)
 		print_stats(&global_stats);
 		FPRINTF(stderr ,"\n");
 		print_stats(&expected_stats);
-		return 1;
+		return -ENODEV;
 	}
 
 #endif /* !STARPU_USE_OPENCL */
@@ -289,7 +289,15 @@ main(void)
 	unregister_handle();
 	starpu_shutdown();
 
-	return err?EXIT_FAILURE:EXIT_SUCCESS;
+	switch (err)
+	{
+		case -ENODEV:
+			return STARPU_TEST_SKIPPED;
+		case 0:
+			return EXIT_SUCCESS;
+		default:
+			return EXIT_FAILURE;
+	}
 #else /* ! STARPU_USE_CPU */
 	/* Without the CPU, there is no point in using the multiformat
 	 * interface, so this test is pointless. */

+ 9 - 3
tests/core/multiformat_handle_conversion.c

@@ -322,15 +322,18 @@ main(void)
 	ret = starpu_init(&conf);
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 
+	unsigned int ncuda = starpu_cuda_worker_get_count();
+	unsigned int nopencl = starpu_opencl_worker_get_count();
+
 #ifdef STARPU_USE_OPENCL
-	if (test_opencl() != 0)
+	if (nopencl > 0 && test_opencl() != 0)
 	{
 		FPRINTF(stderr, "OPENCL FAILED\n");
 		return EXIT_FAILURE;
 	}
 #endif
 #ifdef STARPU_USE_CUDA
-	if (test_cuda() != 0)
+	if (ncuda > 0 && test_cuda() != 0)
 	{
 		FPRINTF(stderr, "CUDA FAILED \n");
 		return EXIT_FAILURE;
@@ -339,7 +342,10 @@ main(void)
 
 	starpu_shutdown();
 
-	return EXIT_SUCCESS;
+	if (ncuda == 0 && nopencl == 0)
+		return STARPU_TEST_SKIPPED;
+	else
+		return EXIT_SUCCESS;
 #else /* !STARPU_USE_CPU */
 	/* Without the CPU, there is no point in using the multiformat
 	 * interface, so this test is pointless. */