summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-07-05 11:52:47 +0200
committerPatrick Steinhardt <ps@pks.im>2017-07-05 11:52:47 +0200
commit1f7af277c773a516e4bea22f92b75a07ffc15734 (patch)
treef61fd71541128e63da79d517c1b90ca07ceee2a6
parentc26ce78404b7fc7356c56bd2c57611fd60a3705b (diff)
downloadlibgit2-1f7af277c773a516e4bea22f92b75a07ffc15734.tar.gz
tests: config: fix missing declaration causing error
On systems where we pull in our distributed version of the regex library, all tests in config::readonly fail. This error is actually quite interesting: the test suite is unable to find the declaration of `git_path_exists` and assumes it has a signature of `int git_path_exists(const char *)`. But actually, it has a `bool` return value. Due to this confusion, some wrong conversion is done by the compiler and the `cl_assert(!git_path_exists("file"))` checks erroneously fail, even when the function does in fact return the correct value. The error is actually introduced by 56893bb9a (cmake: consistently use TARGET_INCLUDE_DIRECTORIES if available, 2017-06-28), unfortunately introduced by myself. Due to the delayed addition of include directories, we will now find the "config.h" header inside of the "deps/regex" directory instead of inside the "src/" directory, where it should be. As such, we are missing definitions for the `git_config_file__ondisk` and `git_path_exists` symbols. The correct fix here would be to fix the order in which include search directories are added. But due to the current restructuring of CMakeBuild.txt, I'm refraining from doing so and delay the proper fix a bit. Instead, we paper over the issue by explicitly including "path.h" to fix its prototype. This ignores the issue that `git_config_file__ondisk` is undeclared, as its signature is correctly identified by the compiler.
-rw-r--r--tests/config/readonly.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/config/readonly.c b/tests/config/readonly.c
index f45abdd29..6d6819eef 100644
--- a/tests/config/readonly.c
+++ b/tests/config/readonly.c
@@ -1,6 +1,7 @@
#include "clar_libgit2.h"
#include "config_file.h"
#include "config.h"
+#include "path.h"
static git_config *cfg;