From 72112ecf818b3b411298b05f081bb10705d62119 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:05:42 +0900 Subject: XS_TEST_MAIN used instead of main in test programs This is the first step towards making test programs run on Windows. Signed-off-by: Martin Sustrik --- tests/test_hwm.cpp | 6 +----- tests/test_invalid_rep.cpp | 6 ++---- tests/test_linger.cpp | 7 ++----- tests/test_msg_flags.cpp | 7 ++----- tests/test_pair_inproc.cpp | 4 +--- tests/test_pair_ipc.cpp | 4 +--- tests/test_pair_tcp.cpp | 4 +--- tests/test_reconnect.cpp | 8 ++------ tests/test_reqrep_device.cpp | 8 ++------ tests/test_reqrep_inproc.cpp | 4 +--- tests/test_reqrep_ipc.cpp | 4 +--- tests/test_reqrep_tcp.cpp | 4 +--- tests/test_shutdown_stress.cpp | 7 +++---- tests/test_sub_forward.cpp | 8 ++------ tests/test_timeo.cpp | 10 +++------- tests/testutil.hpp | 7 +++++++ 16 files changed, 32 insertions(+), 66 deletions(-) diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp index a1db711..1a520c0 100644 --- a/tests/test_hwm.cpp +++ b/tests/test_hwm.cpp @@ -18,13 +18,9 @@ along with this program. If not, see . */ - -#include -#include - #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_hwm running...\n"); diff --git a/tests/test_invalid_rep.cpp b/tests/test_invalid_rep.cpp index 9ed2145..70a14e5 100644 --- a/tests/test_invalid_rep.cpp +++ b/tests/test_invalid_rep.cpp @@ -19,11 +19,9 @@ along with this program. If not, see . */ -#include "../include/xs.h" -#include -#include +#include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_invalid_rep running...\n"); diff --git a/tests/test_linger.cpp b/tests/test_linger.cpp index 942c309..d145e0d 100644 --- a/tests/test_linger.cpp +++ b/tests/test_linger.cpp @@ -18,12 +18,9 @@ along with this program. If not, see . */ -#include "../include/xs.h" -#include "../include/xs_utils.h" -#include -#include +#include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_invalid_rep running...\n"); diff --git a/tests/test_msg_flags.cpp b/tests/test_msg_flags.cpp index 535a7d5..6c2b819 100644 --- a/tests/test_msg_flags.cpp +++ b/tests/test_msg_flags.cpp @@ -18,12 +18,9 @@ along with this program. If not, see . */ -#include -#include +#include "testutil.hpp" -#include "../include/xs.h" - -int main (int argc, char *argv []) +int XS_TEST_MAIN () { // Create the infrastructure void *ctx = xs_init (1); diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp index d8f3726..653daca 100644 --- a/tests/test_pair_inproc.cpp +++ b/tests/test_pair_inproc.cpp @@ -18,11 +18,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_pair_inproc running...\n"); diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp index 5b9b536..8e7f17e 100644 --- a/tests/test_pair_ipc.cpp +++ b/tests/test_pair_ipc.cpp @@ -18,11 +18,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_pair_ipc running...\n"); diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp index 1c4bbf1..bf4fcd8 100644 --- a/tests/test_pair_tcp.cpp +++ b/tests/test_pair_tcp.cpp @@ -19,11 +19,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_pair_tcp running...\n"); diff --git a/tests/test_reconnect.cpp b/tests/test_reconnect.cpp index 9a62e1c..7ae505e 100644 --- a/tests/test_reconnect.cpp +++ b/tests/test_reconnect.cpp @@ -18,13 +18,9 @@ along with this program. If not, see . */ -#include -#include +#include "testutil.hpp" -#include "../include/xs.h" -#include "../include/xs_utils.h" - -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_reconnect running...\n"); diff --git a/tests/test_reqrep_device.cpp b/tests/test_reqrep_device.cpp index 5571eed..68ee347 100644 --- a/tests/test_reqrep_device.cpp +++ b/tests/test_reqrep_device.cpp @@ -19,13 +19,9 @@ along with this program. If not, see . */ -#include -#include -#include +#include "testutil.hpp" -#include "../include/xs.h" - -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_reqrep_device running...\n"); diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp index f715e4c..89080eb 100644 --- a/tests/test_reqrep_inproc.cpp +++ b/tests/test_reqrep_inproc.cpp @@ -18,11 +18,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_reqrep_inproc running...\n"); diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp index 652c372..557b8af 100644 --- a/tests/test_reqrep_ipc.cpp +++ b/tests/test_reqrep_ipc.cpp @@ -18,11 +18,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_reqrep_ipc running...\n"); diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp index ea33709..e86f947 100644 --- a/tests/test_reqrep_tcp.cpp +++ b/tests/test_reqrep_tcp.cpp @@ -19,11 +19,9 @@ along with this program. If not, see . */ -#include -#include #include "testutil.hpp" -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_reqrep_tcp running...\n"); diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp index 021a00e..7c36106 100644 --- a/tests/test_shutdown_stress.cpp +++ b/tests/test_shutdown_stress.cpp @@ -19,11 +19,10 @@ along with this program. If not, see . */ -#include "../include/xs.h" -#include +#include "testutil.hpp" + #include #include -#include #define THREAD_COUNT 100 @@ -44,7 +43,7 @@ extern "C" } } -int main (int argc, char *argv []) +int XS_TEST_MAIN () { void *ctx; void *s1; diff --git a/tests/test_sub_forward.cpp b/tests/test_sub_forward.cpp index 56d34c7..dafd338 100644 --- a/tests/test_sub_forward.cpp +++ b/tests/test_sub_forward.cpp @@ -19,13 +19,9 @@ along with this program. If not, see . */ -#include -#include +#include "testutil.hpp" -#include "../include/xs.h" -#include "../include/xs_utils.h" - -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_sub_forward running...\n"); diff --git a/tests/test_timeo.cpp b/tests/test_timeo.cpp index 79b4d39..29ed634 100644 --- a/tests/test_timeo.cpp +++ b/tests/test_timeo.cpp @@ -18,13 +18,9 @@ along with this program. If not, see . */ -#include -#include -#include -#include +#include "testutil.hpp" -#include "../include/xs.h" -#include "../include/xs_utils.h" +#include extern "C" { @@ -44,7 +40,7 @@ extern "C" } } -int main (int argc, char *argv []) +int XS_TEST_MAIN () { fprintf (stderr, "test_timeo running...\n"); diff --git a/tests/testutil.hpp b/tests/testutil.hpp index 8dbdbdb..ba4cf5f 100644 --- a/tests/testutil.hpp +++ b/tests/testutil.hpp @@ -24,8 +24,15 @@ #include #include +#include #include "../include/xs.h" +#include "../include/xs_utils.h" +#include "../src/platform.hpp" + +#if !defined XS_TEST_MAIN +#define XS_TEST_MAIN main +#endif inline void bounce (void *sb, void *sc) { -- cgit v1.2.3