summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:42 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:05:42 +0900
commit72112ecf818b3b411298b05f081bb10705d62119 (patch)
tree1698b1df233c41aaaf2fb7b4f026e941ab58f3e8
parent4d15d0dcd4772f57f729a69d2c497461820ccb37 (diff)
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 <sustrik@250bpm.com>
-rw-r--r--tests/test_hwm.cpp6
-rw-r--r--tests/test_invalid_rep.cpp6
-rw-r--r--tests/test_linger.cpp7
-rw-r--r--tests/test_msg_flags.cpp7
-rw-r--r--tests/test_pair_inproc.cpp4
-rw-r--r--tests/test_pair_ipc.cpp4
-rw-r--r--tests/test_pair_tcp.cpp4
-rw-r--r--tests/test_reconnect.cpp8
-rw-r--r--tests/test_reqrep_device.cpp8
-rw-r--r--tests/test_reqrep_inproc.cpp4
-rw-r--r--tests/test_reqrep_ipc.cpp4
-rw-r--r--tests/test_reqrep_tcp.cpp4
-rw-r--r--tests/test_shutdown_stress.cpp7
-rw-r--r--tests/test_sub_forward.cpp8
-rw-r--r--tests/test_timeo.cpp10
-rw-r--r--tests/testutil.hpp7
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 <http://www.gnu.org/licenses/>.
*/
-
-#include <assert.h>
-#include <stdio.h>
-
#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 <http://www.gnu.org/licenses/>.
*/
-#include "../include/xs.h"
-#include <assert.h>
-#include <stdio.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include "../include/xs.h"
-#include "../include/xs_utils.h"
-#include <assert.h>
-#include <stdio.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <string.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <string.h>
-#include <stdio.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include "../include/xs.h"
-#include <assert.h>
+#include "testutil.hpp"
+
#include <pthread.h>
#include <stddef.h>
-#include <stdio.h>
#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <stdio.h>
+#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 <http://www.gnu.org/licenses/>.
*/
-#include <assert.h>
-#include <string.h>
-#include <pthread.h>
-#include <stdio.h>
+#include "testutil.hpp"
-#include "../include/xs.h"
-#include "../include/xs_utils.h"
+#include <pthread.h>
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 <assert.h>
#include <string.h>
+#include <stdio.h>
#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)
{