Browse Source

tests/datawizard/acquire_cb_insert: skip test if no device can execute the task

Nathalie Furmento 14 years ago
parent
commit
8ca35037ea
1 changed files with 9 additions and 2 deletions
  1. 9 2
      tests/datawizard/acquire_cb_insert.c

+ 9 - 2
tests/datawizard/acquire_cb_insert.c

@@ -55,7 +55,7 @@ static int x;
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)
 {
 {
-        int i;
+        int i, ret;
 	float *f;
 	float *f;
 	starpu_data_handle x_handle, f_handle;
 	starpu_data_handle x_handle, f_handle;
 
 
@@ -77,7 +77,8 @@ int main(int argc, char **argv)
 	starpu_data_partition(f_handle, &filter);
 	starpu_data_partition(f_handle, &filter);
 
 
 	/* Compute which portion we will work on */
 	/* Compute which portion we will work on */
-        starpu_insert_task(&which_index, STARPU_W, x_handle, 0);
+        ret = starpu_insert_task(&which_index, STARPU_W, x_handle, 0);
+	if (ret == -ENODEV) goto enodev;
 
 
 	/* And submit the corresponding task */
 	/* And submit the corresponding task */
 	STARPU_DATA_ACQUIRE_CB(
 	STARPU_DATA_ACQUIRE_CB(
@@ -106,4 +107,10 @@ int main(int argc, char **argv)
 
 
 	starpu_shutdown();
 	starpu_shutdown();
 	return 0;
 	return 0;
+
+enodev:
+	fprintf(stderr, "WARNING: No one can execute this task\n");
+	/* 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 */
+	return 77;
 }
 }