From 6c4f0aa3eaa0de86457dbc734ea552cd03a67a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Wed, 1 Oct 2014 08:07:52 +0200 Subject: Initial import of psocksxx version 0.0.5-1 --- test/Makefile.am | 37 ++ test/Makefile.in | 861 +++++++++++++++++++++++++++++++++++++ test/lecho.cpp | 197 +++++++++ test/lecho.h | 44 ++ test/lsockstream_test.cpp | 126 ++++++ test/lsockstream_test.h | 58 +++ test/necho.cpp | 247 +++++++++++ test/necho.h | 52 +++ test/nsockaddr_test.cpp | 76 ++++ test/nsockaddr_test.h | 50 +++ test/nsockstream_test.cpp | 105 +++++ test/nsockstream_test.h | 48 +++ test/sockstreambuf_test.cpp | 638 +++++++++++++++++++++++++++ test/sockstreambuf_test.h | 100 +++++ test/socktimeoutexception_test.cpp | 64 +++ test/socktimeoutexception_test.h | 44 ++ test/tap-runner.cpp | 60 +++ test/tap/tap_listener.cpp | 106 +++++ test/tap/tap_listener.h | 51 +++ test/tcpnsockstream_test.cpp | 232 ++++++++++ test/tcpnsockstream_test.h | 76 ++++ test/udpnsockstream_test.cpp | 38 ++ test/udpnsockstream_test.h | 40 ++ 23 files changed, 3350 insertions(+) create mode 100644 test/Makefile.am create mode 100644 test/Makefile.in create mode 100644 test/lecho.cpp create mode 100644 test/lecho.h create mode 100644 test/lsockstream_test.cpp create mode 100644 test/lsockstream_test.h create mode 100644 test/necho.cpp create mode 100644 test/necho.h create mode 100644 test/nsockaddr_test.cpp create mode 100644 test/nsockaddr_test.h create mode 100644 test/nsockstream_test.cpp create mode 100644 test/nsockstream_test.h create mode 100644 test/sockstreambuf_test.cpp create mode 100644 test/sockstreambuf_test.h create mode 100644 test/socktimeoutexception_test.cpp create mode 100644 test/socktimeoutexception_test.h create mode 100644 test/tap-runner.cpp create mode 100644 test/tap/tap_listener.cpp create mode 100644 test/tap/tap_listener.h create mode 100644 test/tcpnsockstream_test.cpp create mode 100644 test/tcpnsockstream_test.h create mode 100644 test/udpnsockstream_test.cpp create mode 100644 test/udpnsockstream_test.h (limited to 'test') diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..b96458b --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,37 @@ +## [psocksxx] test/ + +AUTOMAKE_OPTIONS = subdir-objects +TESTS = +TEST_EXTENSIONS = .tap +TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/aux-build/tap-driver.sh + + +if HAVE_CPPUNIT +check_PROGRAMS = tap-runner.tap +TESTS += $(check_PROGRAMS) + +CPPUNIT_TEST_SOURCES = \ + lecho.h lecho.cpp \ + necho.h necho.cpp \ + socktimeoutexception_test.h socktimeoutexception_test.cpp \ + sockstreambuf_test.h sockstreambuf_test.cpp \ + lsockstream_test.h lsockstream_test.cpp \ + nsockaddr_test.h nsockaddr_test.cpp \ + nsockstream_test.h nsockstream_test.cpp \ + tcpnsockstream_test.h tcpnsockstream_test.cpp \ + udpnsockstream_test.h udpnsockstream_test.cpp + +tap_runner_tap_SOURCES = \ + tap-runner.cpp \ + $(CPPUNIT_TEST_SOURCES) \ + tap/tap_listener.h tap/tap_listener.cpp + +tap_runner_tap_CXXFLAGS = -I$(top_srcdir)/lib $(CPPUNIT_CFLAGS) +tap_runner_tap_LDFLAGS = $(top_builddir)/lib/psocksxx/libpsocksxx.la $(CPPUNIT_LIBS) +endif + + +# remove xunit XML output files +CLEANFILES = xunit.xml + diff --git a/test/Makefile.in b/test/Makefile.in new file mode 100644 index 0000000..179c428 --- /dev/null +++ b/test/Makefile.in @@ -0,0 +1,861 @@ +# Makefile.in generated by automake 1.12.4 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 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@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +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@ +@HAVE_CPPUNIT_TRUE@check_PROGRAMS = tap-runner.tap$(EXEEXT) +@HAVE_CPPUNIT_TRUE@am__append_1 = $(check_PROGRAMS) +subdir = test +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(top_srcdir)/aux-build/depcomp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/aux-build/m4/libtool.m4 \ + $(top_srcdir)/aux-build/m4/ltoptions.m4 \ + $(top_srcdir)/aux-build/m4/ltsugar.m4 \ + $(top_srcdir)/aux-build/m4/ltversion.m4 \ + $(top_srcdir)/aux-build/m4/lt~obsolete.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__tap_runner_tap_SOURCES_DIST = tap-runner.cpp lecho.h lecho.cpp \ + necho.h necho.cpp socktimeoutexception_test.h \ + socktimeoutexception_test.cpp sockstreambuf_test.h \ + sockstreambuf_test.cpp lsockstream_test.h lsockstream_test.cpp \ + nsockaddr_test.h nsockaddr_test.cpp nsockstream_test.h \ + nsockstream_test.cpp tcpnsockstream_test.h \ + tcpnsockstream_test.cpp udpnsockstream_test.h \ + udpnsockstream_test.cpp tap/tap_listener.h \ + tap/tap_listener.cpp +@HAVE_CPPUNIT_TRUE@am__objects_1 = tap_runner_tap-lecho.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-necho.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-socktimeoutexception_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-sockstreambuf_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-lsockstream_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-nsockaddr_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-nsockstream_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-tcpnsockstream_test.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-udpnsockstream_test.$(OBJEXT) +am__dirstamp = $(am__leading_dot)dirstamp +@HAVE_CPPUNIT_TRUE@am_tap_runner_tap_OBJECTS = \ +@HAVE_CPPUNIT_TRUE@ tap_runner_tap-tap-runner.$(OBJEXT) \ +@HAVE_CPPUNIT_TRUE@ $(am__objects_1) \ +@HAVE_CPPUNIT_TRUE@ tap/tap_runner_tap-tap_listener.$(OBJEXT) +tap_runner_tap_OBJECTS = $(am_tap_runner_tap_OBJECTS) +tap_runner_tap_LDADD = $(LDADD) +tap_runner_tap_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) \ + $(tap_runner_tap_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include +depcomp = $(SHELL) $(top_srcdir)/aux-build/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(tap_runner_tap_SOURCES) +DIST_SOURCES = $(am__tap_runner_tap_SOURCES_DIST) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ +CPPUNIT_CONFIG = @CPPUNIT_CONFIG@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOXYGEN = @DOXYGEN@ +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@ +LIBPSOCKSXX_LT_VERSION = @LIBPSOCKSXX_LT_VERSION@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +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@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +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@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = subdir-objects +TESTS = $(am__append_1) +TEST_EXTENSIONS = .tap +TAP_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/aux-build/tap-driver.sh + +@HAVE_CPPUNIT_TRUE@CPPUNIT_TEST_SOURCES = \ +@HAVE_CPPUNIT_TRUE@ lecho.h lecho.cpp \ +@HAVE_CPPUNIT_TRUE@ necho.h necho.cpp \ +@HAVE_CPPUNIT_TRUE@ socktimeoutexception_test.h socktimeoutexception_test.cpp \ +@HAVE_CPPUNIT_TRUE@ sockstreambuf_test.h sockstreambuf_test.cpp \ +@HAVE_CPPUNIT_TRUE@ lsockstream_test.h lsockstream_test.cpp \ +@HAVE_CPPUNIT_TRUE@ nsockaddr_test.h nsockaddr_test.cpp \ +@HAVE_CPPUNIT_TRUE@ nsockstream_test.h nsockstream_test.cpp \ +@HAVE_CPPUNIT_TRUE@ tcpnsockstream_test.h tcpnsockstream_test.cpp \ +@HAVE_CPPUNIT_TRUE@ udpnsockstream_test.h udpnsockstream_test.cpp + +@HAVE_CPPUNIT_TRUE@tap_runner_tap_SOURCES = \ +@HAVE_CPPUNIT_TRUE@ tap-runner.cpp \ +@HAVE_CPPUNIT_TRUE@ $(CPPUNIT_TEST_SOURCES) \ +@HAVE_CPPUNIT_TRUE@ tap/tap_listener.h tap/tap_listener.cpp + +@HAVE_CPPUNIT_TRUE@tap_runner_tap_CXXFLAGS = -I$(top_srcdir)/lib $(CPPUNIT_CFLAGS) +@HAVE_CPPUNIT_TRUE@tap_runner_tap_LDFLAGS = $(top_builddir)/lib/psocksxx/libpsocksxx.la $(CPPUNIT_LIBS) + +# remove xunit XML output files +CLEANFILES = xunit.xml +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 test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign test/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-checkPROGRAMS: + @list='$(check_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 +tap/$(am__dirstamp): + @$(MKDIR_P) tap + @: > tap/$(am__dirstamp) +tap/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) tap/$(DEPDIR) + @: > tap/$(DEPDIR)/$(am__dirstamp) +tap/tap_runner_tap-tap_listener.$(OBJEXT): tap/$(am__dirstamp) \ + tap/$(DEPDIR)/$(am__dirstamp) +tap-runner.tap$(EXEEXT): $(tap_runner_tap_OBJECTS) $(tap_runner_tap_DEPENDENCIES) $(EXTRA_tap_runner_tap_DEPENDENCIES) + @rm -f tap-runner.tap$(EXEEXT) + $(tap_runner_tap_LINK) $(tap_runner_tap_OBJECTS) $(tap_runner_tap_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f tap/*.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-lecho.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-lsockstream_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-necho.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-nsockaddr_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-nsockstream_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-sockstreambuf_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-tap-runner.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tap_runner_tap-udpnsockstream_test.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@tap/$(DEPDIR)/tap_runner_tap-tap_listener.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@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@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@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 $@ $< + +tap_runner_tap-tap-runner.o: tap-runner.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-tap-runner.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-tap-runner.Tpo -c -o tap_runner_tap-tap-runner.o `test -f 'tap-runner.cpp' || echo '$(srcdir)/'`tap-runner.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-tap-runner.Tpo $(DEPDIR)/tap_runner_tap-tap-runner.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tap-runner.cpp' object='tap_runner_tap-tap-runner.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-tap-runner.o `test -f 'tap-runner.cpp' || echo '$(srcdir)/'`tap-runner.cpp + +tap_runner_tap-tap-runner.obj: tap-runner.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-tap-runner.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-tap-runner.Tpo -c -o tap_runner_tap-tap-runner.obj `if test -f 'tap-runner.cpp'; then $(CYGPATH_W) 'tap-runner.cpp'; else $(CYGPATH_W) '$(srcdir)/tap-runner.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-tap-runner.Tpo $(DEPDIR)/tap_runner_tap-tap-runner.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tap-runner.cpp' object='tap_runner_tap-tap-runner.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-tap-runner.obj `if test -f 'tap-runner.cpp'; then $(CYGPATH_W) 'tap-runner.cpp'; else $(CYGPATH_W) '$(srcdir)/tap-runner.cpp'; fi` + +tap_runner_tap-lecho.o: lecho.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-lecho.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-lecho.Tpo -c -o tap_runner_tap-lecho.o `test -f 'lecho.cpp' || echo '$(srcdir)/'`lecho.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-lecho.Tpo $(DEPDIR)/tap_runner_tap-lecho.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lecho.cpp' object='tap_runner_tap-lecho.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-lecho.o `test -f 'lecho.cpp' || echo '$(srcdir)/'`lecho.cpp + +tap_runner_tap-lecho.obj: lecho.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-lecho.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-lecho.Tpo -c -o tap_runner_tap-lecho.obj `if test -f 'lecho.cpp'; then $(CYGPATH_W) 'lecho.cpp'; else $(CYGPATH_W) '$(srcdir)/lecho.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-lecho.Tpo $(DEPDIR)/tap_runner_tap-lecho.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lecho.cpp' object='tap_runner_tap-lecho.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-lecho.obj `if test -f 'lecho.cpp'; then $(CYGPATH_W) 'lecho.cpp'; else $(CYGPATH_W) '$(srcdir)/lecho.cpp'; fi` + +tap_runner_tap-necho.o: necho.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-necho.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-necho.Tpo -c -o tap_runner_tap-necho.o `test -f 'necho.cpp' || echo '$(srcdir)/'`necho.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-necho.Tpo $(DEPDIR)/tap_runner_tap-necho.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='necho.cpp' object='tap_runner_tap-necho.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-necho.o `test -f 'necho.cpp' || echo '$(srcdir)/'`necho.cpp + +tap_runner_tap-necho.obj: necho.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-necho.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-necho.Tpo -c -o tap_runner_tap-necho.obj `if test -f 'necho.cpp'; then $(CYGPATH_W) 'necho.cpp'; else $(CYGPATH_W) '$(srcdir)/necho.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-necho.Tpo $(DEPDIR)/tap_runner_tap-necho.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='necho.cpp' object='tap_runner_tap-necho.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-necho.obj `if test -f 'necho.cpp'; then $(CYGPATH_W) 'necho.cpp'; else $(CYGPATH_W) '$(srcdir)/necho.cpp'; fi` + +tap_runner_tap-socktimeoutexception_test.o: socktimeoutexception_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-socktimeoutexception_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Tpo -c -o tap_runner_tap-socktimeoutexception_test.o `test -f 'socktimeoutexception_test.cpp' || echo '$(srcdir)/'`socktimeoutexception_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Tpo $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='socktimeoutexception_test.cpp' object='tap_runner_tap-socktimeoutexception_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-socktimeoutexception_test.o `test -f 'socktimeoutexception_test.cpp' || echo '$(srcdir)/'`socktimeoutexception_test.cpp + +tap_runner_tap-socktimeoutexception_test.obj: socktimeoutexception_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-socktimeoutexception_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Tpo -c -o tap_runner_tap-socktimeoutexception_test.obj `if test -f 'socktimeoutexception_test.cpp'; then $(CYGPATH_W) 'socktimeoutexception_test.cpp'; else $(CYGPATH_W) '$(srcdir)/socktimeoutexception_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Tpo $(DEPDIR)/tap_runner_tap-socktimeoutexception_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='socktimeoutexception_test.cpp' object='tap_runner_tap-socktimeoutexception_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-socktimeoutexception_test.obj `if test -f 'socktimeoutexception_test.cpp'; then $(CYGPATH_W) 'socktimeoutexception_test.cpp'; else $(CYGPATH_W) '$(srcdir)/socktimeoutexception_test.cpp'; fi` + +tap_runner_tap-sockstreambuf_test.o: sockstreambuf_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-sockstreambuf_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Tpo -c -o tap_runner_tap-sockstreambuf_test.o `test -f 'sockstreambuf_test.cpp' || echo '$(srcdir)/'`sockstreambuf_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Tpo $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sockstreambuf_test.cpp' object='tap_runner_tap-sockstreambuf_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-sockstreambuf_test.o `test -f 'sockstreambuf_test.cpp' || echo '$(srcdir)/'`sockstreambuf_test.cpp + +tap_runner_tap-sockstreambuf_test.obj: sockstreambuf_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-sockstreambuf_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Tpo -c -o tap_runner_tap-sockstreambuf_test.obj `if test -f 'sockstreambuf_test.cpp'; then $(CYGPATH_W) 'sockstreambuf_test.cpp'; else $(CYGPATH_W) '$(srcdir)/sockstreambuf_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Tpo $(DEPDIR)/tap_runner_tap-sockstreambuf_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='sockstreambuf_test.cpp' object='tap_runner_tap-sockstreambuf_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-sockstreambuf_test.obj `if test -f 'sockstreambuf_test.cpp'; then $(CYGPATH_W) 'sockstreambuf_test.cpp'; else $(CYGPATH_W) '$(srcdir)/sockstreambuf_test.cpp'; fi` + +tap_runner_tap-lsockstream_test.o: lsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-lsockstream_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-lsockstream_test.Tpo -c -o tap_runner_tap-lsockstream_test.o `test -f 'lsockstream_test.cpp' || echo '$(srcdir)/'`lsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-lsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-lsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lsockstream_test.cpp' object='tap_runner_tap-lsockstream_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-lsockstream_test.o `test -f 'lsockstream_test.cpp' || echo '$(srcdir)/'`lsockstream_test.cpp + +tap_runner_tap-lsockstream_test.obj: lsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-lsockstream_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-lsockstream_test.Tpo -c -o tap_runner_tap-lsockstream_test.obj `if test -f 'lsockstream_test.cpp'; then $(CYGPATH_W) 'lsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/lsockstream_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-lsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-lsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='lsockstream_test.cpp' object='tap_runner_tap-lsockstream_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-lsockstream_test.obj `if test -f 'lsockstream_test.cpp'; then $(CYGPATH_W) 'lsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/lsockstream_test.cpp'; fi` + +tap_runner_tap-nsockaddr_test.o: nsockaddr_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-nsockaddr_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-nsockaddr_test.Tpo -c -o tap_runner_tap-nsockaddr_test.o `test -f 'nsockaddr_test.cpp' || echo '$(srcdir)/'`nsockaddr_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-nsockaddr_test.Tpo $(DEPDIR)/tap_runner_tap-nsockaddr_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nsockaddr_test.cpp' object='tap_runner_tap-nsockaddr_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-nsockaddr_test.o `test -f 'nsockaddr_test.cpp' || echo '$(srcdir)/'`nsockaddr_test.cpp + +tap_runner_tap-nsockaddr_test.obj: nsockaddr_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-nsockaddr_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-nsockaddr_test.Tpo -c -o tap_runner_tap-nsockaddr_test.obj `if test -f 'nsockaddr_test.cpp'; then $(CYGPATH_W) 'nsockaddr_test.cpp'; else $(CYGPATH_W) '$(srcdir)/nsockaddr_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-nsockaddr_test.Tpo $(DEPDIR)/tap_runner_tap-nsockaddr_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nsockaddr_test.cpp' object='tap_runner_tap-nsockaddr_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-nsockaddr_test.obj `if test -f 'nsockaddr_test.cpp'; then $(CYGPATH_W) 'nsockaddr_test.cpp'; else $(CYGPATH_W) '$(srcdir)/nsockaddr_test.cpp'; fi` + +tap_runner_tap-nsockstream_test.o: nsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-nsockstream_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-nsockstream_test.Tpo -c -o tap_runner_tap-nsockstream_test.o `test -f 'nsockstream_test.cpp' || echo '$(srcdir)/'`nsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-nsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-nsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nsockstream_test.cpp' object='tap_runner_tap-nsockstream_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-nsockstream_test.o `test -f 'nsockstream_test.cpp' || echo '$(srcdir)/'`nsockstream_test.cpp + +tap_runner_tap-nsockstream_test.obj: nsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-nsockstream_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-nsockstream_test.Tpo -c -o tap_runner_tap-nsockstream_test.obj `if test -f 'nsockstream_test.cpp'; then $(CYGPATH_W) 'nsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/nsockstream_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-nsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-nsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='nsockstream_test.cpp' object='tap_runner_tap-nsockstream_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-nsockstream_test.obj `if test -f 'nsockstream_test.cpp'; then $(CYGPATH_W) 'nsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/nsockstream_test.cpp'; fi` + +tap_runner_tap-tcpnsockstream_test.o: tcpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-tcpnsockstream_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Tpo -c -o tap_runner_tap-tcpnsockstream_test.o `test -f 'tcpnsockstream_test.cpp' || echo '$(srcdir)/'`tcpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tcpnsockstream_test.cpp' object='tap_runner_tap-tcpnsockstream_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-tcpnsockstream_test.o `test -f 'tcpnsockstream_test.cpp' || echo '$(srcdir)/'`tcpnsockstream_test.cpp + +tap_runner_tap-tcpnsockstream_test.obj: tcpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-tcpnsockstream_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Tpo -c -o tap_runner_tap-tcpnsockstream_test.obj `if test -f 'tcpnsockstream_test.cpp'; then $(CYGPATH_W) 'tcpnsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/tcpnsockstream_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-tcpnsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tcpnsockstream_test.cpp' object='tap_runner_tap-tcpnsockstream_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-tcpnsockstream_test.obj `if test -f 'tcpnsockstream_test.cpp'; then $(CYGPATH_W) 'tcpnsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/tcpnsockstream_test.cpp'; fi` + +tap_runner_tap-udpnsockstream_test.o: udpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-udpnsockstream_test.o -MD -MP -MF $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Tpo -c -o tap_runner_tap-udpnsockstream_test.o `test -f 'udpnsockstream_test.cpp' || echo '$(srcdir)/'`udpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='udpnsockstream_test.cpp' object='tap_runner_tap-udpnsockstream_test.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-udpnsockstream_test.o `test -f 'udpnsockstream_test.cpp' || echo '$(srcdir)/'`udpnsockstream_test.cpp + +tap_runner_tap-udpnsockstream_test.obj: udpnsockstream_test.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap_runner_tap-udpnsockstream_test.obj -MD -MP -MF $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Tpo -c -o tap_runner_tap-udpnsockstream_test.obj `if test -f 'udpnsockstream_test.cpp'; then $(CYGPATH_W) 'udpnsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/udpnsockstream_test.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Tpo $(DEPDIR)/tap_runner_tap-udpnsockstream_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='udpnsockstream_test.cpp' object='tap_runner_tap-udpnsockstream_test.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap_runner_tap-udpnsockstream_test.obj `if test -f 'udpnsockstream_test.cpp'; then $(CYGPATH_W) 'udpnsockstream_test.cpp'; else $(CYGPATH_W) '$(srcdir)/udpnsockstream_test.cpp'; fi` + +tap/tap_runner_tap-tap_listener.o: tap/tap_listener.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap/tap_runner_tap-tap_listener.o -MD -MP -MF tap/$(DEPDIR)/tap_runner_tap-tap_listener.Tpo -c -o tap/tap_runner_tap-tap_listener.o `test -f 'tap/tap_listener.cpp' || echo '$(srcdir)/'`tap/tap_listener.cpp +@am__fastdepCXX_TRUE@ $(am__mv) tap/$(DEPDIR)/tap_runner_tap-tap_listener.Tpo tap/$(DEPDIR)/tap_runner_tap-tap_listener.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tap/tap_listener.cpp' object='tap/tap_runner_tap-tap_listener.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap/tap_runner_tap-tap_listener.o `test -f 'tap/tap_listener.cpp' || echo '$(srcdir)/'`tap/tap_listener.cpp + +tap/tap_runner_tap-tap_listener.obj: tap/tap_listener.cpp +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -MT tap/tap_runner_tap-tap_listener.obj -MD -MP -MF tap/$(DEPDIR)/tap_runner_tap-tap_listener.Tpo -c -o tap/tap_runner_tap-tap_listener.obj `if test -f 'tap/tap_listener.cpp'; then $(CYGPATH_W) 'tap/tap_listener.cpp'; else $(CYGPATH_W) '$(srcdir)/tap/tap_listener.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) tap/$(DEPDIR)/tap_runner_tap-tap_listener.Tpo tap/$(DEPDIR)/tap_runner_tap-tap_listener.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='tap/tap_listener.cpp' object='tap/tap_runner_tap-tap_listener.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(tap_runner_tap_CXXFLAGS) $(CXXFLAGS) -c -o tap/tap_runner_tap-tap_listener.obj `if test -f 'tap/tap_listener.cpp'; then $(CYGPATH_W) 'tap/tap_listener.cpp'; else $(CYGPATH_W) '$(srcdir)/tap/tap_listener.cpp'; fi` + +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" + +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +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 $(AM_TESTS_FD_REDIRECT); 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 \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$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_PROGRAMS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +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: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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) + -rm -f tap/$(DEPDIR)/$(am__dirstamp) + -rm -f tap/$(am__dirstamp) + +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-checkPROGRAMS clean-generic clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) tap/$(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) tap/$(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-checkPROGRAMS clean-generic clean-libtool cscopelist \ + 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/test/lecho.cpp b/test/lecho.cpp new file mode 100644 index 0000000..6dcaf69 --- /dev/null +++ b/test/lecho.cpp @@ -0,0 +1,197 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "lecho.h" + +#include +#include +#include +#include +#include +#include + + +lecho::lecho( const char * path ) : + _sockfd( -1 ), _lsock_path( path ) { + + // fork + _cpid = fork(); + + if ( _cpid == -1 ) { + std::cerr << "failed to fork out child process" << std::endl; + } else if ( _cpid == 0 ) { + + // child - initialise echo server on a local socket + init_listener(); + + // serve requests + serve_requests(); + + // exit - should never get here + exit( 0 ); + + } else { + // parent - wait for the child to create the socket and return + wait_connect(); + } + +} + + +lecho::~lecho() { + + // cleanup + shutdown(); + +} + + +void lecho::init_listener() { + + // initialise socket + if ( ( _sockfd = socket( PF_LOCAL, SOCK_STREAM, 0 ) ) < 0 ) { + std::cerr << "failed to setup local socket" << std::endl; + exit( -1 ); + } + + // socket address + sockaddr_un saddr; + + bzero( (void *) &saddr, sizeof( saddr ) ); + saddr.sun_family = AF_LOCAL; + strcpy( saddr.sun_path, _lsock_path ); + + + // bind + if ( bind( _sockfd, (::sockaddr *) &saddr, + sizeof( sockaddr_un ) ) != 0 ) { + std::cerr << "failed to bind to local socket" << std::endl; + exit( -1 ); + } + + + // listen + if ( listen( _sockfd, 2 ) != 0 ) { + std::cerr << "failed to listen on local socket" << std::endl; + exit( -1 ); + } + +} + + +void lecho::serve_requests() { + + int peer_sockfd; + sockaddr_un peer_addr; + socklen_t addrlen = sizeof( peer_addr ); + + int n = 0; + char cbuffer[64]; + bool close_peer; + + for (;;) { + + if ( ( peer_sockfd = accept( _sockfd, (sockaddr *) &peer_addr, &addrlen ) ) == -1 ) { + continue; + } + + close_peer = false; + do { + + // read from the socket + n = recv( peer_sockfd, cbuffer, sizeof( cbuffer ), 0 ); + + // sanity check - did we receive anything? + if ( n <= 0 ) { + close_peer = true; + } else { + + // send back what we received + if ( send( peer_sockfd, cbuffer, n, 0 ) < 0 ) { + close_peer = true; + } + + } + + } while (! close_peer ); + + // close peer + close( peer_sockfd ); + + } + +} + + +void lecho::shutdown() { + + if ( _cpid == 0 ) { + // child - should never get here + } else { + + // parent - send kill to child + kill( _cpid, SIGTERM ); + + } + + // unlink + unlink( _lsock_path ); + +} + + +void lecho::wait_connect() { + + int sockfd = -1; + unsigned int max_tries = 10; + sockaddr_un saddr; + + // initialise socket + if ( ( sockfd = socket( PF_LOCAL, SOCK_STREAM, 0 ) ) < 0 ) { + std::cerr << "failed to setup local socket" << std::endl; + exit( -1 ); + } + + // socket address structure + bzero( (void *) &saddr, sizeof( saddr ) ); + saddr.sun_family = AF_LOCAL; + strcpy( saddr.sun_path, _lsock_path ); + + // loop until we can establish a connection or + // we exhaust our attempts + for ( int i = 0; i < max_tries; i++ ) { + + // try to connect + if ( ( connect( sockfd, (sockaddr *) &saddr, sizeof( sockaddr_un ) ) == -1 ) ) { + + // connect failed - sleep for a bit + usleep( 500 ); + + } else { + // connect successful - break out of the loop + break; + } + + } + + // close socket + close( sockfd ); + +} + diff --git a/test/lecho.h b/test/lecho.h new file mode 100644 index 0000000..9cad984 --- /dev/null +++ b/test/lecho.h @@ -0,0 +1,44 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef LECHO_H +#define LECHO_H + +#include + + +class lecho { +public: + lecho( const char * path ); + ~lecho(); + +private: + int _sockfd; + pid_t _cpid; + const char * _lsock_path; + + void init_listener(); + void serve_requests(); + void shutdown(); + void wait_connect(); + +}; + +#endif /* !LECHO_H */ + diff --git a/test/lsockstream_test.cpp b/test/lsockstream_test.cpp new file mode 100644 index 0000000..30c4ead --- /dev/null +++ b/test/lsockstream_test.cpp @@ -0,0 +1,126 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "lsockstream_test.h" +#include "lecho.h" + +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( lsockstream_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void lsockstream_test::test_constructors() { + + // default constructor + CPPUNIT_ASSERT_NO_THROW( lsockstream l ); + +} + + +void lsockstream_test::test_connect_fail() { + + // local socket stream + lsockstream l; + + // this should throw a file not found error + CPPUNIT_ASSERT_THROW( l.connect( LOCAL_SOCK_PATH ), sockexception ); + +} + + +void lsockstream_test::test_connect_addr_fail() { + + // local socket stream + lsockstream l; + + // local (unix) socket address + lsockaddr saddr( LOCAL_SOCK_PATH ); + + // this should throw a file not found error + CPPUNIT_ASSERT_THROW( l.connect( &saddr ), sockexception ); + +} + + +void lsockstream_test::test_connect() { + + // local socket stream + lsockstream l; + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + // connect + CPPUNIT_ASSERT_NO_THROW( l.connect( LOCAL_LISTENER_SOCK_PATH ) ); + +} + + +void lsockstream_test::test_connect_addr() { + + // local socket stream + lsockstream l; + + // local (unix) socket address + lsockaddr saddr( LOCAL_LISTENER_SOCK_PATH ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + // connect + CPPUNIT_ASSERT_NO_THROW( l.connect( &saddr ) ); + +} + + +void lsockstream_test::test_read_timeout() { + + // local socket stream + lsockstream l; + + // local (unix) socket address + lsockaddr saddr( LOCAL_LISTENER_SOCK_PATH ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + // connect + try { + l.connect( &saddr ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // set timeout + l.timeout( 0, 200 ); + + // read + char c = l.get(); + + // read - should timed out + CPPUNIT_ASSERT( true == l.timedout() ); + +} + diff --git a/test/lsockstream_test.h b/test/lsockstream_test.h new file mode 100644 index 0000000..09de29d --- /dev/null +++ b/test/lsockstream_test.h @@ -0,0 +1,58 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef LSOCKSTREAM_TEST_H +#define LSOCKSTREAM_TEST_H + +#include + +#ifndef LOCAL_LISTENER_SOCK_PATH +#define LOCAL_LISTENER_SOCK_PATH "/tmp/psocksxx.listener.sock" +#endif + +#ifndef LOCAL_SOCK_PATH +#define LOCAL_SOCK_PATH "/tmp/psocksxx.sock" +#endif + + +class lsockstream_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( lsockstream_test ); + CPPUNIT_TEST( test_constructors ); + CPPUNIT_TEST( test_connect_fail ); + CPPUNIT_TEST( test_connect_addr_fail ); + CPPUNIT_TEST( test_connect ); + CPPUNIT_TEST( test_connect_addr ); + CPPUNIT_TEST( test_read_timeout ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructors(); + void test_connect_fail(); + void test_connect_addr_fail(); + void test_connect(); + void test_connect_addr(); + void test_read_timeout(); + +}; + +#endif /* !LSOCKSTREAM_TEST_H */ + diff --git a/test/necho.cpp b/test/necho.cpp new file mode 100644 index 0000000..df961a0 --- /dev/null +++ b/test/necho.cpp @@ -0,0 +1,247 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "necho.h" + +#include +#include +#include +#include +#include +#include +#include + + +static int sockfd = -1; + +void sigterm_handler( int sig, siginfo_t *siginfo, void *context ) { + + // close any open sockets + if ( sockfd > -1 ) { + close( sockfd ); + } + + exit( EXIT_SUCCESS ); + +} + + +necho::necho( const char * node, const char * service, int socket_type ) : + _sockfd( -1 ), _nsock_node( node ), _nsock_service( service ), + _socket_type( socket_type ) { + + // fork + _cpid = fork(); + + if ( _cpid == -1 ) { + std::cerr << "failed to fork out child process" << std::endl; + } else if ( _cpid == 0 ) { + + // child - initialise signal handlers + init_signal_handlers(); + + // echo socket + init_listener(); + + // serve requests + serve_requests(); + + // exit - should never get here + exit( 0 ); + + } else { + // parent - wait for the child to create the socket and return + wait_connect(); + } + +} + + +necho::~necho() { + + // cleanup + shutdown(); + +} + + +void necho::init_signal_handlers() { + + struct sigaction sa; + + sigfillset( &sa.sa_mask ); + sa.sa_sigaction = &sigterm_handler; + sa.sa_flags = SA_SIGINFO; + + if ( sigaction( SIGTERM, &sa, 0 ) < 0 ) { + std::cerr << "sigaction() failed: " << strerror( errno ) << std::endl; + exit( EXIT_FAILURE ); + } + +} + + +void necho::init_listener() { + + addrinfo hints, * saddr_info; + int status = 0; + + // setup hints + memset( &hints, 0, sizeof ( hints ) ); + hints.ai_family = AF_INET; + hints.ai_socktype = _socket_type; + + if ( ( status = getaddrinfo( _nsock_node, _nsock_service, &hints, &saddr_info ) ) != 0 ) { + std::cerr << "getaddrinfo() failed: " << gai_strerror( status ) << std::endl; + exit( EXIT_FAILURE ); + } + + // initialise socket + if ( ( _sockfd = socket( saddr_info->ai_family, saddr_info->ai_socktype, saddr_info->ai_protocol ) ) < 0 ) { + std::cerr << "failed to setup network socket" << std::endl; + exit( EXIT_FAILURE ); + } + + // update static variable used by signal handlers + sockfd = _sockfd; + + // set SO_REUSEADDR to true so we can reuse the socket + int optval = 1; + if ( setsockopt( _sockfd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof( optval ) ) != 0 ) { + std::cerr << "setsockopt() failed: " << strerror( errno ) << std::endl; + exit( EXIT_FAILURE ); + } + + // bind + if ( bind( _sockfd, saddr_info->ai_addr, saddr_info->ai_addrlen ) != 0 ) { + std::cerr << "bind() failed: " << strerror( errno ) << std::endl; + exit( EXIT_FAILURE ); + } + + + // listen + if ( listen( _sockfd, 5 ) != 0 ) { + std::cerr << "listen() failed: " << strerror( errno ) << std::endl; + exit( EXIT_FAILURE ); + } + + // cleanup + freeaddrinfo( saddr_info ); + +} + + +void necho::serve_requests() { + + int peer_sockfd; + + int n = 0; + char cbuffer[64]; + bool close_peer; + + for (;;) { + + if ( ( peer_sockfd = accept( _sockfd, 0, 0 ) ) == -1 ) { + continue; + } + + close_peer = false; + do { + + // read from the socket + n = recv( peer_sockfd, cbuffer, sizeof( cbuffer ), 0 ); + + // sanity check - did we receive anything? + if ( n <= 0 ) { + close_peer = true; + } else { + + // send back what we received + if ( send( peer_sockfd, cbuffer, n, 0 ) < 0 ) { + close_peer = true; + } + + } + + } while (! close_peer ); + + // close peer + close( peer_sockfd ); + + } + +} + + +void necho::wait_connect() { + + int sockfd = -1; + int status = 0; + unsigned int max_tries = 10; + addrinfo hints, * saddr_info; + + // setup hints + memset( &hints, 0, sizeof ( hints ) ); + hints.ai_family = AF_INET; + hints.ai_socktype = _socket_type; + + if ( ( status = getaddrinfo( _nsock_node, _nsock_service, &hints, &saddr_info ) ) != 0 ) { + std::cerr << "getaddrinfo() failed: " << gai_strerror( status ) << std::endl; + exit( EXIT_FAILURE ); + } + + // loop until we can establish a connection or + // we exhaust our attempts + for ( int i = 0; i < max_tries; i++ ) { + + // try to connect + if ( ( connect( sockfd, saddr_info->ai_addr, saddr_info->ai_addrlen ) == -1 ) ) { + + // connect failed - sleep for a bit + usleep( 500 ); + + } else { + // connect successful - break out of the loop + break; + } + + } + + // close socket + close( sockfd ); + +} + + +void necho::shutdown() { + + if ( _cpid == 0 ) { + // child - should never get here + } else { + + // parent - send kill to child + kill( _cpid, SIGTERM ); + + // wait for the child + waitpid( _cpid, 0, 0 ); + + } + +} + diff --git a/test/necho.h b/test/necho.h new file mode 100644 index 0000000..e4acded --- /dev/null +++ b/test/necho.h @@ -0,0 +1,52 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef NECHO_H +#define NECHO_H + +#include +#include + + +class necho { +public: + + necho( const char * node, const char * service, int socket_type = SOCK_STREAM ); + virtual ~necho(); + +protected: + + int _sockfd; + pid_t _cpid; + + const char * _nsock_node; + const char * _nsock_service; + + int _socket_type; + + void init_signal_handlers(); + void init_listener(); + void serve_requests(); + void shutdown(); + void wait_connect(); + +}; + +#endif /* !NECHO_H */ + diff --git a/test/nsockaddr_test.cpp b/test/nsockaddr_test.cpp new file mode 100644 index 0000000..1eceb87 --- /dev/null +++ b/test/nsockaddr_test.cpp @@ -0,0 +1,76 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "nsockaddr_test.h" + +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( nsockaddr_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void nsockaddr_test::test_constructor_localhost() { + + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "localhost", 1234 ) ); + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "127.0.0.1", 4321 ) ); + +} + + +void nsockaddr_test::test_constructor_remote() { + + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "www.example.com", 1234 ) ); + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "1.2.3.4", 80 ) ); + +} + + +void nsockaddr_test::test_constructor_fail() { + + CPPUNIT_ASSERT_THROW( nsockaddr a( "invalid.domain", 1234 ), sockexception ); + CPPUNIT_ASSERT_THROW( nsockaddr a( "1.2.3.", 1234 ), sockexception ); + +} + + +void nsockaddr_test::test_constructor_local_any() { + + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( 1234 ) ); + +} + + +void nsockaddr_test::test_constructor_local_service() { + + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "localhost", "1234" ) ); + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( 0, "ftp" ) ); + +} + + +void nsockaddr_test::test_constructor_remote_service() { + + CPPUNIT_ASSERT_NO_THROW( nsockaddr a( "www.example.com", "http" ) ); + +} + diff --git a/test/nsockaddr_test.h b/test/nsockaddr_test.h new file mode 100644 index 0000000..b4527e9 --- /dev/null +++ b/test/nsockaddr_test.h @@ -0,0 +1,50 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef NSOCKADDR_TEST_H +#define NSOCKADDR_TEST_H + +#include + + +class nsockaddr_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( nsockaddr_test ); + CPPUNIT_TEST( test_constructor_localhost ); + CPPUNIT_TEST( test_constructor_remote ); + CPPUNIT_TEST( test_constructor_fail ); + CPPUNIT_TEST( test_constructor_local_any ); + CPPUNIT_TEST( test_constructor_local_service ); + CPPUNIT_TEST( test_constructor_remote_service ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructor_localhost(); + void test_constructor_remote(); + void test_constructor_fail(); + void test_constructor_local_any(); + void test_constructor_local_service(); + void test_constructor_remote_service(); + +}; + +#endif /* !NSOCKADDR_TEST_H */ + diff --git a/test/nsockstream_test.cpp b/test/nsockstream_test.cpp new file mode 100644 index 0000000..ce8d77b --- /dev/null +++ b/test/nsockstream_test.cpp @@ -0,0 +1,105 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "nsockstream_test.h" + +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( nsockstream_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void nsockstream_test::test_constructor_tcp() { + + // TCP/IP + CPPUNIT_ASSERT_NO_THROW( nsockstream n( sockstreambuf::sock_stream, sockstreambuf::ipproto_tcp ) ); + +} + + +void nsockstream_test::test_constructor_udp() { + + // UDP + CPPUNIT_ASSERT_NO_THROW( nsockstream n( sockstreambuf::sock_dgram, sockstreambuf::ipproto_udp ) ); + +} + + +void nsockstream_test::test_constructor_streambuf() { + + // socket stream buffer + sockstreambuf * ssb = new sockstreambuf(); + + // network socket stream + nsockstream ss( ssb ); + + // assert + CPPUNIT_ASSERT( ssb == ss.rdbuf() ); + +} + + +void nsockstream_test::test_set_timeout() { + + // socket stream buffer + sockstreambuf * ssb = new sockstreambuf(); + + // network socket stream + nsockstream ss( ssb ); + + time_t sec = 1; + suseconds_t usec = 500; + + // set timeout + const timeval * t = ss.timeout( sec, usec ); + + // validate + CPPUNIT_ASSERT( sec == t->tv_sec ); + CPPUNIT_ASSERT( usec == t->tv_usec ); + +} + + +void nsockstream_test::test_clear_timeout() { + + // socket stream buffer + sockstreambuf * ssb = new sockstreambuf(); + + // network socket stream + nsockstream ss( ssb ); + + // clear the timeout before a timeout is set + CPPUNIT_ASSERT( 0 == ss.clear_timeout() ); + + + time_t sec = 1; + suseconds_t usec = 500; + + // set timeout + const timeval * t = ss.timeout( sec, usec ); + + // clear the timeout after a timeout is set + CPPUNIT_ASSERT( 0 == ss.clear_timeout() ); + +} + diff --git a/test/nsockstream_test.h b/test/nsockstream_test.h new file mode 100644 index 0000000..9cbf1ca --- /dev/null +++ b/test/nsockstream_test.h @@ -0,0 +1,48 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef NSOCKSTREAM_TEST_H +#define NSOCKSTREAM_TEST_H + +#include + + +class nsockstream_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( nsockstream_test ); + CPPUNIT_TEST( test_constructor_tcp ); + CPPUNIT_TEST( test_constructor_udp ); + CPPUNIT_TEST( test_constructor_streambuf ); + CPPUNIT_TEST( test_set_timeout ); + CPPUNIT_TEST( test_clear_timeout ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructor_tcp(); + void test_constructor_udp(); + void test_constructor_streambuf(); + void test_set_timeout(); + void test_clear_timeout(); + +}; + +#endif /* !NSOCKSTREAM_TEST_H */ + diff --git a/test/sockstreambuf_test.cpp b/test/sockstreambuf_test.cpp new file mode 100644 index 0000000..7f992f1 --- /dev/null +++ b/test/sockstreambuf_test.cpp @@ -0,0 +1,638 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "sockstreambuf_test.h" +#include "lecho.h" + +#include +#include +#include +#include +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( sockstreambuf_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +sockstreambuf_test::sockstreambuf_test() { } +sockstreambuf_test::~sockstreambuf_test() { } + + +void sockstreambuf_test::connect_local() throw() { + + int csock; + sockaddr_un saddr; + + const char * path = LOCAL_SOCK_PATH; + bzero( (void *) &saddr, sizeof( saddr ) ); + saddr.sun_family = AF_LOCAL; + strcpy( saddr.sun_path, path ); + + // not worth having error handling here so we hope for the best + csock = socket( AF_LOCAL, SOCK_STREAM, 0 ); + connect( csock, (::sockaddr *) &saddr, sizeof( sockaddr_un ) ); + +} + + +void sockstreambuf_test::setUp() { + + // initialise locals + _sockaddr.sa_family = AF_LOCAL; + +} + + +void sockstreambuf_test::tearDown() { + +} + + +void sockstreambuf_test::test_constructors() { + + const sockstreambuf ssb; + const sockstreambuf ssb_s( -1 ); + + // check the default constructor + CPPUNIT_ASSERT( ssb.socket() == ssb_s.socket() ); + +} + + +void sockstreambuf_test::test_open_close_local_ip() { + + sockstreambuf ssb; + + CPPUNIT_ASSERT_NO_THROW_MESSAGE( "Failed to open socket communication end-point", + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::ipproto_ip ) ); + + // close the opened socket end-point + ssb.close(); + +} + + +void sockstreambuf_test::test_flush_empty() { + + sockstreambuf ssb( -1 ); + CPPUNIT_ASSERT( sockstreambuf::eof == ssb.flush() ); + +} + + +void sockstreambuf_test::test_bad_flush() { + + // socket stream buffer + sockstreambuf ssb( -1 ); + + // add a char into the buffer + ssb.sputc( 'c' ); + + // flush buffer + CPPUNIT_ASSERT( sockstreambuf::eof == ssb.flush() ); + +} + + +void sockstreambuf_test::test_bad_connect_failure() { + + // socket stream buffer + sockstreambuf ssb( -1 ); + + // this should throw a bad file descriptor error + CPPUNIT_ASSERT_THROW( ssb.connect( &_sockaddr ), sockexception ); + +} + + +void sockstreambuf_test::test_bad_bind_failure() { + + // socket stream buffer + sockstreambuf ssb( -1 ); + + // this should throw a bad file descriptor error + CPPUNIT_ASSERT_THROW( ssb.bind( &_sockaddr ), sockexception ); + +} + + +void sockstreambuf_test::test_bad_listen_failure() { + + // socket stream buffer + sockstreambuf ssb( -1 ); + + // this should throw a bad file descriptor error + CPPUNIT_ASSERT_THROW( ssb.listen(), sockexception ); + +} + + +void sockstreambuf_test::test_bad_accept_failure() { + + // socket stream buffer + sockstreambuf ssb( -1 ); + + // this should throw a bad file descriptor error + CPPUNIT_ASSERT_THROW( ssb.accept(), sockexception ); + +} + + +void sockstreambuf_test::test_local_bind() { + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_SOCK_PATH; + lsockaddr saddr( path ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // bind to address + CPPUNIT_ASSERT_NO_THROW( ssb.bind( &saddr ) ); + + + // close socket + ssb.close(); + + // unlink + if ( unlink( path ) !=0 ) { + CPPUNIT_FAIL( std::string( "failed to unlink socket: " ).append( path ) ); + } + +} + + +void sockstreambuf_test::test_local_listen() { + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_SOCK_PATH; + lsockaddr saddr( path ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // bind to address + try { + ssb.bind( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + } + + // listen + CPPUNIT_ASSERT_NO_THROW( ssb.listen() ); + + + // close socket + ssb.close(); + + // unlink + if ( unlink( path ) !=0 ) { + CPPUNIT_FAIL( std::string( "failed to unlink socket: " ).append( path ) ); + } + +} + + +void sockstreambuf_test::test_local_connect() { + + // socket steam buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + CPPUNIT_ASSERT_NO_THROW( ssb.connect( &saddr ) ); + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_local_connect_timeout() { + + // socket steam buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + CPPUNIT_ASSERT_NO_THROW( ssb.connect( &saddr, 1 ) ); + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_local_accept() { + + // fork variables + pid_t cpid, wpid; + int wpid_status; + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_SOCK_PATH; + lsockaddr saddr( path ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // bind to address + try { + ssb.bind( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + } + + // listen + try { + ssb.listen(); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + } + + + // fork + cpid = fork(); + + if ( cpid == -1 ) { + CPPUNIT_FAIL( "failed to fork" ); + } else if ( cpid == 0 ) { + + // child - connect to the local socket created by the parent + connect_local(); + + // exit + exit( 0 ); + + } else { + + // parent - accept a connection from the child + CPPUNIT_ASSERT( ssb.accept() != -1 ); + + // wait for child to exit + if ( ( wpid = waitpid( cpid, &wpid_status, 0 ) ) == -1 ) { + CPPUNIT_FAIL( "failed waiting for the child process to terminate" ); + } + + } + + // close socket + ssb.close(); + + // unlink + if ( unlink( path ) !=0 ) { + CPPUNIT_FAIL( std::string( "failed to unlink socket: " ).append( path ) ); + } + +} + + +void sockstreambuf_test::test_local_flush() { + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + try { + ssb.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // put a char into the buffer and flush + ssb.sputc( 'c' ); + CPPUNIT_ASSERT( 1 == ssb.flush() ); + + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_local_flush_read() { + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + try { + ssb.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // put a char into the buffer + ssb.sputc( 'c' ); + + // flush + if ( ssb.flush() == 1 ) { + + // read back + CPPUNIT_ASSERT( 'c' == ssb.sgetc() ); + + } else { + CPPUNIT_FAIL( "failed to flush buffer" ); + } + + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_local_ostream() { + + // socket stream buffer + sockstreambuf ssb; + + // ostream + std::ostream output( &ssb ); + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + try { + ssb.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // use the output stream to send a char + output << 'c' << std::endl; + + // read back using the socket stream buffer + CPPUNIT_ASSERT( 'c' == ssb.sgetc() ); + + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_local_istream() { + + // socket stream buffer + sockstreambuf ssb; + + // istream + std::istream input( &ssb ); + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + try { + ssb.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + + // put a char into the buffer + ssb.sputc( 'c' ); + + // flush + if ( ssb.flush() == 1 ) { + + // read back using istream + char c; + input >> c; + + // assert + CPPUNIT_ASSERT( 'c' == c ); + + } else { + CPPUNIT_FAIL( "failed to flush buffer" ); + } + + + // close socket + ssb.close(); + +} + + +void sockstreambuf_test::test_set_timeout() { + + // socket stream buffer + sockstreambuf ssb; + + time_t sec = 1; + suseconds_t usec = 500; + + // set timeout + const timeval * t = ssb.timeout( sec, usec ); + + // validate + CPPUNIT_ASSERT( sec == t->tv_sec ); + CPPUNIT_ASSERT( usec == t->tv_usec ); + +} + + +void sockstreambuf_test::test_clear_timeout() { + + // socket stream buffer + sockstreambuf ssb; + + // clear the timeout before a timeout is set + CPPUNIT_ASSERT( 0 == ssb.clear_timeout() ); + + + time_t sec = 1; + suseconds_t usec = 500; + + // set timeout + const timeval * t = ssb.timeout( sec, usec ); + + // clear the timeout after a timeout is set + CPPUNIT_ASSERT( 0 == ssb.clear_timeout() ); + +} + + +void sockstreambuf_test::test_local_read_timeout() { + + // socket stream buffer + sockstreambuf ssb; + + // local (unix) socket address + const char * path = LOCAL_LISTENER_SOCK_PATH; + lsockaddr saddr( path ); + + // local echo server + lecho echo( LOCAL_LISTENER_SOCK_PATH ); + + + // prepare the socket + try { + ssb.open( sockstreambuf::pf_local, sockstreambuf::sock_stream, sockstreambuf::proto_unspec ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // connect + try { + ssb.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // set timeout + ssb.timeout( 0, 200 ); + + // read - this should timeout and throw a timeout exception + CPPUNIT_ASSERT_THROW( ssb.sgetc(), socktimeoutexception ); + + // should've set the timed-out flag as well + CPPUNIT_ASSERT( true == ssb.timedout() ); + + + // close socket + ssb.close(); + +} + diff --git a/test/sockstreambuf_test.h b/test/sockstreambuf_test.h new file mode 100644 index 0000000..b6efd05 --- /dev/null +++ b/test/sockstreambuf_test.h @@ -0,0 +1,100 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef SOCKSTREAMBUF_TEST_H +#define SOCKSTREAMBUF_TEST_H + +#include +#include + +#define LOCAL_LISTENER_SOCK_PATH "/tmp/psocksxx.listener.sock" +#define LOCAL_SOCK_PATH "/tmp/psocksxx.sock" + + +class sockstreambuf_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( sockstreambuf_test ); + CPPUNIT_TEST( test_constructors ); + CPPUNIT_TEST( test_open_close_local_ip ); + CPPUNIT_TEST( test_flush_empty ); + CPPUNIT_TEST( test_bad_flush ); + CPPUNIT_TEST( test_bad_connect_failure ); + CPPUNIT_TEST( test_bad_bind_failure ); + CPPUNIT_TEST( test_bad_listen_failure ); + CPPUNIT_TEST( test_bad_accept_failure ); + CPPUNIT_TEST( test_local_bind ); + CPPUNIT_TEST( test_local_listen ); + CPPUNIT_TEST( test_local_connect ); + CPPUNIT_TEST( test_local_connect_timeout ); + CPPUNIT_TEST( test_local_accept ); + CPPUNIT_TEST( test_local_flush ); + CPPUNIT_TEST( test_local_flush_read ); + CPPUNIT_TEST( test_local_ostream ); + CPPUNIT_TEST( test_local_istream ); + CPPUNIT_TEST( test_set_timeout ); + CPPUNIT_TEST( test_clear_timeout ); + CPPUNIT_TEST( test_local_read_timeout ); + CPPUNIT_TEST_SUITE_END(); + +public: + sockstreambuf_test(); + ~sockstreambuf_test(); + + void setUp(); + void tearDown(); + + void test_constructors(); + void test_open_close_local_ip(); + void test_flush_empty(); + void test_bad_flush(); + void test_bad_connect_failure(); + void test_bad_bind_failure(); + void test_bad_listen_failure(); + void test_bad_accept_failure(); + void test_local_bind(); + void test_local_listen(); + void test_local_connect(); + void test_local_connect_timeout(); + void test_local_accept(); + void test_local_flush(); + void test_local_flush_read(); + void test_local_ostream(); + void test_local_istream(); + void test_set_timeout(); + void test_clear_timeout(); + void test_local_read_timeout(); + + +private: + + // base sockaddr class for negative testing purposes + struct : public psocksxx::sockaddr, public sockaddr { + socklen_t size() const throw() { return sizeof( ::sockaddr ); } + ::sockaddr * psockaddr() const throw() { return (::sockaddr *) this; } + } _sockaddr; + + + void connect_local() throw(); + +}; + + +#endif /* !SOCKSTREAMBUF_TEST_H */ + diff --git a/test/socktimeoutexception_test.cpp b/test/socktimeoutexception_test.cpp new file mode 100644 index 0000000..933ec07 --- /dev/null +++ b/test/socktimeoutexception_test.cpp @@ -0,0 +1,64 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "socktimeoutexception_test.h" + +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( socktimeoutexception_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void socktimeoutexception_test::test_constructor_message() { + + std::string message = "test exception message"; + socktimeoutexception tex( message.c_str() ); + + CPPUNIT_ASSERT( message == std::string( tex.what() ) ); + +} + + +void socktimeoutexception_test::test_constructor_timeout() { + + timeval t; + t.tv_sec = 1; + t.tv_usec = 500; + + socktimeoutexception tex( &t ); + CPPUNIT_ASSERT( std::string( "timed out (1.500s)" ) == std::string( tex.what() ) ); + +} + + +void socktimeoutexception_test::test_constructor_timeout_method() { + + timeval t; + t.tv_sec = 5; + t.tv_usec = 230; + + socktimeoutexception tex( &t, "test()" ); + CPPUNIT_ASSERT( std::string( "test() timed out (5.230s)" ) == std::string( tex.what() ) ); + +} + diff --git a/test/socktimeoutexception_test.h b/test/socktimeoutexception_test.h new file mode 100644 index 0000000..bcd0f18 --- /dev/null +++ b/test/socktimeoutexception_test.h @@ -0,0 +1,44 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef SOCKTIMEOUTEXCEPTION_TEST_H +#define SOCKTIMEOUTEXCEPTION_TEST_H + +#include + + +class socktimeoutexception_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( socktimeoutexception_test ); + CPPUNIT_TEST( test_constructor_message ); + CPPUNIT_TEST( test_constructor_timeout ); + CPPUNIT_TEST( test_constructor_timeout_method ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructor_message(); + void test_constructor_timeout(); + void test_constructor_timeout_method(); + +}; + +#endif /* !SOCKTIMEOUTEXCEPTION_TEST_H */ + diff --git a/test/tap-runner.cpp b/test/tap-runner.cpp new file mode 100644 index 0000000..c7640d0 --- /dev/null +++ b/test/tap-runner.cpp @@ -0,0 +1,60 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include +#include +#include +#include +#include + +#include "tap/tap_listener.h" + + +int main( int argc, char * argv[] ) { + + // Get the top level suite from the registry + CppUnit::Test * suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); + + // the event manager and test controller + CppUnit::TestResult controller; + + // TAP listener + tap::TAPListener listener( suite ); + controller.addListener( &listener ); + + // register listener for collecting the test-results + CppUnit::TestResultCollector collectedresults; + controller.addListener( &collectedresults ); + + // test runner + CppUnit::TestRunner runner; + runner.addTest( suite ); + + // run tests. + runner.run( controller ); + + // output XML for Jenkins xunit plugin + std::ofstream xmloutput( "xunit.xml" ); + CppUnit::XmlOutputter xmloutputter( &collectedresults, xmloutput ); + xmloutputter.write(); + + return 0; + +} + diff --git a/test/tap/tap_listener.cpp b/test/tap/tap_listener.cpp new file mode 100644 index 0000000..e1e8b96 --- /dev/null +++ b/test/tap/tap_listener.cpp @@ -0,0 +1,106 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "tap_listener.h" + +#include +#include +#include +#include + + +namespace tap { + + + TAPListener::TAPListener( CppUnit::Test * factory_suite ) + : _factory_suite( factory_suite ), _test_success( false ) { + + // defaults + _failure_msg = 0; + + CppUnit::TestSuite * s = (CppUnit::TestSuite *) _factory_suite; + CppUnit::TestSuite * c; + int total_tests = 0; + + // calculate total number of tests + for ( int i = 0; i < s->getChildTestCount(); i++ ) { + c = (CppUnit::TestSuite *) s->getChildTestAt( i ); + total_tests += c->getChildTestCount(); + } + + // output tap header + std::cout << "1.." << total_tests << std::endl; + + } + + + TAPListener::~TAPListener() { + // destructor + } + + + void TAPListener::startSuite( CppUnit::Test * suite ) { + // start test suite + } + + + void TAPListener::startTest( CppUnit::Test * test ) { + _test_success = true; + } + + + void TAPListener::addFailure( const CppUnit::TestFailure &failure ) { + + CppUnit::Exception * e = failure.thrownException(); + _failure_msg = new CppUnit::Message ( e->message() ); + _test_success = false; + + } + + + void TAPListener::endTest( CppUnit::Test * test ) { + + if ( _test_success ) { + + std::cout << "ok " << test->getName() << std::endl; + + } else { + + std::cout << "not ok " << test->getName() << std::endl; + std::cout << "# " << _failure_msg->shortDescription() << std::endl; + + for ( int i = 0; i < _failure_msg->detailCount(); i++ ) { + std::cout << "# \t" << _failure_msg->detailAt( i ) << std::endl; + } + + // cleanup + delete _failure_msg; + + } + + + } + + + void TAPListener::endSuite( CppUnit::Test * suite ) { + // end test suite + } + +} /* end of namespace tap */ + diff --git a/test/tap/tap_listener.h b/test/tap/tap_listener.h new file mode 100644 index 0000000..89fe688 --- /dev/null +++ b/test/tap/tap_listener.h @@ -0,0 +1,51 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef TAP_TAP_LISTENER_H +#define TAP_TAP_LISTENER_H + +#include +#include + + +namespace tap { + + class TAPListener : public CppUnit::TestListener { + public: + + TAPListener( CppUnit::Test * factory_suite ); + ~TAPListener(); + + void startSuite( CppUnit::Test * suite ); + void startTest( CppUnit::Test * test ); + void addFailure( const CppUnit::TestFailure &failure ); + void endTest( CppUnit::Test * test); + void endSuite( CppUnit::Test * suite ); + + private: + CppUnit::Test * _factory_suite; + CppUnit::Message * _failure_msg; + bool _test_success; + + }; + +} /* end of namespace tap */ + +#endif /* !TAP_TAP_LISTENER_H */ + diff --git a/test/tcpnsockstream_test.cpp b/test/tcpnsockstream_test.cpp new file mode 100644 index 0000000..028832f --- /dev/null +++ b/test/tcpnsockstream_test.cpp @@ -0,0 +1,232 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "tcpnsockstream_test.h" +#include "necho.h" + +#include +#include +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( tcpnsockstream_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void tcpnsockstream_test::connect_naddr( nsockaddr * naddr ) throw() { + + int csock; + + // not worth having error handling here so we hope for the best + csock = socket( AF_INET, SOCK_STREAM, 0 ); + connect( csock, naddr->psockaddr(), naddr->size() ); + +} + + +void tcpnsockstream_test::test_constructors() { + + // default constructor + CPPUNIT_ASSERT_NO_THROW( tcpnsockstream ss ); + +} + + +void tcpnsockstream_test::test_connect_addr() { + + // tcp socket stream + tcpnsockstream ss; + + // network echo server + necho n( NSOCK_NODE, NSOCK_SERVICE ); + + // network address to connect to + nsockaddr saddr( NSOCK_NODE, NSOCK_SERVICE ); + + // connect + CPPUNIT_ASSERT_NO_THROW( ss.connect( &saddr ) ); + +} + + +void tcpnsockstream_test::test_connect_host_port() { + + // tcp socket stream + tcpnsockstream ss; + + // network echo server + necho n( NSOCK_NODE, NSOCK_SERVICE_2 ); + + // connect + CPPUNIT_ASSERT_NO_THROW( ss.connect( NSOCK_NODE, atoi( NSOCK_SERVICE_2 ) ) ); + +} + + +void tcpnsockstream_test::test_bind_addr() { + + // tcp socket stream + tcpnsockstream ss; + + // network address to bind to + nsockaddr naddr( NSOCK_NODE, NSOCK_BIND_SERVICE ); + + // bind + CPPUNIT_ASSERT_NO_THROW( ss.bind( &naddr, true ) ); + +} + + +void tcpnsockstream_test::test_listen_addr() { + + // tcp socket stream + tcpnsockstream ss; + + // network address to bind to + nsockaddr naddr( NSOCK_NODE, NSOCK_BIND_SERVICE ); + + // bind + try { + ss.bind( &naddr, true ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // listen + CPPUNIT_ASSERT_NO_THROW( ss.listen( 1 ) ); + +} + + +void tcpnsockstream_test::test_accept_addr() { + + // fork variables + pid_t cpid, wpid; + int wpid_status; + + // tcp socket stream + tcpnsockstream ss; + + // network socket pointer + nsockstream * nsock = 0; + + // network address to bind to + nsockaddr naddr( NSOCK_NODE, NSOCK_BIND_SERVICE ); + + // bind + try { + ss.bind( &naddr, true ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // listen + try { + ss.listen( 1 ); + } catch( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + + // fork + cpid = fork(); + + if ( cpid == -1 ) { + CPPUNIT_FAIL( "failed to fork" ); + } else if ( cpid == 0 ) { + + // child - connect to the network socket created by the parent + connect_naddr( &naddr ); + + // exit + exit( 0 ); + + } else { + + // parent - accept a connection from the child + CPPUNIT_ASSERT_NO_THROW( nsock = ss.accept() ); + CPPUNIT_ASSERT( nsock != 0 ); + + // cleanup + if ( nsock != 0 ) { + delete nsock; + } + + // wait for child to exit + if ( ( wpid = waitpid( cpid, &wpid_status, 0 ) ) == -1 ) { + CPPUNIT_FAIL( "failed waiting for the child process to terminate" ); + } + + } + +} + + +void tcpnsockstream_test::test_bind_addr_fail() { + + // tcp socket stream + tcpnsockstream ss; + + // network address to bind to + nsockaddr naddr( NSOCK_NODE, NSOCK_BIND_SERVICE ); + + // bind - this should fail with address already in use error + // because of test_accept_addr() + CPPUNIT_ASSERT_THROW( ss.bind( &naddr ), sockexception ); + +} + + +void tcpnsockstream_test::test_io_addr() { + + // tcp socket stream + tcpnsockstream ss; + + // network echo server + necho n( NSOCK_NODE, NSOCK_SERVICE ); + + // network address to connect to + nsockaddr saddr( NSOCK_NODE, NSOCK_SERVICE ); + + // connect + try { + ss.connect( &saddr ); + } catch ( sockexception &e ) { + CPPUNIT_FAIL( e.what() ); + return; + } + + // write + ss << 'c' << std::endl; + + // read + char c; + ss >> c; + + // assert + CPPUNIT_ASSERT( c == 'c' ); + +} + diff --git a/test/tcpnsockstream_test.h b/test/tcpnsockstream_test.h new file mode 100644 index 0000000..ecafee6 --- /dev/null +++ b/test/tcpnsockstream_test.h @@ -0,0 +1,76 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef TCPNSOCKSTREAM_TEST_H +#define TCPNSOCKSTREAM_TEST_H + +#include +#include + +#ifndef NSOCK_NODE +#define NSOCK_NODE "localhost" +#endif + +#ifndef NSOCK_SERVICE +#define NSOCK_SERVICE "21234" +#endif + +#ifndef NSOCK_SERVICE_2 +#define NSOCK_SERVICE_2 "21236" +#endif + +#ifndef NSOCK_BIND_SERVICE +#define NSOCK_BIND_SERVICE "21235" +#endif + + +class tcpnsockstream_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( tcpnsockstream_test ); + CPPUNIT_TEST( test_constructors ); + CPPUNIT_TEST( test_connect_addr ); + CPPUNIT_TEST( test_connect_host_port ); + CPPUNIT_TEST( test_bind_addr ); + CPPUNIT_TEST( test_listen_addr ); + CPPUNIT_TEST( test_accept_addr ); + CPPUNIT_TEST( test_bind_addr_fail ); + CPPUNIT_TEST( test_io_addr ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructors(); + void test_connect_addr(); + void test_connect_host_port(); + void test_bind_addr(); + void test_listen_addr(); + void test_accept_addr(); + void test_bind_addr_fail(); + void test_io_addr(); + + +private: + + void connect_naddr( psocksxx::nsockaddr * naddr ) throw(); + +}; + +#endif /* !TCPNSOCKSTREAM_TEST_H */ + diff --git a/test/udpnsockstream_test.cpp b/test/udpnsockstream_test.cpp new file mode 100644 index 0000000..037b9ad --- /dev/null +++ b/test/udpnsockstream_test.cpp @@ -0,0 +1,38 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#include "udpnsockstream_test.h" + +#include + + +// register the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION( udpnsockstream_test ); + +// use namespace psocksxx +using namespace psocksxx; + + +void udpnsockstream_test::test_constructors() { + + // default constructor + CPPUNIT_ASSERT_NO_THROW( udpnsockstream ss ); + +} + diff --git a/test/udpnsockstream_test.h b/test/udpnsockstream_test.h new file mode 100644 index 0000000..00abf59 --- /dev/null +++ b/test/udpnsockstream_test.h @@ -0,0 +1,40 @@ +/* +* psocksxx - A C++ wrapper for POSIX sockets +* Copyright (C) 2013 Uditha Atukorala +* +* This software library 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. +* +* This software library 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 software library. If not, see . +* +*/ + +#ifndef UDPNSOCKSTREAM_TEST_H +#define UDPNSOCKSTREAM_TEST_H + +#include + + +class udpnsockstream_test : public CppUnit::TestFixture { + + // setup the test suite + CPPUNIT_TEST_SUITE( udpnsockstream_test ); + CPPUNIT_TEST( test_constructors ); + CPPUNIT_TEST_SUITE_END(); + +public: + + void test_constructors(); + +}; + +#endif /* !UDPNSOCKSTREAM_TEST_H */ + -- cgit v1.2.3