Browse Source

Fix test when there are non-cpu workers

Samuel Thibault 4 years ago
parent
commit
9518c840aa
1 changed files with 8 additions and 1 deletions
  1. 8 1
      tests/main/job.c

+ 8 - 1
tests/main/job.c

@@ -30,9 +30,11 @@ static struct starpu_task *tasks[N];
 void dummy_func(void *arg)
 void dummy_func(void *arg)
 {
 {
 	unsigned worker, i;
 	unsigned worker, i;
+	int worker0;
 	(void) arg;
 	(void) arg;
 
 
-	if (starpu_worker_get_id_check() == 0)
+	starpu_worker_get_ids_by_type(STARPU_CPU_WORKER, &worker0, 1);
+	if ((int) starpu_worker_get_id_check() == worker0)
 		/* One worker creates the tasks */
 		/* One worker creates the tasks */
 		for (i = 0; i < N; i++)
 		for (i = 0; i < N; i++)
 		{
 		{
@@ -57,7 +59,12 @@ int main(void)
 {
 {
 	int ret;
 	int ret;
 	unsigned i;
 	unsigned i;
+	struct starpu_conf conf;
 
 
+	starpu_conf_init(&conf);
+	conf.precedence_over_environment_variables = 1;
+	starpu_conf_noworker(&conf);
+	conf.ncpus = 1;
 	ret = starpu_init(NULL);
 	ret = starpu_init(NULL);
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");
 	STARPU_CHECK_RETURN_VALUE(ret, "starpu_init");