summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2011-03-28 10:39:51 +0200
committerMartin Lucina <martin@lucina.net>2012-01-23 08:53:37 +0100
commit3e20cb1b8a2b1ca222011df37334e5f4f88dd565 (patch)
tree4a753775186bc7f583f1ceb3f9aa675b6f110596 /tests
parent3f0085ddbef1a44b6bb7a0b23af497d56e0025fa (diff)
parente645fc2693acc796304498909786b7b47005b429 (diff)
Imported Debian patch 2.1.3-1debian/2.1.3-1
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am30
-rw-r--r--tests/Makefile.in707
-rw-r--r--tests/test_hwm.cpp68
-rw-r--r--tests/test_pair_inproc.cpp31
-rw-r--r--tests/test_pair_ipc.cpp31
-rw-r--r--tests/test_pair_tcp.cpp31
-rw-r--r--tests/test_reqrep_inproc.cpp31
-rw-r--r--tests/test_reqrep_ipc.cpp31
-rw-r--r--tests/test_reqrep_tcp.cpp31
-rw-r--r--tests/test_shutdown_stress.cpp87
-rw-r--r--tests/testutil.hpp130
11 files changed, 1208 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..ebbc46c
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,30 @@
+INCLUDES = -I$(top_builddir)/include
+LDADD = $(top_builddir)/src/libzmq.la
+
+noinst_PROGRAMS = test_pair_inproc \
+ test_pair_tcp \
+ test_reqrep_inproc \
+ test_reqrep_tcp \
+ test_hwm
+
+if !ON_MINGW
+noinst_PROGRAMS += test_shutdown_stress \
+ test_pair_ipc \
+ test_reqrep_ipc
+endif
+
+test_pair_inproc_SOURCES = test_pair_inproc.cpp testutil.hpp
+test_pair_tcp_SOURCES = test_pair_tcp.cpp testutil.hpp
+
+test_reqrep_inproc_SOURCES = test_reqrep_inproc.cpp testutil.hpp
+test_reqrep_tcp_SOURCES = test_reqrep_tcp.cpp testutil.hpp
+
+test_hwm_SOURCES = test_hwm.cpp
+
+if !ON_MINGW
+test_shutdown_stress_SOURCES = test_shutdown_stress.cpp
+test_pair_ipc_SOURCES = test_pair_ipc.cpp testutil.hpp
+test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
+endif
+
+TESTS = $(noinst_PROGRAMS)
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..f6c9c15
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,707 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+noinst_PROGRAMS = test_pair_inproc$(EXEEXT) test_pair_tcp$(EXEEXT) \
+ test_reqrep_inproc$(EXEEXT) test_reqrep_tcp$(EXEEXT) \
+ test_hwm$(EXEEXT) $(am__EXEEXT_1)
+@ON_MINGW_FALSE@am__append_1 = test_shutdown_stress \
+@ON_MINGW_FALSE@ test_pair_ipc \
+@ON_MINGW_FALSE@ test_reqrep_ipc
+
+subdir = tests
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/config/libtool.m4 \
+ $(top_srcdir)/config/ltoptions.m4 \
+ $(top_srcdir)/config/ltsugar.m4 \
+ $(top_srcdir)/config/ltversion.m4 \
+ $(top_srcdir)/config/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/src/platform.hpp
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+@ON_MINGW_FALSE@am__EXEEXT_1 = test_shutdown_stress$(EXEEXT) \
+@ON_MINGW_FALSE@ test_pair_ipc$(EXEEXT) \
+@ON_MINGW_FALSE@ test_reqrep_ipc$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am_test_hwm_OBJECTS = test_hwm.$(OBJEXT)
+test_hwm_OBJECTS = $(am_test_hwm_OBJECTS)
+test_hwm_LDADD = $(LDADD)
+test_hwm_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+am_test_pair_inproc_OBJECTS = test_pair_inproc.$(OBJEXT)
+test_pair_inproc_OBJECTS = $(am_test_pair_inproc_OBJECTS)
+test_pair_inproc_LDADD = $(LDADD)
+test_pair_inproc_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am__test_pair_ipc_SOURCES_DIST = test_pair_ipc.cpp testutil.hpp
+@ON_MINGW_FALSE@am_test_pair_ipc_OBJECTS = test_pair_ipc.$(OBJEXT)
+test_pair_ipc_OBJECTS = $(am_test_pair_ipc_OBJECTS)
+test_pair_ipc_LDADD = $(LDADD)
+test_pair_ipc_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am_test_pair_tcp_OBJECTS = test_pair_tcp.$(OBJEXT)
+test_pair_tcp_OBJECTS = $(am_test_pair_tcp_OBJECTS)
+test_pair_tcp_LDADD = $(LDADD)
+test_pair_tcp_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am_test_reqrep_inproc_OBJECTS = test_reqrep_inproc.$(OBJEXT)
+test_reqrep_inproc_OBJECTS = $(am_test_reqrep_inproc_OBJECTS)
+test_reqrep_inproc_LDADD = $(LDADD)
+test_reqrep_inproc_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am__test_reqrep_ipc_SOURCES_DIST = test_reqrep_ipc.cpp testutil.hpp
+@ON_MINGW_FALSE@am_test_reqrep_ipc_OBJECTS = \
+@ON_MINGW_FALSE@ test_reqrep_ipc.$(OBJEXT)
+test_reqrep_ipc_OBJECTS = $(am_test_reqrep_ipc_OBJECTS)
+test_reqrep_ipc_LDADD = $(LDADD)
+test_reqrep_ipc_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am_test_reqrep_tcp_OBJECTS = test_reqrep_tcp.$(OBJEXT)
+test_reqrep_tcp_OBJECTS = $(am_test_reqrep_tcp_OBJECTS)
+test_reqrep_tcp_LDADD = $(LDADD)
+test_reqrep_tcp_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+am__test_shutdown_stress_SOURCES_DIST = test_shutdown_stress.cpp
+@ON_MINGW_FALSE@am_test_shutdown_stress_OBJECTS = \
+@ON_MINGW_FALSE@ test_shutdown_stress.$(OBJEXT)
+test_shutdown_stress_OBJECTS = $(am_test_shutdown_stress_OBJECTS)
+test_shutdown_stress_LDADD = $(LDADD)
+test_shutdown_stress_DEPENDENCIES = $(top_builddir)/src/libzmq.la
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_$(V))
+am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+am__v_CXX_0 = @echo " CXX " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_$(V))
+am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo " CC " $@;
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo " CCLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo " GEN " $@;
+SOURCES = $(test_hwm_SOURCES) $(test_pair_inproc_SOURCES) \
+ $(test_pair_ipc_SOURCES) $(test_pair_tcp_SOURCES) \
+ $(test_reqrep_inproc_SOURCES) $(test_reqrep_ipc_SOURCES) \
+ $(test_reqrep_tcp_SOURCES) $(test_shutdown_stress_SOURCES)
+DIST_SOURCES = $(test_hwm_SOURCES) $(test_pair_inproc_SOURCES) \
+ $(am__test_pair_ipc_SOURCES_DIST) $(test_pair_tcp_SOURCES) \
+ $(test_reqrep_inproc_SOURCES) \
+ $(am__test_reqrep_ipc_SOURCES_DIST) $(test_reqrep_tcp_SOURCES) \
+ $(am__test_shutdown_stress_SOURCES_DIST)
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors = \
+red=; grn=; lgn=; blu=; std=
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AS = @AS@
+ASCIIDOC = @ASCIIDOC@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBZMQ_EXTRA_CFLAGS = @LIBZMQ_EXTRA_CFLAGS@
+LIBZMQ_EXTRA_CXXFLAGS = @LIBZMQ_EXTRA_CXXFLAGS@
+LIBZMQ_EXTRA_LDFLAGS = @LIBZMQ_EXTRA_LDFLAGS@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+LTVER = @LTVER@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XMLTO = @XMLTO@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+ac_zmq_have_asciidoc = @ac_zmq_have_asciidoc@
+ac_zmq_have_xmlto = @ac_zmq_have_xmlto@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pgm_basename = @pgm_basename@
+pgm_srcdir = @pgm_srcdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I$(top_builddir)/include
+LDADD = $(top_builddir)/src/libzmq.la
+test_pair_inproc_SOURCES = test_pair_inproc.cpp testutil.hpp
+test_pair_tcp_SOURCES = test_pair_tcp.cpp testutil.hpp
+test_reqrep_inproc_SOURCES = test_reqrep_inproc.cpp testutil.hpp
+test_reqrep_tcp_SOURCES = test_reqrep_tcp.cpp testutil.hpp
+test_hwm_SOURCES = test_hwm.cpp
+@ON_MINGW_FALSE@test_shutdown_stress_SOURCES = test_shutdown_stress.cpp
+@ON_MINGW_FALSE@test_pair_ipc_SOURCES = test_pair_ipc.cpp testutil.hpp
+@ON_MINGW_FALSE@test_reqrep_ipc_SOURCES = test_reqrep_ipc.cpp testutil.hpp
+TESTS = $(noinst_PROGRAMS)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+test_hwm$(EXEEXT): $(test_hwm_OBJECTS) $(test_hwm_DEPENDENCIES)
+ @rm -f test_hwm$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_hwm_OBJECTS) $(test_hwm_LDADD) $(LIBS)
+test_pair_inproc$(EXEEXT): $(test_pair_inproc_OBJECTS) $(test_pair_inproc_DEPENDENCIES)
+ @rm -f test_pair_inproc$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_pair_inproc_OBJECTS) $(test_pair_inproc_LDADD) $(LIBS)
+test_pair_ipc$(EXEEXT): $(test_pair_ipc_OBJECTS) $(test_pair_ipc_DEPENDENCIES)
+ @rm -f test_pair_ipc$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_pair_ipc_OBJECTS) $(test_pair_ipc_LDADD) $(LIBS)
+test_pair_tcp$(EXEEXT): $(test_pair_tcp_OBJECTS) $(test_pair_tcp_DEPENDENCIES)
+ @rm -f test_pair_tcp$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_pair_tcp_OBJECTS) $(test_pair_tcp_LDADD) $(LIBS)
+test_reqrep_inproc$(EXEEXT): $(test_reqrep_inproc_OBJECTS) $(test_reqrep_inproc_DEPENDENCIES)
+ @rm -f test_reqrep_inproc$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_reqrep_inproc_OBJECTS) $(test_reqrep_inproc_LDADD) $(LIBS)
+test_reqrep_ipc$(EXEEXT): $(test_reqrep_ipc_OBJECTS) $(test_reqrep_ipc_DEPENDENCIES)
+ @rm -f test_reqrep_ipc$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_reqrep_ipc_OBJECTS) $(test_reqrep_ipc_LDADD) $(LIBS)
+test_reqrep_tcp$(EXEEXT): $(test_reqrep_tcp_OBJECTS) $(test_reqrep_tcp_DEPENDENCIES)
+ @rm -f test_reqrep_tcp$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_reqrep_tcp_OBJECTS) $(test_reqrep_tcp_LDADD) $(LIBS)
+test_shutdown_stress$(EXEEXT): $(test_shutdown_stress_OBJECTS) $(test_shutdown_stress_DEPENDENCIES)
+ @rm -f test_shutdown_stress$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(test_shutdown_stress_OBJECTS) $(test_shutdown_stress_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_hwm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pair_inproc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pair_ipc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pair_tcp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_reqrep_inproc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_reqrep_ipc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_reqrep_tcp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shutdown_stress.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cpp.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ $(am__tty_colors); \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=XPASS; \
+ ;; \
+ *) \
+ col=$$grn; res=PASS; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$tst[\ \ ]*) \
+ xfail=`expr $$xfail + 1`; \
+ col=$$lgn; res=XFAIL; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ col=$$red; res=FAIL; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ col=$$blu; res=SKIP; \
+ fi; \
+ echo "$${col}$$res$${std}: $$tst"; \
+ done; \
+ if test "$$all" -eq 1; then \
+ tests="test"; \
+ All=""; \
+ else \
+ tests="tests"; \
+ All="All "; \
+ fi; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="$$All$$all $$tests passed"; \
+ else \
+ if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+ banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all $$tests failed"; \
+ else \
+ if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+ banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ if test "$$skip" -eq 1; then \
+ skipped="($$skip test was not run)"; \
+ else \
+ skipped="($$skip tests were not run)"; \
+ fi; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ if test "$$failed" -eq 0; then \
+ echo "$$grn$$dashes"; \
+ else \
+ echo "$$red$$dashes"; \
+ fi; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes$$std"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/tests/test_hwm.cpp b/tests/test_hwm.cpp
new file mode 100644
index 0000000..d73c25f
--- /dev/null
+++ b/tests/test_hwm.cpp
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+#include "../src/stdint.hpp"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ uint64_t hwm = 5;
+ int linger = 0;
+
+ zmq::context_t context (1);
+ zmq::socket_t s1 (context, ZMQ_PULL);
+ zmq::socket_t s2 (context, ZMQ_PUSH);
+
+ s2.setsockopt (ZMQ_LINGER, &linger, sizeof (int));
+ s2.setsockopt (ZMQ_HWM, &hwm, sizeof (uint64_t));
+
+ s1.bind ("tcp://127.0.0.1:5858");
+ s2.connect ("tcp://127.0.0.1:5858");
+
+ for (int i = 0; i < 10; i++)
+ {
+ zmq::message_t msg (sizeof ("test") - 1);
+ memcpy (msg.data (), "test", sizeof ("test") - 1);
+
+ bool sent = s2.send (msg, ZMQ_NOBLOCK);
+
+ // Anything below HWM should be sent
+ if (i < 5) {
+ assert (sent);
+ } else {
+ assert (!sent && errno == EAGAIN);
+ }
+ }
+
+ // There should be now 5 messages pending, consume one
+ zmq::message_t msg;
+
+ bool received = s1.recv (&msg, 0);
+ assert (received);
+
+ // Now it should be possible to send one more
+ bool sent = s2.send (msg, 0);
+ assert (sent);
+
+ return 0;
+}
diff --git a/tests/test_pair_inproc.cpp b/tests/test_pair_inproc.cpp
new file mode 100644
index 0000000..5736674
--- /dev/null
+++ b/tests/test_pair_inproc.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "inproc://tester" ;
+ basic_tests (transport, ZMQ_PAIR, ZMQ_PAIR);
+ return 0 ;
+}
diff --git a/tests/test_pair_ipc.cpp b/tests/test_pair_ipc.cpp
new file mode 100644
index 0000000..f8a4270
--- /dev/null
+++ b/tests/test_pair_ipc.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "ipc:///tmp/tester" ;
+ basic_tests (transport, ZMQ_PAIR, ZMQ_PAIR);
+ return 0 ;
+}
diff --git a/tests/test_pair_tcp.cpp b/tests/test_pair_tcp.cpp
new file mode 100644
index 0000000..e902f7f
--- /dev/null
+++ b/tests/test_pair_tcp.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "tcp://127.0.0.1:5555" ;
+ basic_tests (transport, ZMQ_PAIR, ZMQ_PAIR);
+ return 0 ;
+}
diff --git a/tests/test_reqrep_inproc.cpp b/tests/test_reqrep_inproc.cpp
new file mode 100644
index 0000000..b46f89c
--- /dev/null
+++ b/tests/test_reqrep_inproc.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "inproc://tester" ;
+ basic_tests (transport, ZMQ_REQ, ZMQ_REP);
+ return 0 ;
+}
diff --git a/tests/test_reqrep_ipc.cpp b/tests/test_reqrep_ipc.cpp
new file mode 100644
index 0000000..4134b1c
--- /dev/null
+++ b/tests/test_reqrep_ipc.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "ipc:///tmp/tester" ;
+ basic_tests (transport, ZMQ_REQ, ZMQ_REP);
+ return 0 ;
+}
diff --git a/tests/test_reqrep_tcp.cpp b/tests/test_reqrep_tcp.cpp
new file mode 100644
index 0000000..9f1f3e6
--- /dev/null
+++ b/tests/test_reqrep_tcp.cpp
@@ -0,0 +1,31 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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"
+
+using namespace std;
+using namespace zmqtestutil;
+
+int main (int argc, char *argv [])
+{
+ const char *transport = "tcp://127.0.0.1:5555" ;
+ basic_tests (transport, ZMQ_REQ, ZMQ_REP);
+ return 0 ;
+}
diff --git a/tests/test_shutdown_stress.cpp b/tests/test_shutdown_stress.cpp
new file mode 100644
index 0000000..85ba912
--- /dev/null
+++ b/tests/test_shutdown_stress.cpp
@@ -0,0 +1,87 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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 "../include/zmq.h"
+#include <assert.h>
+#include <pthread.h>
+#include <stddef.h>
+
+#define THREAD_COUNT 100
+
+extern "C"
+{
+ static void *worker (void *s)
+ {
+ int rc;
+
+ rc = zmq_connect (s, "tcp://127.0.0.1:5555");
+ assert (rc == 0);
+
+ // Start closing the socket while the connecting process is underway.
+ rc = zmq_close (s);
+ assert (rc == 0);
+
+ return NULL;
+ }
+}
+
+int main (int argc, char *argv [])
+{
+ void *ctx;
+ void *s1;
+ void *s2;
+ int i;
+ int j;
+ int rc;
+ pthread_t threads [THREAD_COUNT];
+
+ for (j = 0; j != 10; j++) {
+
+ // Check the shutdown with many parallel I/O threads.
+ ctx = zmq_init (7);
+ assert (ctx);
+
+ s1 = zmq_socket (ctx, ZMQ_REP);
+ assert (s1);
+
+ rc = zmq_bind (s1, "tcp://127.0.0.1:5555");
+ assert (rc == 0);
+
+ for (i = 0; i != THREAD_COUNT; i++) {
+ s2 = zmq_socket (ctx, ZMQ_SUB);
+ assert (s2);
+ rc = pthread_create (&threads [i], NULL, worker, s2);
+ assert (rc == 0);
+ }
+
+ for (i = 0; i != THREAD_COUNT; i++) {
+ rc = pthread_join (threads [i], NULL);
+ assert (rc == 0);
+ }
+
+ rc = zmq_close (s1);
+ assert (rc == 0);
+
+ rc = zmq_term (ctx);
+ assert (rc == 0);
+ }
+
+ return 0;
+}
diff --git a/tests/testutil.hpp b/tests/testutil.hpp
new file mode 100644
index 0000000..7f182c1
--- /dev/null
+++ b/tests/testutil.hpp
@@ -0,0 +1,130 @@
+/*
+ Copyright (c) 2007-2011 iMatix Corporation
+ Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file
+
+ This file is part of 0MQ.
+
+ 0MQ is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ 0MQ 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/>.
+*/
+
+#ifndef __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
+#define __ZMQ_TEST_TESTUTIL_HPP_INCLUDED__
+
+#include <assert.h>
+#include <iostream>
+#include <string>
+#include <utility>
+
+#include "../include/zmq.hpp"
+
+namespace zmqtestutil
+{
+
+ using namespace std ;
+
+ typedef std::pair <zmq::socket_t*, zmq::socket_t*> socket_pair;
+
+ // Create a pair of sockets connected to each other.
+ socket_pair create_bound_pair (zmq::context_t *context_,
+ int t1_, int t2_, const char *transport_)
+ {
+ zmq::socket_t *s1 = new zmq::socket_t (*context_, t1_);
+ zmq::socket_t *s2 = new zmq::socket_t (*context_, t2_);
+ s1->bind (transport_);
+ s2->connect (transport_);
+ return socket_pair (s1, s2);
+ }
+
+ // Send a message from one socket in the pair to the other and back.
+ std::string ping_pong (const socket_pair &sp_, const std::string &orig_msg_)
+ {
+ zmq::socket_t &s1 = *sp_.first;
+ zmq::socket_t &s2 = *sp_.second;
+
+ // Construct message to send.
+ zmq::message_t ping (orig_msg_.size ());
+ memcpy (ping.data (), orig_msg_.c_str (), orig_msg_.size ());
+
+ // Send ping out.
+ s1.send (ping, 0);
+
+ // Get pong from connected socket.
+ zmq::message_t pong;
+ s2.recv (&pong, 0);
+
+ // Send message via s2, so state is clean in case of req/rep.
+ std::string ret ((char*) pong.data(), pong.size ());
+ s2.send (pong, 0);
+
+ // Return received data as std::string.
+ return ret ;
+ }
+
+ /* Run basic tests for the given transport.
+
+ Basic tests are:
+ * ping pong as defined above.
+ * send receive where the receive is signalled by zmq::poll
+ */
+ void basic_tests (const char *transport_, int t1_, int t2_)
+ {
+ zmq::context_t context (1);
+
+ zmq::pollitem_t items [2];
+ socket_pair p = create_bound_pair (&context, t1_, t2_, transport_);
+
+ // First test simple ping pong.
+ const string expect ("XXX");
+
+ {
+ const string returned = zmqtestutil::ping_pong (p, expect);
+ assert (expect == returned);
+
+ // Adjust socket state so that poll shows only 1 pending message.
+ zmq::message_t mx ;
+ p.first->recv (&mx, 0);
+ }
+
+ {
+ // Now poll is used to singal that a message is ready to read.
+ zmq::message_t m1 (expect.size ());
+ memcpy (m1.data (), expect.c_str (), expect.size ());
+ items [0].socket = *p.first;
+ items [0].fd = 0;
+ items [0].events = ZMQ_POLLIN;
+ items [0].revents = 0;
+ items [1].socket = *p.second;
+ items [1].fd = 0;
+ items [1].events = ZMQ_POLLIN;
+ items [1].revents = 0;
+
+ p.first->send (m1, 0);
+
+ int rc = zmq::poll (&items [0], 2, -1);
+ assert (rc == 1);
+ assert ((items [1].revents & ZMQ_POLLIN) != 0);
+
+ zmq::message_t m2;
+ p.second->recv (&m2, 0);
+ const string ret ((char*) m2.data (), m2.size ());
+ assert (expect == ret);
+ }
+
+ // Delete sockets.
+ delete (p.first);
+ delete (p.second);
+ }
+}
+
+#endif