0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-02 03:08:04 +08:00

Merge pull request #648 from ricnewton/master

Fix tests on windows
This commit is contained in:
Pieter Hintjens 2013-09-06 03:19:45 -07:00
commit 4edad54537
2 changed files with 33 additions and 1 deletions

View File

@ -22,7 +22,7 @@
#include "testutil.hpp"
#include "../include/zmq_utils.h"
#include "../src/z85_codec.hpp"
#include "../src/platform.hpp"
#include "platform.hpp"
// Test keys from the zmq_curve man page
static char client_public [] = "Yne@$w-vo<fVvi]a<NY6T1ed:M$fCG*[IaLV{hID";

View File

@ -18,10 +18,40 @@
*/
#include "../include/zmq.h"
#include "platform.hpp"
#if defined (ZMQ_HAVE_WINDOWS)
#include <WinSock2.h>
#include <stdexcept>
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <assert.h>
#endif
#if defined (ZMQ_HAVE_WINDOWS)
void initialise_network()
{
WSADATA info;
if (WSAStartup(MAKEWORD(2,0), &info) != 0)
{
throw std::runtime_error("Could not start WSA");
}
}
int close(int fd)
{
return closesocket(fd);
}
#else
void initialise_network()
{
}
#endif
// This test case stresses the system to shake out known configuration
// problems. We're not using libzmq here but direct system calls. Note
@ -29,6 +59,8 @@
int main (void)
{
initialise_network();
// Check that we can create 1,000 sockets
int handle [1000];
int count;