projects/guix·blob java-team · refs

36 lines · 1.5 KiB

1Fix the test "TestFileLister" by giving precisely the source directory instead of guessing it.
2Author: Florent Pruvost <[email protected]>
3
4diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
5index 467e6e95e..d68d83e3d 100644
6--- a/test/CMakeLists.txt
7+++ b/test/CMakeLists.txt
8@@ -85,6 +85,7 @@ if (BUILD_TESTS)
9 elseif(TEST ${NAME})
10 else()
11 add_test(NAME ${NAME} COMMAND $<TARGET_FILE:testrunner> ${NAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
12+ set_tests_properties(${NAME} PROPERTIES ENVIRONMENT "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}")
13 endif()
14 endfunction()
15
16diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp
17index 3e2f56dfc..ecf0f9c6e 100644
18--- a/test/testfilelister.cpp
19+++ b/test/testfilelister.cpp
20@@ -45,15 +45,7 @@ private:
21
22 // TODO: generate file list instead
23 static std::string findBaseDir() {
24- std::string basedir;
25- while (!Path::isDirectory(Path::join(basedir, ".github"))) {
26- const std::string abspath = Path::getAbsoluteFilePath(basedir);
27- basedir += "../";
28- // no more going up
29- if (Path::getAbsoluteFilePath(basedir) == abspath)
30- throw std::runtime_error("could not find repository root directory");
31- }
32- return basedir;
33+ return Path::getAbsoluteFilePath(std::getenv("PROJECT_SOURCE_DIR")) + "/";
34 }
35
36 void recursiveAddFiles() const {