0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 07:31:03 +08:00

Problem: default test setUp/tearDown functions duplicated in many test programs

Solution: define setUp/tearDown functions via SETUP_TEARDOWN_TESTCONTEXT macro where possible
This commit is contained in:
Simon Giesecke 2019-03-24 12:51:28 -04:00
parent 2b80dd7add
commit af4fa22fd8
87 changed files with 92 additions and 851 deletions

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static const char test_endpoint[] = "ipc://@tmp-tester"; static const char test_endpoint[] = "ipc://@tmp-tester";

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_x () void test_x ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_x () void test_x ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void create_inproc_client_server_pair (void **server_, void **client_) void create_inproc_client_server_pair (void **server_, void **client_)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_x () void test_x ()
{ {

View File

@ -31,17 +31,7 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include "testutil_security.hpp" #include "testutil_security.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_send_one_connected_one_unconnected () void test_send_one_connected_one_unconnected ()
{ {

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
const char *rconn1routing_id = "conn1"; const char *rconn1routing_id = "conn1";
const char *x_routing_id = "X"; const char *x_routing_id = "X";

View File

@ -31,15 +31,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
#define WAIT_FOR_BACKGROUND_THREAD_INSPECTION (0) #define WAIT_FOR_BACKGROUND_THREAD_INSPECTION (0)

View File

@ -32,17 +32,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void str_send_to (void *s_, const char *content_, const char *address_) void str_send_to (void *s_, const char *content_, const char *address_)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_diffserv () void test_diffserv ()
{ {

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
/// Initialize a zeromq message with a given null-terminated string /// Initialize a zeromq message with a given null-terminated string
#define ZMQ_PREPARE_STRING(msg, data, size) \ #define ZMQ_PREPARE_STRING(msg, data, size) \

View File

@ -33,15 +33,7 @@
#include <unistd.h> #include <unistd.h>
#include <grp.h> #include <grp.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static void bounce_fail (void *server_, void *client_) static void bounce_fail (void *server_, void *client_)
{ {

View File

@ -36,15 +36,7 @@
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h> #include <sys/wait.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
char connect_address[MAX_SOCKET_STRING]; char connect_address[MAX_SOCKET_STRING];

View File

@ -26,15 +26,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <string.h> #include <string.h>
void setUp ()
{
setup_test_context ();
}
void tearDown () SETUP_TEARDOWN_TESTCONTEXT
{
teardown_test_context ();
}
void test_getsockopt_memset () void test_getsockopt_memset ()
{ {

View File

@ -42,16 +42,7 @@ typedef int raw_socket;
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Read one event off the monitor socket; return value and address // Read one event off the monitor socket; return value and address
// by reference, if not null, and event number by value. Returns -1 // by reference, if not null, and event number by value. Returns -1

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
const int MAX_SENDS = 10000; const int MAX_SENDS = 10000;

View File

@ -36,15 +36,7 @@
// ensure we have extra space for that: // ensure we have extra space for that:
#define SOCKET_STRING_LEN (MAX_SOCKET_STRING * 4) #define SOCKET_STRING_LEN (MAX_SOCKET_STRING * 4)
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
int test_defaults (int send_hwm_, int msg_cnt_, const char *endpoint) int test_defaults (int send_hwm_, int msg_cnt_, const char *endpoint)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_immediate_1 () void test_immediate_1 ()
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static void pusher (void * /*unused*/) static void pusher (void * /*unused*/)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_invalid_rep () void test_invalid_rep ()
{ {

View File

@ -32,17 +32,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// XSI vector I/O // XSI vector I/O
#if defined ZMQ_HAVE_UIO #if defined ZMQ_HAVE_UIO

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_ipc_wildcard () void test_ipc_wildcard ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Issue 566 describes a problem in libzmq v4.0.0 where a dealer to router // Issue 566 describes a problem in libzmq v4.0.0 where a dealer to router
// connection would fail randomly. The test works when the two sockets are // connection would fail randomly. The test works when the two sockets are

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static void do_bind_and_verify (void *s_, const char *endpoint_) static void do_bind_and_verify (void *s_, const char *endpoint_)
{ {

View File

@ -34,15 +34,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <vector> #include <vector>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_system_max () void test_system_max ()
{ {

View File

@ -34,15 +34,7 @@ typedef int raw_socket;
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Read one event off the monitor socket; return value and address // Read one event off the monitor socket; return value and address
// by reference, if not null, and event number by value. Returns -1 // by reference, if not null, and event number by value. Returns -1

View File

@ -35,15 +35,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_monitor_invalid_protocol_fails () void test_monitor_invalid_protocol_fails ()
{ {

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void ffn (void *data_, void *hint_) void ffn (void *data_, void *hint_)
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_more () void test_more ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_roundtrip () void test_roundtrip ()
{ {

View File

@ -32,16 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
typedef void (*extra_func_t) (void *socket_); typedef void (*extra_func_t) (void *socket_);

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
typedef void (*extra_func_t) (void *socket_); typedef void (*extra_func_t) (void *socket_);

View File

@ -31,17 +31,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_roundtrip () void test_roundtrip ()
{ {

View File

@ -34,15 +34,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_pair_vmci () void test_pair_vmci ()
{ {

View File

@ -30,7 +30,6 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h>
#include <limits.h> #include <limits.h>
#ifndef _WIN32 #ifndef _WIN32
@ -40,15 +39,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
fd_t get_fd (void *socket_) fd_t get_fd (void *socket_)
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_probe_router_router () void test_probe_router_router ()
{ {

View File

@ -33,15 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
#define CONTENT_SIZE 13 #define CONTENT_SIZE 13
#define CONTENT_SIZE_MAX 32 #define CONTENT_SIZE_MAX 32

View File

@ -32,15 +32,7 @@
#include <stdlib.h> #include <stdlib.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// This is our server task. // This is our server task.
// It runs a proxy with a single REP socket as both frontend and backend. // It runs a proxy with a single REP socket as both frontend and backend.

View File

@ -32,15 +32,7 @@
#include <stdlib.h> #include <stdlib.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// This is a test for issue #1382. The server thread creates a SUB-PUSH // This is a test for issue #1382. The server thread creates a SUB-PUSH
// steerable proxy. The main process then sends messages to the SUB // steerable proxy. The main process then sends messages to the SUB

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test () void test ()
{ {

View File

@ -30,8 +30,6 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h>
#include <string.h> #include <string.h>
#ifndef _WIN32 #ifndef _WIN32
@ -53,15 +51,7 @@
_test (true); \ _test (true); \
} }
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void msg_send_expect_success (void *s_, const char *group_, const char *body_) void msg_send_expect_success (void *s_, const char *group_, const char *body_)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_rebind_ipc () void test_rebind_ipc ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_reconnect_ivl_against_pair_socket (const char *my_endpoint_, void test_reconnect_ivl_against_pair_socket (const char *my_endpoint_,
void *sb_) void *sb_)

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_req_correlate () void test_req_correlate ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_roundtrip () void test_roundtrip ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// TODO this is heavily duplicated with test_reqrep_device.cpp // TODO this is heavily duplicated with test_reqrep_device.cpp
void test_roundtrip () void test_roundtrip ()

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_roundtrip () void test_roundtrip ()
{ {

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <stdlib.h> #include <stdlib.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_leak () void test_leak ()
{ {

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_single_connect (int ipv6_) void test_single_connect (int ipv6_)
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_roundtrip () void test_roundtrip ()
{ {

View File

@ -34,15 +34,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_reqrep_vmci () void test_reqrep_vmci ()
{ {

View File

@ -28,20 +28,9 @@
*/ */
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_with_handover () void test_with_handover ()
{ {

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
#ifdef ZMQ_BUILD_DRAFT_API #ifdef ZMQ_BUILD_DRAFT_API
bool send_msg_to_peer_if_ready (void *router_, const char *peer_routing_id_) bool send_msg_to_peer_if_ready (void *router_, const char *peer_routing_id_)

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// DEBUG shouldn't be defined in sources as it will cause a redefined symbol // 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 // error when it is defined in the build configuration. It appears that the

View File

@ -32,15 +32,7 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_router_mandatory_tipc () void test_router_mandatory_tipc ()
{ {

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_sockopt_router_notify () void test_sockopt_router_notify ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_scatter_gather_multipart_fails () void test_scatter_gather_multipart_fails ()
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_no_zap_handler () void test_no_zap_handler ()
{ {

View File

@ -30,15 +30,7 @@
#include "testutil_security.hpp" #include "testutil_security.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static void zap_handler_wrong_version (void * /*unused_*/) static void zap_handler_wrong_version (void * /*unused_*/)
{ {

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_setsockopt_tcp_recv_buffer () void test_setsockopt_tcp_recv_buffer ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
const int MAX_SENDS = 10000; const int MAX_SENDS = 10000;

View File

@ -30,16 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// SHALL route outgoing messages to available peers using a round-robin // SHALL route outgoing messages to available peers using a round-robin
// strategy. // strategy.

View File

@ -33,15 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
char connect_address[MAX_SOCKET_STRING]; char connect_address[MAX_SOCKET_STRING];

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <stdlib.h> #include <stdlib.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
char connect_address[MAX_SOCKET_STRING]; char connect_address[MAX_SOCKET_STRING];

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
char connect_address[MAX_SOCKET_STRING]; char connect_address[MAX_SOCKET_STRING];

View File

@ -32,18 +32,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unity.h>
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
SETUP_TEARDOWN_TESTCONTEXT
// SHALL receive incoming messages from its peers using a fair-queuing // SHALL receive incoming messages from its peers using a fair-queuing
// strategy. // strategy.

View File

@ -31,17 +31,8 @@
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <string.h> #include <string.h>
#include <unity.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
#define MSG_SIZE 20 #define MSG_SIZE 20

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// ZMTP protocol greeting structure // ZMTP protocol greeting structure

View File

@ -32,15 +32,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
static const int SERVER = 0; static const int SERVER = 0;
static const int CLIENT = 1; static const int CLIENT = 1;

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_stream_empty () void test_stream_empty ()
{ {

View File

@ -38,15 +38,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_stream_exceeds_buffer () void test_stream_exceeds_buffer ()
{ {

View File

@ -33,15 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Read one event off the monitor socket; return value and address // Read one event off the monitor socket; return value and address
// by reference, if not null, and event number by value. Returns -1 // by reference, if not null, and event number by value. Returns -1

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test () void test ()
{ {

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test () void test ()
{ {

View File

@ -39,15 +39,7 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Solaris has a default of 256 max files per process // Solaris has a default of 256 max files per process
#ifdef ZMQ_HAVE_SOLARIS #ifdef ZMQ_HAVE_SOLARIS

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
/* Use the worst case filename size for the buffer (+1 for trailing NUL), this /* Use the worst case filename size for the buffer (+1 for trailing NUL), this
* is larger than MAX_SOCKET_STRING, which is not large enough for IPC */ * is larger than MAX_SOCKET_STRING, which is not large enough for IPC */

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
const char ep[] = "tipc://{5560,0,0}"; const char ep[] = "tipc://{5560,0,0}";
const char name[] = "tipc://{5560,0}@0.0.0"; const char name[] = "tipc://{5560,0}@0.0.0";

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
// Client threads loop on send/recv until told to exit // Client threads loop on send/recv until told to exit
void client_thread (void *client_) void client_thread (void *client_)

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_timeo () void test_timeo ()
{ {

View File

@ -22,15 +22,7 @@
#include <string.h> #include <string.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_address_wildcard_ipv4 () void test_address_wildcard_ipv4 ()
{ {

View File

@ -32,19 +32,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unity.h>
#include <unistd.h> #include <unistd.h>
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
#if !defined(ZMQ_HAVE_WINDOWS) #if !defined(ZMQ_HAVE_WINDOWS)
#include <sys/socket.h> #include <sys/socket.h>

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_basic () void test_basic ()
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test () void test ()
{ {

View File

@ -30,15 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
const uint8_t unsubscribe_a_msg[] = {0, 'A'}; const uint8_t unsubscribe_a_msg[] = {0, 'A'};
const uint8_t subscribe_a_msg[] = {1, 'A'}; const uint8_t subscribe_a_msg[] = {1, 'A'};

View File

@ -30,17 +30,7 @@
#include "testutil.hpp" #include "testutil.hpp"
#include "testutil_unity.hpp" #include "testutil_unity.hpp"
#include <unity.h> SETUP_TEARDOWN_TESTCONTEXT
void setUp ()
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test () void test ()
{ {

View File

@ -32,21 +32,12 @@
#include <netdb.h> #include <netdb.h>
#include <string.h> #include <string.h>
#include <unity.h>
#ifndef _WIN32 #ifndef _WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
void setUp () SETUP_TEARDOWN_TESTCONTEXT
{
setup_test_context ();
}
void tearDown ()
{
teardown_test_context ();
}
void test_poll_fd () void test_poll_fd ()
{ {

View File

@ -181,6 +181,12 @@ void recv_array_expect_success (void *socket_,
// for each test case, and some consistency checks can be performed. // for each test case, and some consistency checks can be performed.
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Use this is an test executable to perform a default setup and teardown of
// the test context, which is appropriate for many libzmq test cases.
#define SETUP_TEARDOWN_TESTCONTEXT \
void setUp () { setup_test_context (); } \
void tearDown () { teardown_test_context (); }
// The maximum number of sockets that can be managed by the test context. // The maximum number of sockets that can be managed by the test context.
#define MAX_TEST_SOCKETS 128 #define MAX_TEST_SOCKETS 128