Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(test): build the test-impact suites on Windows

Martin Vogel8887437e6d53
diff --git a/tests/test_test_impact.c b/tests/test_test_impact.c
index 35869dafd..c88bdf909 100644
--- a/tests/test_test_impact.c
+++ b/tests/test_test_impact.c
@@ -8,6 +8,7 @@
*/
#include "test_framework.h"
#include "test_helpers.h"
+#include <cli/cli.h>
#include <foundation/subprocess.h>
#include <mcp/test_impact.h>
#include <mcp/test_impact_result.h>
diff --git a/tests/test_test_impact_engine.c b/tests/test_test_impact_engine.c
index 02ce23b79..535b4aa20 100644
--- a/tests/test_test_impact_engine.c
+++ b/tests/test_test_impact_engine.c
@@ -134,13 +134,24 @@ static bool tie_open_with(tie_fixture_t *fx, const char *extra_path, const char
return tie_open_files(fx, files, 1);
}
+/* A directory's canonical form: realpath on POSIX (macOS temp dirs sit behind
+ * the /var -> /private/var link), _fullpath on Windows, which has no realpath,
+ * with forward slashes like every path the fixture builds from it. */
+static bool tie_full_path(char out[PATH_MAX], const char *path) {
+#ifdef _WIN32
+ return path && _fullpath(out, path, PATH_MAX) != NULL && cbm_normalize_path_sep(out) != NULL;
+#else
+ return path && realpath(path, out) != NULL;
+#endif
+}
+
/* The fixture, plus (path, content) pairs written over it in the base commit. */
static bool tie_open_files(tie_fixture_t *fx, const char *const *extra, int extra_count) {
memset(fx, 0, sizeof(*fx));
const char *git = cbm_find_cli("git", cbm_get_home_dir());
const char *home = th_mktempdir("cbm-ti-engine");
char real[PATH_MAX];
- if (!git || !home || !realpath(home, real) || strlen(git) >= sizeof(fx->git)) {
+ if (!git || !home || !tie_full_path(real, home) || strlen(git) >= sizeof(fx->git)) {
return false;
}
snprintf(fx->git, sizeof(fx->git), "%s", git);