summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/cppcheck-fix-basedir-test.patch
diff options
context:
space:
mode:
authorFlorent Pruvost <florent.pruvost@inria.fr>2025-04-11 15:42:38 +0200
committerLudovic Courtès <ludo@gnu.org>2025-04-14 17:27:29 +0200
commit0f69a4df16488aaf08a2ee1e20b9fc876364cec6 (patch)
treec3773520eafd0ba34b517b42d3ca780ca9ffa18f /gnu/packages/patches/cppcheck-fix-basedir-test.patch
parent2caa8cb26f5146e8218b3fa37fa8b367d0e2b821 (diff)
gnu: cppcheck: Update to 2.17.1.
* gnu/packages/check.scm (cppcheck): Update to 2.17.1. Replace ‘cppcheck-disable-char-signedness-test.patch’ by ‘cppcheck-fix-basedir-test.patch’. * gnu/packages/patches/cppcheck-disable-char-signedness-test.patch: Remove. * gnu/packages/patches/cppcheck-fix-basedir-test.patch: New file. * gnu/local.mk (dist_patch_DATA): Update accordingly. Change-Id: Iebd33e2966ef30a3cd5b7b157f1051fcacbe1884 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/patches/cppcheck-fix-basedir-test.patch')
-rw-r--r--gnu/packages/patches/cppcheck-fix-basedir-test.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/gnu/packages/patches/cppcheck-fix-basedir-test.patch b/gnu/packages/patches/cppcheck-fix-basedir-test.patch
new file mode 100644
index 0000000000..06a1422629
--- /dev/null
+++ b/gnu/packages/patches/cppcheck-fix-basedir-test.patch
@@ -0,0 +1,36 @@
+Fix the test "TestFileLister" by giving precisely the source directory instead of guessing it.
+Author: Florent Pruvost <florent.pruvost@inria.fr>
+
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 467e6e95e..d68d83e3d 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -85,6 +85,7 @@ if (BUILD_TESTS)
+ elseif(TEST ${NAME})
+ else()
+ add_test(NAME ${NAME} COMMAND $<TARGET_FILE:testrunner> ${NAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
++ set_tests_properties(${NAME} PROPERTIES ENVIRONMENT "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}")
+ endif()
+ endfunction()
+
+diff --git a/test/testfilelister.cpp b/test/testfilelister.cpp
+index 3e2f56dfc..ecf0f9c6e 100644
+--- a/test/testfilelister.cpp
++++ b/test/testfilelister.cpp
+@@ -45,15 +45,7 @@ private:
+
+ // TODO: generate file list instead
+ static std::string findBaseDir() {
+- std::string basedir;
+- while (!Path::isDirectory(Path::join(basedir, ".github"))) {
+- const std::string abspath = Path::getAbsoluteFilePath(basedir);
+- basedir += "../";
+- // no more going up
+- if (Path::getAbsoluteFilePath(basedir) == abspath)
+- throw std::runtime_error("could not find repository root directory");
+- }
+- return basedir;
++ return Path::getAbsoluteFilePath(std::getenv("PROJECT_SOURCE_DIR")) + "/";
+ }
+
+ void recursiveAddFiles() const {