mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 10:33:52 +01:00
Problem: tests don't build on Windows
There were numerous small issues with test cases: - some lacked the right source file header - some were not portable at all - some were using internal libzmq APIs (headers) Solution: fixed and cleaned up.
This commit is contained in:
parent
06acd76a21
commit
bbcc79d188
@ -21,7 +21,13 @@
|
||||
'conditions': [
|
||||
[ 'OS=="win"', {
|
||||
'defines': [
|
||||
'ZMQ_HAVE_WINDOWS=1'
|
||||
'ZMQ_HAVE_WINDOWS=1',
|
||||
'ZMQ_STATIC'
|
||||
],
|
||||
'libraries': [
|
||||
'ws2_32',
|
||||
'advapi32',
|
||||
'iphlpapi'
|
||||
]
|
||||
}],
|
||||
[ 'OS=="mac"', {
|
||||
|
@ -8,4 +8,6 @@ If you must write non-portable code, wrap it in #ifdefs to ensure it will compil
|
||||
|
||||
Note that testutil.hpp includes platform.h. Do not include it yourself as it changes location depending on the build system and OS.
|
||||
|
||||
All sources must contain the correct header. Please copy from test_system.cpp if you're not certain.
|
||||
|
||||
|
||||
|
@ -27,16 +27,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/zmq.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
int main (void)
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 VMware, Inc.
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
@ -29,12 +27,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/zmq.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include "testutil.hpp"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
@ -29,7 +27,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "testutil.hpp"
|
||||
|
||||
int main (void)
|
||||
|
@ -27,9 +27,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "testutil.hpp"
|
||||
#include <unistd.h>
|
||||
|
||||
// DEBUG shouldn't be defined in sources as it will cause a redefined symbol
|
||||
// error when it is defined in the build configuration. It appears that the
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
|
@ -1,3 +1,32 @@
|
||||
/*
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
void test_setsockopt_tcp_recv_buffer (void)
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
@ -29,13 +27,7 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/zmq.h"
|
||||
#include <pthread.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include "testutil.hpp"
|
||||
|
||||
#define THREAD_COUNT 100
|
||||
|
||||
|
@ -1,3 +1,32 @@
|
||||
/*
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
const int MAX_SENDS = 10000;
|
||||
|
@ -1,8 +1,34 @@
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
/*
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
libzmq is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License (LGPL) as published
|
||||
by the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
As a special exception, the Contributors give you permission to link
|
||||
this library with independent modules to produce an executable,
|
||||
regardless of the license terms of these independent modules, and to
|
||||
copy and distribute the resulting executable under terms of your choice,
|
||||
provided that you also meet, for each linked independent module, the
|
||||
terms and conditions of the license of that module. An independent
|
||||
module is a module which is not derived from or based on this library.
|
||||
If you modify this library, you must extend this exception to your
|
||||
version of the library.
|
||||
|
||||
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
#if defined (ZMQ_HAVE_WINDOWS)
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
@ -29,12 +27,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/zmq.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
int main (void)
|
||||
|
@ -1,7 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2010-2011 250bpm s.r.o.
|
||||
Copyright (c) 2011 iMatix Corporation
|
||||
Copyright (c) 2010-2011 Other contributors as noted in the AUTHORS file
|
||||
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of libzmq, the ZeroMQ core engine in C++.
|
||||
|
||||
@ -29,13 +27,6 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/zmq.h"
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
int main (void)
|
||||
|
@ -29,14 +29,6 @@
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
#include "windows.hpp"
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "testutil.hpp"
|
||||
|
||||
void sleep_ (long timeout_)
|
||||
{
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
|
@ -27,11 +27,12 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include "testutil.hpp"
|
||||
|
||||
#if !defined (ZMQ_HAVE_WINDOWS)
|
||||
# include <sys/socket.h>
|
||||
# include <sys/un.h>
|
||||
|
||||
void pre_allocate_sock (void *zmq_socket, const char *path)
|
||||
{
|
||||
struct sockaddr_un addr;
|
||||
@ -211,3 +212,10 @@ int main (void)
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
#else
|
||||
int main (void)
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
#endif
|
||||
|
@ -27,11 +27,11 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include "testutil.hpp"
|
||||
|
||||
#if !defined (ZMQ_HAVE_WINDOWS)
|
||||
#include <netdb.h>
|
||||
|
||||
void pre_allocate_sock (void *zmq_socket, const char *address,
|
||||
const char *port)
|
||||
{
|
||||
@ -204,3 +204,9 @@ int main (void)
|
||||
|
||||
return 0 ;
|
||||
}
|
||||
#else
|
||||
int main (void)
|
||||
{
|
||||
return 0 ;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user