Commit 29eed1c74d65efbad48aa525f551c6f94d04002c

Edward Thomson 2014-10-24T10:50:57

clar: use a custom temp directory name

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7da4a89..3dda331 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -454,6 +454,7 @@ IF (BUILD_CLAR)
 	SET(CLAR_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
 	ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
 	ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\")
+	ADD_DEFINITIONS(-DCLAR_TMPDIR=\"libgit2_tests\")
 
 	INCLUDE_DIRECTORIES(${CLAR_PATH})
 	FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
diff --git a/tests/clar/sandbox.h b/tests/clar/sandbox.h
index a44e291..ea9e35c 100644
--- a/tests/clar/sandbox.h
+++ b/tests/clar/sandbox.h
@@ -72,7 +72,12 @@ static void clar_unsandbox(void)
 
 static int build_sandbox_path(void)
 {
+#ifdef CLAR_TMPDIR
+	const char path_tail[] = CLAR_TMPDIR "_XXXXXX";
+#else
 	const char path_tail[] = "clar_tmp_XXXXXX";
+#endif
+
 	size_t len;
 
 	if (find_tmp_path(_clar_path, sizeof(_clar_path)) < 0)