aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/RPCSession.cpp7
-rw-r--r--test/RPCSession.h21
2 files changed, 28 insertions, 0 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index e9df9031..124ee789 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -32,6 +32,8 @@ using namespace dev;
IPCSocket::IPCSocket(string const& _path): m_path(_path)
{
+#if defined(_WIN32)
+#else
if (_path.length() >= sizeof(sockaddr_un::sun_path))
BOOST_FAIL("Error opening IPC: socket path is too long!");
@@ -58,10 +60,14 @@ IPCSocket::IPCSocket(string const& _path): m_path(_path)
BOOST_FAIL("Error connecting to IPC socket: " << _path);
m_fp = fdopen(m_socket, "r");
+#endif
}
string IPCSocket::sendRequest(string const& _req)
{
+#if defined(_WIN32)
+ return "";
+#else
send(m_socket, _req.c_str(), _req.length(), 0);
char c;
@@ -74,6 +80,7 @@ string IPCSocket::sendRequest(string const& _req)
break;
}
return response;
+#endif
}
RPCSession& RPCSession::instance(const string& _path)
diff --git a/test/RPCSession.h b/test/RPCSession.h
index 1a1fbbe5..fd77ceca 100644
--- a/test/RPCSession.h
+++ b/test/RPCSession.h
@@ -22,12 +22,32 @@
#include <string>
#include <stdio.h>
#include <map>
+#if defined(_WIN32)
+#else
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
+#endif
#include <json/value.h>
#include <boost/test/unit_test.hpp>
+#if defined(_WIN32)
+class IPCSocket : public boost::noncopyable
+{
+public:
+ IPCSocket(std::string const& _path);
+ std::string sendRequest(std::string const& _req);
+ ~IPCSocket() { fclose(m_fp); }
+
+ std::string const& path() const { return m_path; }
+
+private:
+ FILE *m_fp;
+ std::string m_path;
+ int m_socket;
+
+};
+#else
class IPCSocket: public boost::noncopyable
{
public:
@@ -43,6 +63,7 @@ private:
int m_socket;
};
+#endif
class RPCSession: public boost::noncopyable
{