소스 검색

tests/loader.c: allow to specify a launcher to run tests, e.g valgrind

Nathalie Furmento 13 년 전
부모
커밋
92481c7204
1개의 변경된 파일10개의 추가작업 그리고 3개의 파일을 삭제
  1. 10 3
      tests/loader.c

+ 10 - 3
tests/loader.c

@@ -47,6 +47,7 @@ int main(int argc, char *argv[])
 	char *test_name;
 	char *test_args;
 	int   status;
+	char *launcher;
 	struct sigaction sa;
 
 	test_args = NULL;
@@ -65,6 +66,9 @@ int main(int argc, char *argv[])
 		sprintf(test_args, "%s/examples/spmv/matrix_market/examples/fidapm05.mtx", STARPU_SRC_DIR);
 	}
 
+	/* get launcher program */
+	launcher=getenv("STARPU_CHECK_LAUNCHER");
+
 	/* get user-defined iter_max value */
 	if (getenv("STARPU_TIMEOUT_ENV"))
 		timeout = strtol(getenv("STARPU_TIMEOUT_ENV"), NULL, 10);
@@ -88,13 +92,16 @@ int main(int argc, char *argv[])
 			fprintf(stderr, "[error] setpgid. Mark test as failed\n");
 			exit(EXIT_FAILURE);
 		}
-		execl(test_name, test_name, test_args, NULL);
-		fprintf(stderr, "[error] execl. Mark test as failed\n");
+		if (launcher)
+			execlp("libtool", "libtool", "--mode=execute", launcher, test_name, test_args, NULL);
+		else
+			execlp("libtool", "libtool", "--mode=execute", test_name, test_args, NULL);
+		fprintf(stderr, "[error] '%s' failed to exec. test marked as failed\n", test_name);
 		exit(EXIT_FAILURE);
 	}
 	if (child_pid == -1)
 	{
-		fprintf(stderr, "[error] fork. Mark test as failed\n");
+		fprintf(stderr, "[error] fork. test marked as failed\n");
 		exit(EXIT_FAILURE);
 	}