Переглянути джерело

tests/loader: Don't take libtool(1) from $PATH; take the one from $top_builddir.

On Darwin, libtool(1) is a command that has nothing to do with GNU
Libtool.  Furthermore, a valid GNU libtool shouldn't be assumed to be in
$PATH.
Ludovic Courtès 13 роки тому
батько
коміт
3d7c33ba32
2 змінених файлів з 25 додано та 3 видалено
  1. 1 1
      tests/Makefile.am
  2. 24 2
      tests/loader.c

+ 1 - 1
tests/Makefile.am

@@ -96,7 +96,7 @@ if !STARPU_HAVE_WINDOWS
 ## test loader program
 LOADER			=	loader
 LOADER_BIN		=	$(abs_top_builddir)/tests/$(LOADER)
-TESTS_ENVIRONMENT	=	$(LOADER_BIN)
+TESTS_ENVIRONMENT	=	top_builddir="$(abs_top_builddir)" $(LOADER_BIN)
 endif
 
 TESTS = $(noinst_PROGRAMS)

+ 24 - 2
tests/loader.c

@@ -93,9 +93,31 @@ int main(int argc, char *argv[])
 			exit(EXIT_FAILURE);
 		}
 		if (launcher)
-			execlp("libtool", "libtool", "--mode=execute", launcher, test_name, test_args, NULL);
+		{
+			/* "Launchers" such as Valgrind need to be inserted
+			 * after the Libtool-generated wrapper scripts, hence
+			 * this special-case.  */
+			const char *top_builddir = getenv ("top_builddir");
+			if (top_builddir != NULL)
+			{
+				char libtool[strlen(top_builddir)
+					     + sizeof("libtool") + 1];
+				strcpy(libtool, top_builddir);
+				strcat(libtool, "/libtool");
+				execl(libtool, test_name, "--mode=execute",
+				      launcher, test_name, test_args, NULL);
+			}
+			else
+			{
+				fprintf(stderr,
+					"warning: $top_builddir undefined, "
+					"so $STARPU_CHECK_LAUNCHER ignored\n");
+				execl(test_name, test_name, test_args, NULL);
+			}
+		}
 		else
-			execlp("libtool", "libtool", "--mode=execute", test_name, test_args, NULL);
+			execl(test_name, test_name, test_args, NULL);
+
 		fprintf(stderr, "[error] '%s' failed to exec. test marked as failed\n", test_name);
 		exit(EXIT_FAILURE);
 	}