Browse Source

[5078] Use KEA_SOCKET_TEST_DIR env variable to work around max path limit.

Marcin Siodelski 8 years ago
parent
commit
10966aa76b

+ 13 - 1
src/bin/agent/tests/ca_command_mgr_unittests.cc

@@ -20,6 +20,7 @@
 #include <boost/bind.hpp>
 #include <boost/pointer_cast.hpp>
 #include <gtest/gtest.h>
+#include <cstdlib>
 
 using namespace isc::agent;
 using namespace isc::asiolink;
@@ -83,9 +84,20 @@ public:
     }
 
     /// @brief Returns socket file path.
+    ///
+    /// If the KEA_SOCKET_TEST_DIR environment variable is specified, the
+    /// socket file is created in the location pointed to by this variable.
+    /// Otherwise, it is created in the build directory.
     static std::string unixSocketFilePath() {
         std::ostringstream s;
-        s << TEST_DATA_BUILDDIR << "/" << TEST_SOCKET;
+        const char* env = getenv("KEA_SOCKET_TEST_DIR");
+        if (env) {
+            s << std::string(env);
+        } else {
+            s << TEST_DATA_BUILDDIR;
+        }
+
+        s << "/" << TEST_SOCKET;
         return (s.str());
     }
 

+ 13 - 1
src/lib/asiolink/tests/unix_domain_socket_unittest.cc

@@ -12,6 +12,7 @@
 #include <gtest/gtest.h>
 #include <array>
 #include <cstdio>
+#include <cstdlib>
 #include <sstream>
 #include <string>
 
@@ -46,9 +47,20 @@ public:
     }
 
     /// @brief Returns socket file path.
+    ///
+    /// If the KEA_SOCKET_TEST_DIR environment variable is specified, the
+    /// socket file is created in the location pointed to by this variable.
+    /// Otherwise, it is created in the build directory.
     static std::string unixSocketFilePath() {
         std::ostringstream s;
-        s << TEST_DATA_BUILDDIR << "/" << TEST_SOCKET;
+        const char* env = getenv("KEA_SOCKET_TEST_DIR");
+        if (env) {
+            s << std::string(env);
+        } else {
+            s << TEST_DATA_BUILDDIR;
+        }
+
+        s << "/" << TEST_SOCKET;
         return (s.str());
     }