diff options
Diffstat (limited to '')
41 files changed, 0 insertions, 4317 deletions
diff --git a/tests/.libs/bandwidth-client b/tests/.libs/bandwidth-client Binary files differdeleted file mode 100755 index 4d82059..0000000 --- a/tests/.libs/bandwidth-client +++ /dev/null diff --git a/tests/.libs/bandwidth-server-many-up b/tests/.libs/bandwidth-server-many-up Binary files differdeleted file mode 100755 index 9f3e0b5..0000000 --- a/tests/.libs/bandwidth-server-many-up +++ /dev/null diff --git a/tests/.libs/bandwidth-server-one b/tests/.libs/bandwidth-server-one Binary files differdeleted file mode 100755 index f14a514..0000000 --- a/tests/.libs/bandwidth-server-one +++ /dev/null diff --git a/tests/.libs/lt-random-test-client b/tests/.libs/lt-random-test-client Binary files differdeleted file mode 100755 index 168d3c4..0000000 --- a/tests/.libs/lt-random-test-client +++ /dev/null diff --git a/tests/.libs/lt-unit-test-client b/tests/.libs/lt-unit-test-client Binary files differdeleted file mode 100755 index 72c8ca1..0000000 --- a/tests/.libs/lt-unit-test-client +++ /dev/null diff --git a/tests/.libs/lt-unit-test-server b/tests/.libs/lt-unit-test-server Binary files differdeleted file mode 100755 index 4a6d570..0000000 --- a/tests/.libs/lt-unit-test-server +++ /dev/null diff --git a/tests/.libs/lt-version b/tests/.libs/lt-version Binary files differdeleted file mode 100755 index 7b81ff1..0000000 --- a/tests/.libs/lt-version +++ /dev/null diff --git a/tests/.libs/random-test-client b/tests/.libs/random-test-client Binary files differdeleted file mode 100755 index 17d9c36..0000000 --- a/tests/.libs/random-test-client +++ /dev/null diff --git a/tests/.libs/random-test-server b/tests/.libs/random-test-server Binary files differdeleted file mode 100755 index d0d9010..0000000 --- a/tests/.libs/random-test-server +++ /dev/null diff --git a/tests/.libs/unit-test-client b/tests/.libs/unit-test-client Binary files differdeleted file mode 100755 index 4920d69..0000000 --- a/tests/.libs/unit-test-client +++ /dev/null diff --git a/tests/.libs/unit-test-server b/tests/.libs/unit-test-server Binary files differdeleted file mode 100755 index 6a426ab..0000000 --- a/tests/.libs/unit-test-server +++ /dev/null diff --git a/tests/.libs/version b/tests/.libs/version Binary files differdeleted file mode 100755 index c88ec66..0000000 --- a/tests/.libs/version +++ /dev/null diff --git a/tests/Makefile b/tests/Makefile deleted file mode 100644 index 88d829e..0000000 --- a/tests/Makefile +++ /dev/null @@ -1,585 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# tests/Makefile. Generated from Makefile.in by configure. - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - - - -pkgdatadir = $(datadir)/libmodbus -pkgincludedir = $(includedir)/libmodbus -pkglibdir = $(libdir)/libmodbus -pkglibexecdir = $(libexecdir)/libmodbus -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 = x86_64-pc-linux-gnu -host_triplet = x86_64-pc-linux-gnu -noinst_PROGRAMS = bandwidth-server-one$(EXEEXT) \ - bandwidth-server-many-up$(EXEEXT) bandwidth-client$(EXEEXT) \ - random-test-server$(EXEEXT) random-test-client$(EXEEXT) \ - unit-test-server$(EXEEXT) unit-test-client$(EXEEXT) \ - version$(EXEEXT) -subdir = tests -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(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)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_bandwidth_client_OBJECTS = bandwidth-client.$(OBJEXT) -bandwidth_client_OBJECTS = $(am_bandwidth_client_OBJECTS) -bandwidth_client_DEPENDENCIES = $(common_ldflags) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -am_bandwidth_server_many_up_OBJECTS = \ - bandwidth-server-many-up.$(OBJEXT) -bandwidth_server_many_up_OBJECTS = \ - $(am_bandwidth_server_many_up_OBJECTS) -bandwidth_server_many_up_DEPENDENCIES = $(common_ldflags) -am_bandwidth_server_one_OBJECTS = bandwidth-server-one.$(OBJEXT) -bandwidth_server_one_OBJECTS = $(am_bandwidth_server_one_OBJECTS) -bandwidth_server_one_DEPENDENCIES = $(common_ldflags) -am_random_test_client_OBJECTS = random-test-client.$(OBJEXT) -random_test_client_OBJECTS = $(am_random_test_client_OBJECTS) -random_test_client_DEPENDENCIES = $(common_ldflags) -am_random_test_server_OBJECTS = random-test-server.$(OBJEXT) -random_test_server_OBJECTS = $(am_random_test_server_OBJECTS) -random_test_server_DEPENDENCIES = $(common_ldflags) -am_unit_test_client_OBJECTS = unit-test-client.$(OBJEXT) -unit_test_client_OBJECTS = $(am_unit_test_client_OBJECTS) -unit_test_client_DEPENDENCIES = $(common_ldflags) -am_unit_test_server_OBJECTS = unit-test-server.$(OBJEXT) -unit_test_server_OBJECTS = $(am_unit_test_server_OBJECTS) -unit_test_server_DEPENDENCIES = $(common_ldflags) -am_version_OBJECTS = version.$(OBJEXT) -version_OBJECTS = $(am_version_OBJECTS) -version_DEPENDENCIES = $(common_ldflags) -DEFAULT_INCLUDES = -I. -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(bandwidth_client_SOURCES) \ - $(bandwidth_server_many_up_SOURCES) \ - $(bandwidth_server_one_SOURCES) $(random_test_client_SOURCES) \ - $(random_test_server_SOURCES) $(unit_test_client_SOURCES) \ - $(unit_test_server_SOURCES) $(version_SOURCES) -DIST_SOURCES = $(bandwidth_client_SOURCES) \ - $(bandwidth_server_many_up_SOURCES) \ - $(bandwidth_server_one_SOURCES) $(random_test_client_SOURCES) \ - $(random_test_server_SOURCES) $(unit_test_client_SOURCES) \ - $(unit_test_server_SOURCES) $(version_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run aclocal-1.11 -AMTAR = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run tar -AM_DEFAULT_VERBOSITY = 1 -AR = ar -AS = as -AUTOCONF = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run autoconf -AUTOHEADER = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run autoheader -AUTOMAKE = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run automake-1.11 -AWK = gawk -CC = gcc -CCDEPMODE = depmode=none -CFLAGS = -g -O2 -g -O2 -Wall -Werror -CPP = gcc -E -CPPFLAGS = -CXX = g++ -CXXCPP = g++ -E -CXXDEPMODE = depmode=none -CXXFLAGS = -g -O2 -g -O2 -Wall -CYGPATH_W = echo -DEFS = -DHAVE_CONFIG_H -DEPDIR = .deps -DLLTOOL = false -DSYMUTIL = -DUMPBIN = -ECHO_C = -ECHO_N = -n -ECHO_T = -EGREP = /bin/grep -E -EXEEXT = -FGREP = /bin/grep -F -GREP = /bin/grep -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_PROGRAM = ${INSTALL} -INSTALL_SCRIPT = ${INSTALL} -INSTALL_STRIP_PROGRAM = $(install_sh) -c -s -LD = /usr/bin/ld -m elf_x86_64 -LDFLAGS = -LIBMODBUS_LT_VERSION_INFO = 5:0:0 -LIBMODBUS_VERSION = 3.0.1 -LIBMODBUS_VERSION_MAJOR = 3 -LIBMODBUS_VERSION_MICRO = 1 -LIBMODBUS_VERSION_MINOR = 0 -LIBOBJS = -LIBS = -LIBTOOL = $(SHELL) $(top_builddir)/libtool -LIPO = -LN_S = ln -s -LTLIBOBJS = -MAKEINFO = ${SHELL} /home/jmccrohan/bin/libmodbus/missing --run makeinfo -MANIFEST_TOOL = : -MKDIR_P = /bin/mkdir -p -NM = /usr/bin/nm -B -NMEDIT = -OBJDUMP = objdump -OBJEXT = o -OTOOL = -OTOOL64 = -PACKAGE = libmodbus -PACKAGE_BUGREPORT = https://github.com/stephane/libmodbus/issues -PACKAGE_NAME = libmodbus -PACKAGE_STRING = libmodbus 3.0.1 -PACKAGE_TARNAME = libmodbus -PACKAGE_URL = -PACKAGE_VERSION = 3.0.1 -PATH_SEPARATOR = : -RANLIB = ranlib -SED = /bin/sed -SET_MAKE = -SHELL = /bin/bash -STRIP = strip -VERSION = 3.0.1 -abs_builddir = /home/jmccrohan/bin/libmodbus/tests -abs_srcdir = /home/jmccrohan/bin/libmodbus/tests -abs_top_builddir = /home/jmccrohan/bin/libmodbus -abs_top_srcdir = /home/jmccrohan/bin/libmodbus -ac_ct_AR = ar -ac_ct_CC = gcc -ac_ct_CXX = g++ -ac_ct_DUMPBIN = -ac_libmodbus_have_asciidoc = yes -ac_libmodbus_have_xmlto = yes -am__include = include -am__leading_dot = . -am__quote = -am__tar = ${AMTAR} chof - "$$tardir" -am__untar = ${AMTAR} xf - -bindir = ${exec_prefix}/bin -build = x86_64-pc-linux-gnu -build_alias = x86_64-linux-gnu -build_cpu = x86_64 -build_os = linux-gnu -build_vendor = pc -builddir = . -datadir = ${datarootdir} -datarootdir = ${prefix}/share -docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} -dvidir = ${docdir} -exec_prefix = ${prefix} -host = x86_64-pc-linux-gnu -host_alias = -host_cpu = x86_64 -host_os = linux-gnu -host_vendor = pc -htmldir = ${docdir} -includedir = ${prefix}/include -infodir = ${prefix}/share/info -install_sh = ${SHELL} /home/jmccrohan/bin/libmodbus/install-sh -libdir = ${exec_prefix}/lib -libexecdir = ${prefix}/lib/libmodbus -localedir = ${datarootdir}/locale -localstatedir = /var -mandir = ${prefix}/share/man -mkdir_p = /bin/mkdir -p -oldincludedir = /usr/include -pdfdir = ${docdir} -prefix = /usr -program_transform_name = s,x,x, -psdir = ${docdir} -sbindir = ${exec_prefix}/sbin -sharedstatedir = ${prefix}/com -srcdir = . -sysconfdir = /etc -target_alias = -top_build_prefix = ../ -top_builddir = .. -top_srcdir = .. -EXTRA_DIST = README -common_ldflags = \ - $(top_builddir)/src/libmodbus.la - -bandwidth_server_one_SOURCES = bandwidth-server-one.c -bandwidth_server_one_LDADD = $(common_ldflags) -bandwidth_server_many_up_SOURCES = bandwidth-server-many-up.c -bandwidth_server_many_up_LDADD = $(common_ldflags) -bandwidth_client_SOURCES = bandwidth-client.c -bandwidth_client_LDADD = $(common_ldflags) -random_test_server_SOURCES = random-test-server.c -random_test_server_LDADD = $(common_ldflags) -random_test_client_SOURCES = random-test-client.c -random_test_client_LDADD = $(common_ldflags) -unit_test_server_SOURCES = unit-test-server.c unit-test.h -unit_test_server_LDADD = $(common_ldflags) -unit_test_client_SOURCES = unit-test-client.c unit-test.h -unit_test_client_LDADD = $(common_ldflags) -version_SOURCES = version.c -version_LDADD = $(common_ldflags) -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -CLEANFILES = *~ -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -bandwidth-client$(EXEEXT): $(bandwidth_client_OBJECTS) $(bandwidth_client_DEPENDENCIES) - @rm -f bandwidth-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_client_OBJECTS) $(bandwidth_client_LDADD) $(LIBS) -bandwidth-server-many-up$(EXEEXT): $(bandwidth_server_many_up_OBJECTS) $(bandwidth_server_many_up_DEPENDENCIES) - @rm -f bandwidth-server-many-up$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_server_many_up_OBJECTS) $(bandwidth_server_many_up_LDADD) $(LIBS) -bandwidth-server-one$(EXEEXT): $(bandwidth_server_one_OBJECTS) $(bandwidth_server_one_DEPENDENCIES) - @rm -f bandwidth-server-one$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_server_one_OBJECTS) $(bandwidth_server_one_LDADD) $(LIBS) -random-test-client$(EXEEXT): $(random_test_client_OBJECTS) $(random_test_client_DEPENDENCIES) - @rm -f random-test-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(random_test_client_OBJECTS) $(random_test_client_LDADD) $(LIBS) -random-test-server$(EXEEXT): $(random_test_server_OBJECTS) $(random_test_server_DEPENDENCIES) - @rm -f random-test-server$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(random_test_server_OBJECTS) $(random_test_server_LDADD) $(LIBS) -unit-test-client$(EXEEXT): $(unit_test_client_OBJECTS) $(unit_test_client_DEPENDENCIES) - @rm -f unit-test-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(unit_test_client_OBJECTS) $(unit_test_client_LDADD) $(LIBS) -unit-test-server$(EXEEXT): $(unit_test_server_OBJECTS) $(unit_test_server_DEPENDENCIES) - @rm -f unit-test-server$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(unit_test_server_OBJECTS) $(unit_test_server_LDADD) $(LIBS) -version$(EXEEXT): $(version_OBJECTS) $(version_DEPENDENCIES) - @rm -f version$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(version_OBJECTS) $(version_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -#include ./$(DEPDIR)/bandwidth-client.Po -#include ./$(DEPDIR)/bandwidth-server-many-up.Po -#include ./$(DEPDIR)/bandwidth-server-one.Po -#include ./$(DEPDIR)/random-test-client.Po -#include ./$(DEPDIR)/random-test-server.Po -#include ./$(DEPDIR)/unit-test-client.Po -#include ./$(DEPDIR)/unit-test-server.Po -#include ./$(DEPDIR)/version.Po - -.c.o: -# $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -# $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - $(AM_V_CC) \ -# source='$<' object='$@' libtool=no -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) - $(COMPILE) -c $< - -.c.obj: -# $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -# $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po - $(AM_V_CC) \ -# source='$<' object='$@' libtool=no -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) - $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -# $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -# $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo - $(AM_V_CC) \ -# source='$<' object='$@' libtool=yes -# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) - $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -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 -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tests/Makefile.am b/tests/Makefile.am deleted file mode 100644 index 2633873..0000000 --- a/tests/Makefile.am +++ /dev/null @@ -1,41 +0,0 @@ -EXTRA_DIST = README - -noinst_PROGRAMS = \ - bandwidth-server-one \ - bandwidth-server-many-up \ - bandwidth-client \ - random-test-server \ - random-test-client \ - unit-test-server \ - unit-test-client \ - version - -common_ldflags = \ - $(top_builddir)/src/libmodbus.la - -bandwidth_server_one_SOURCES = bandwidth-server-one.c -bandwidth_server_one_LDADD = $(common_ldflags) - -bandwidth_server_many_up_SOURCES = bandwidth-server-many-up.c -bandwidth_server_many_up_LDADD = $(common_ldflags) - -bandwidth_client_SOURCES = bandwidth-client.c -bandwidth_client_LDADD = $(common_ldflags) - -random_test_server_SOURCES = random-test-server.c -random_test_server_LDADD = $(common_ldflags) - -random_test_client_SOURCES = random-test-client.c -random_test_client_LDADD = $(common_ldflags) - -unit_test_server_SOURCES = unit-test-server.c unit-test.h -unit_test_server_LDADD = $(common_ldflags) - -unit_test_client_SOURCES = unit-test-client.c unit-test.h -unit_test_client_LDADD = $(common_ldflags) - -version_SOURCES = version.c -version_LDADD = $(common_ldflags) - -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -CLEANFILES = *~ diff --git a/tests/Makefile.in b/tests/Makefile.in deleted file mode 100644 index b06860f..0000000 --- a/tests/Makefile.in +++ /dev/null @@ -1,585 +0,0 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -noinst_PROGRAMS = bandwidth-server-one$(EXEEXT) \ - bandwidth-server-many-up$(EXEEXT) bandwidth-client$(EXEEXT) \ - random-test-server$(EXEEXT) random-test-client$(EXEEXT) \ - unit-test-server$(EXEEXT) unit-test-client$(EXEEXT) \ - version$(EXEEXT) -subdir = tests -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(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)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_bandwidth_client_OBJECTS = bandwidth-client.$(OBJEXT) -bandwidth_client_OBJECTS = $(am_bandwidth_client_OBJECTS) -bandwidth_client_DEPENDENCIES = $(common_ldflags) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) -am__v_lt_0 = --silent -am_bandwidth_server_many_up_OBJECTS = \ - bandwidth-server-many-up.$(OBJEXT) -bandwidth_server_many_up_OBJECTS = \ - $(am_bandwidth_server_many_up_OBJECTS) -bandwidth_server_many_up_DEPENDENCIES = $(common_ldflags) -am_bandwidth_server_one_OBJECTS = bandwidth-server-one.$(OBJEXT) -bandwidth_server_one_OBJECTS = $(am_bandwidth_server_one_OBJECTS) -bandwidth_server_one_DEPENDENCIES = $(common_ldflags) -am_random_test_client_OBJECTS = random-test-client.$(OBJEXT) -random_test_client_OBJECTS = $(am_random_test_client_OBJECTS) -random_test_client_DEPENDENCIES = $(common_ldflags) -am_random_test_server_OBJECTS = random-test-server.$(OBJEXT) -random_test_server_OBJECTS = $(am_random_test_server_OBJECTS) -random_test_server_DEPENDENCIES = $(common_ldflags) -am_unit_test_client_OBJECTS = unit-test-client.$(OBJEXT) -unit_test_client_OBJECTS = $(am_unit_test_client_OBJECTS) -unit_test_client_DEPENDENCIES = $(common_ldflags) -am_unit_test_server_OBJECTS = unit-test-server.$(OBJEXT) -unit_test_server_OBJECTS = $(am_unit_test_server_OBJECTS) -unit_test_server_DEPENDENCIES = $(common_ldflags) -am_version_OBJECTS = version.$(OBJEXT) -version_OBJECTS = $(am_version_OBJECTS) -version_DEPENDENCIES = $(common_ldflags) -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) -am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) -am__v_at_0 = @ -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) -am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(bandwidth_client_SOURCES) \ - $(bandwidth_server_many_up_SOURCES) \ - $(bandwidth_server_one_SOURCES) $(random_test_client_SOURCES) \ - $(random_test_server_SOURCES) $(unit_test_client_SOURCES) \ - $(unit_test_server_SOURCES) $(version_SOURCES) -DIST_SOURCES = $(bandwidth_client_SOURCES) \ - $(bandwidth_server_many_up_SOURCES) \ - $(bandwidth_server_one_SOURCES) $(random_test_client_SOURCES) \ - $(random_test_server_SOURCES) $(unit_test_client_SOURCES) \ - $(unit_test_server_SOURCES) $(version_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBMODBUS_LT_VERSION_INFO = @LIBMODBUS_LT_VERSION_INFO@ -LIBMODBUS_VERSION = @LIBMODBUS_VERSION@ -LIBMODBUS_VERSION_MAJOR = @LIBMODBUS_VERSION_MAJOR@ -LIBMODBUS_VERSION_MICRO = @LIBMODBUS_VERSION_MICRO@ -LIBMODBUS_VERSION_MINOR = @LIBMODBUS_VERSION_MINOR@ -LIBOBJS = @LIBOBJS@ -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@ -ac_libmodbus_have_asciidoc = @ac_libmodbus_have_asciidoc@ -ac_libmodbus_have_xmlto = @ac_libmodbus_have_xmlto@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -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@ -EXTRA_DIST = README -common_ldflags = \ - $(top_builddir)/src/libmodbus.la - -bandwidth_server_one_SOURCES = bandwidth-server-one.c -bandwidth_server_one_LDADD = $(common_ldflags) -bandwidth_server_many_up_SOURCES = bandwidth-server-many-up.c -bandwidth_server_many_up_LDADD = $(common_ldflags) -bandwidth_client_SOURCES = bandwidth-client.c -bandwidth_client_LDADD = $(common_ldflags) -random_test_server_SOURCES = random-test-server.c -random_test_server_LDADD = $(common_ldflags) -random_test_client_SOURCES = random-test-client.c -random_test_client_LDADD = $(common_ldflags) -unit_test_server_SOURCES = unit-test-server.c unit-test.h -unit_test_server_LDADD = $(common_ldflags) -unit_test_client_SOURCES = unit-test-client.c unit-test.h -unit_test_client_LDADD = $(common_ldflags) -version_SOURCES = version.c -version_LDADD = $(common_ldflags) -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src -CLEANFILES = *~ -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign tests/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -bandwidth-client$(EXEEXT): $(bandwidth_client_OBJECTS) $(bandwidth_client_DEPENDENCIES) - @rm -f bandwidth-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_client_OBJECTS) $(bandwidth_client_LDADD) $(LIBS) -bandwidth-server-many-up$(EXEEXT): $(bandwidth_server_many_up_OBJECTS) $(bandwidth_server_many_up_DEPENDENCIES) - @rm -f bandwidth-server-many-up$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_server_many_up_OBJECTS) $(bandwidth_server_many_up_LDADD) $(LIBS) -bandwidth-server-one$(EXEEXT): $(bandwidth_server_one_OBJECTS) $(bandwidth_server_one_DEPENDENCIES) - @rm -f bandwidth-server-one$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bandwidth_server_one_OBJECTS) $(bandwidth_server_one_LDADD) $(LIBS) -random-test-client$(EXEEXT): $(random_test_client_OBJECTS) $(random_test_client_DEPENDENCIES) - @rm -f random-test-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(random_test_client_OBJECTS) $(random_test_client_LDADD) $(LIBS) -random-test-server$(EXEEXT): $(random_test_server_OBJECTS) $(random_test_server_DEPENDENCIES) - @rm -f random-test-server$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(random_test_server_OBJECTS) $(random_test_server_LDADD) $(LIBS) -unit-test-client$(EXEEXT): $(unit_test_client_OBJECTS) $(unit_test_client_DEPENDENCIES) - @rm -f unit-test-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(unit_test_client_OBJECTS) $(unit_test_client_LDADD) $(LIBS) -unit-test-server$(EXEEXT): $(unit_test_server_OBJECTS) $(unit_test_server_DEPENDENCIES) - @rm -f unit-test-server$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(unit_test_server_OBJECTS) $(unit_test_server_LDADD) $(LIBS) -version$(EXEEXT): $(version_OBJECTS) $(version_DEPENDENCIES) - @rm -f version$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(version_OBJECTS) $(version_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bandwidth-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bandwidth-server-many-up.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bandwidth-server-one.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random-test-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random-test-server.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit-test-server.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/version.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - set x; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -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 -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -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) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/tests/README b/tests/README deleted file mode 100644 index f530c8a..0000000 --- a/tests/README +++ /dev/null @@ -1,38 +0,0 @@ -Compilation ------------ - -After installation, you can use pkg-config to compile these tests. -For example, to compile random-test-server run: - -gcc random-test-server.c -o random-test-server `pkg-config --libs --cflags libmodbus` - -random-test-server ------------------ -It's necessary to launch this server before run random-test-client. By -default, it receives and responses to Modbus query on the localhost -and port 1502. - -random-test-client ------------------- -This programm sends many different queries to a large range of -addresses and values to test the communication between the client and -the server. - -unit-test-server -unit-test-client ----------------- -By default, this program sends some queries with the values defined in -unit-test.h and checks the responses. These programs are useful to -test the protocol implementation. - -bandwidth-server-one -bandwidth-server-many-up -bandwidth-client ------------------------ -It returns some very useful informations about the performance of -transfert rate between the server and the client. - -- bandwidth-server-one: it can handles only one connection with a client. -- bandwidth-server-many-up: it opens a connection each time a new client asks - for, but the number of connection is limited. The same server process handles - all the connections. diff --git a/tests/bandwidth-client b/tests/bandwidth-client deleted file mode 100755 index b013803..0000000 --- a/tests/bandwidth-client +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# bandwidth-client - temporary wrapper script for .libs/bandwidth-client -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The bandwidth-client program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file bandwidth-client.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "bandwidth-client:bandwidth-client:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "bandwidth-client:bandwidth-client:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "bandwidth-client:bandwidth-client:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'bandwidth-client' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/bandwidth-client.c b/tests/bandwidth-client.c deleted file mode 100644 index e9109e1..0000000 --- a/tests/bandwidth-client.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <time.h> -#include <sys/time.h> -#include <errno.h> - -#include <modbus.h> - -#define G_MSEC_PER_SEC 1000 - -uint32_t gettime_ms(void) -{ - struct timeval tv; - gettimeofday (&tv, NULL); - - return (uint32_t) tv.tv_sec * 1000 + tv.tv_usec / 1000; -} - -enum { - TCP, - RTU -}; - -/* Tests based on PI-MBUS-300 documentation */ -int main(int argc, char *argv[]) -{ - uint8_t *tab_bit; - uint16_t *tab_reg; - modbus_t *ctx; - int i; - int nb_points; - double elapsed; - uint32_t start; - uint32_t end; - uint32_t bytes; - uint32_t rate; - int rc; - int n_loop; - int use_backend; - - if (argc > 1) { - if (strcmp(argv[1], "tcp") == 0) { - use_backend = TCP; - n_loop = 100000; - } else if (strcmp(argv[1], "rtu") == 0) { - use_backend = RTU; - n_loop = 100; - } else { - printf("Usage:\n %s [tcp|rtu] - Modbus client to measure data bandwith\n\n", argv[0]); - exit(1); - } - } else { - /* By default */ - use_backend = TCP; - n_loop = 100000; - } - - if (use_backend == TCP) { - ctx = modbus_new_tcp("127.0.0.1", 1502); - } else { - ctx = modbus_new_rtu("/dev/ttyUSB1", 115200, 'N', 8, 1); - modbus_set_slave(ctx, 1); - } - if (modbus_connect(ctx) == -1) { - fprintf(stderr, "Connexion failed: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - /* Allocate and initialize the memory to store the status */ - tab_bit = (uint8_t *) malloc(MODBUS_MAX_READ_BITS * sizeof(uint8_t)); - memset(tab_bit, 0, MODBUS_MAX_READ_BITS * sizeof(uint8_t)); - - /* Allocate and initialize the memory to store the registers */ - tab_reg = (uint16_t *) malloc(MODBUS_MAX_READ_REGISTERS * sizeof(uint16_t)); - memset(tab_reg, 0, MODBUS_MAX_READ_REGISTERS * sizeof(uint16_t)); - - printf("READ BITS\n\n"); - - nb_points = MODBUS_MAX_READ_BITS; - start = gettime_ms(); - for (i=0; i<n_loop; i++) { - rc = modbus_read_bits(ctx, 0, nb_points, tab_bit); - if (rc == -1) { - fprintf(stderr, "%s\n", modbus_strerror(errno)); - return -1; - } - } - end = gettime_ms(); - elapsed = end - start; - - rate = (n_loop * nb_points) * G_MSEC_PER_SEC / (end - start); - printf("Transfert rate in points/seconds:\n"); - printf("* %d points/s\n", rate); - printf("\n"); - - bytes = n_loop * (nb_points / 8) + ((nb_points % 8) ? 1 : 0); - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("Values:\n"); - printf("* %d x %d values\n", n_loop, nb_points); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n"); - - /* TCP: Query and reponse header and values */ - bytes = 12 + 9 + (nb_points / 8) + ((nb_points % 8) ? 1 : 0); - printf("Values and TCP Modbus overhead:\n"); - printf("* %d x %d bytes\n", n_loop, bytes); - bytes = n_loop * bytes; - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n\n"); - - printf("READ REGISTERS\n\n"); - - nb_points = MODBUS_MAX_READ_REGISTERS; - start = gettime_ms(); - for (i=0; i<n_loop; i++) { - rc = modbus_read_registers(ctx, 0, nb_points, tab_reg); - if (rc == -1) { - fprintf(stderr, "%s\n", modbus_strerror(errno)); - return -1; - } - } - end = gettime_ms(); - elapsed = end - start; - - rate = (n_loop * nb_points) * G_MSEC_PER_SEC / (end - start); - printf("Transfert rate in points/seconds:\n"); - printf("* %d registers/s\n", rate); - printf("\n"); - - bytes = n_loop * nb_points * sizeof(uint16_t); - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("Values:\n"); - printf("* %d x %d values\n", n_loop, nb_points); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n"); - - /* TCP:Query and reponse header and values */ - bytes = 12 + 9 + (nb_points * sizeof(uint16_t)); - printf("Values and TCP Modbus overhead:\n"); - printf("* %d x %d bytes\n", n_loop, bytes); - bytes = n_loop * bytes; - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n\n"); - - printf("READ AND WRITE REGISTERS\n\n"); - - nb_points = MODBUS_MAX_RW_WRITE_REGISTERS; - start = gettime_ms(); - for (i=0; i<n_loop; i++) { - rc = modbus_write_and_read_registers(ctx, - 0, nb_points, tab_reg, - 0, nb_points, tab_reg); - if (rc == -1) { - fprintf(stderr, "%s\n", modbus_strerror(errno)); - return -1; - } - } - end = gettime_ms(); - elapsed = end - start; - - rate = (n_loop * nb_points) * G_MSEC_PER_SEC / (end - start); - printf("Transfert rate in points/seconds:\n"); - printf("* %d registers/s\n", rate); - printf("\n"); - - bytes = n_loop * nb_points * sizeof(uint16_t); - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("Values:\n"); - printf("* %d x %d values\n", n_loop, nb_points); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n"); - - /* TCP:Query and reponse header and values */ - bytes = 12 + 9 + (nb_points * sizeof(uint16_t)); - printf("Values and TCP Modbus overhead:\n"); - printf("* %d x %d bytes\n", n_loop, bytes); - bytes = n_loop * bytes; - rate = bytes / 1024 * G_MSEC_PER_SEC / (end - start); - printf("* %.3f ms for %d bytes\n", elapsed, bytes); - printf("* %d KiB/s\n", rate); - printf("\n"); - - /* Free the memory */ - free(tab_bit); - free(tab_reg); - - /* Close the connection */ - modbus_close(ctx); - modbus_free(ctx); - - return 0; -} diff --git a/tests/bandwidth-client.o b/tests/bandwidth-client.o Binary files differdeleted file mode 100644 index 9ff6b23..0000000 --- a/tests/bandwidth-client.o +++ /dev/null diff --git a/tests/bandwidth-server-many-up b/tests/bandwidth-server-many-up deleted file mode 100755 index 85a88ea..0000000 --- a/tests/bandwidth-server-many-up +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# bandwidth-server-many-up - temporary wrapper script for .libs/bandwidth-server-many-up -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The bandwidth-server-many-up program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file bandwidth-server-many-up.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "bandwidth-server-many-up:bandwidth-server-many-up:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "bandwidth-server-many-up:bandwidth-server-many-up:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "bandwidth-server-many-up:bandwidth-server-many-up:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'bandwidth-server-many-up' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/bandwidth-server-many-up.c b/tests/bandwidth-server-many-up.c deleted file mode 100644 index 02968c1..0000000 --- a/tests/bandwidth-server-many-up.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright © 2009-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <signal.h> - -#include <modbus.h> - -#if defined(_WIN32) -#include <ws2tcpip.h> -#else -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#endif - -#define NB_CONNECTION 5 - -modbus_t *ctx = NULL; -int server_socket; -modbus_mapping_t *mb_mapping; - -static void close_sigint(int dummy) -{ - close(server_socket); - modbus_free(ctx); - modbus_mapping_free(mb_mapping); - - exit(dummy); -} - -int main(void) -{ - int master_socket; - int rc; - fd_set refset; - fd_set rdset; - - /* Maximum file descriptor number */ - int fdmax; - - ctx = modbus_new_tcp("127.0.0.1", 1502); - - mb_mapping = modbus_mapping_new(MODBUS_MAX_READ_BITS, 0, - MODBUS_MAX_READ_REGISTERS, 0); - if (mb_mapping == NULL) { - fprintf(stderr, "Failed to allocate the mapping: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - server_socket = modbus_tcp_listen(ctx, NB_CONNECTION); - - signal(SIGINT, close_sigint); - - /* Clear the reference set of socket */ - FD_ZERO(&refset); - /* Add the server socket */ - FD_SET(server_socket, &refset); - - /* Keep track of the max file descriptor */ - fdmax = server_socket; - - for (;;) { - rdset = refset; - if (select(fdmax+1, &rdset, NULL, NULL, NULL) == -1) { - perror("Server select() failure."); - close_sigint(1); - } - - /* Run through the existing connections looking for data to be - * read */ - for (master_socket = 0; master_socket <= fdmax; master_socket++) { - - if (FD_ISSET(master_socket, &rdset)) { - if (master_socket == server_socket) { - /* A client is asking a new connection */ - socklen_t addrlen; - struct sockaddr_in clientaddr; - int newfd; - - /* Handle new connections */ - addrlen = sizeof(clientaddr); - memset(&clientaddr, 0, sizeof(clientaddr)); - newfd = accept(server_socket, (struct sockaddr *)&clientaddr, &addrlen); - if (newfd == -1) { - perror("Server accept() error"); - } else { - FD_SET(newfd, &refset); - - if (newfd > fdmax) { - /* Keep track of the maximum */ - fdmax = newfd; - } - printf("New connection from %s:%d on socket %d\n", - inet_ntoa(clientaddr.sin_addr), clientaddr.sin_port, newfd); - } - } else { - /* An already connected master has sent a new query */ - uint8_t query[MODBUS_TCP_MAX_ADU_LENGTH]; - - modbus_set_socket(ctx, master_socket); - rc = modbus_receive(ctx, query); - if (rc != -1) { - modbus_reply(ctx, query, rc, mb_mapping); - } else { - /* Connection closed by the client, end of server */ - printf("Connection closed on socket %d\n", master_socket); - close(master_socket); - - /* Remove from reference set */ - FD_CLR(master_socket, &refset); - - if (master_socket == fdmax) { - fdmax--; - } - } - } - } - } - } - - return 0; -} diff --git a/tests/bandwidth-server-many-up.o b/tests/bandwidth-server-many-up.o Binary files differdeleted file mode 100644 index 0b6254d..0000000 --- a/tests/bandwidth-server-many-up.o +++ /dev/null diff --git a/tests/bandwidth-server-one b/tests/bandwidth-server-one deleted file mode 100755 index 4aa0039..0000000 --- a/tests/bandwidth-server-one +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# bandwidth-server-one - temporary wrapper script for .libs/bandwidth-server-one -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The bandwidth-server-one program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file bandwidth-server-one.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "bandwidth-server-one:bandwidth-server-one:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "bandwidth-server-one:bandwidth-server-one:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "bandwidth-server-one:bandwidth-server-one:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'bandwidth-server-one' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/bandwidth-server-one.c b/tests/bandwidth-server-one.c deleted file mode 100644 index e15fb69..0000000 --- a/tests/bandwidth-server-one.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> - -#include <modbus.h> - -enum { - TCP, - RTU -}; - -int main(int argc, char *argv[]) -{ - int socket; - modbus_t *ctx; - modbus_mapping_t *mb_mapping; - int rc; - int use_backend; - - /* TCP */ - if (argc > 1) { - if (strcmp(argv[1], "tcp") == 0) { - use_backend = TCP; - } else if (strcmp(argv[1], "rtu") == 0) { - use_backend = RTU; - } else { - printf("Usage:\n %s [tcp|rtu] - Modbus client to measure data bandwith\n\n", argv[0]); - exit(1); - } - } else { - /* By default */ - use_backend = TCP; - } - - if (use_backend == TCP) { - ctx = modbus_new_tcp("127.0.0.1", 1502); - socket = modbus_tcp_listen(ctx, 1); - modbus_tcp_accept(ctx, &socket); - - } else { - ctx = modbus_new_rtu("/dev/ttyUSB0", 115200, 'N', 8, 1); - modbus_set_slave(ctx, 1); - modbus_connect(ctx); - } - - mb_mapping = modbus_mapping_new(MODBUS_MAX_READ_BITS, 0, - MODBUS_MAX_READ_REGISTERS, 0); - if (mb_mapping == NULL) { - fprintf(stderr, "Failed to allocate the mapping: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - for(;;) { - uint8_t query[MODBUS_TCP_MAX_ADU_LENGTH]; - - rc = modbus_receive(ctx, query); - if (rc >= 0) { - modbus_reply(ctx, query, rc, mb_mapping); - } else { - /* Connection closed by the client or server */ - break; - } - } - - printf("Quit the loop: %s\n", modbus_strerror(errno)); - - modbus_mapping_free(mb_mapping); - close(socket); - modbus_free(ctx); - - return 0; -} diff --git a/tests/bandwidth-server-one.o b/tests/bandwidth-server-one.o Binary files differdeleted file mode 100644 index 016e927..0000000 --- a/tests/bandwidth-server-one.o +++ /dev/null diff --git a/tests/random-test-client b/tests/random-test-client Binary files differdeleted file mode 100755 index d6291ee..0000000 --- a/tests/random-test-client +++ /dev/null diff --git a/tests/random-test-client.c b/tests/random-test-client.c deleted file mode 100644 index 593867c..0000000 --- a/tests/random-test-client.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright © 2001-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> - -#include <modbus.h> - -/* The goal of this program is to check all major functions of - libmodbus: - - write_coil - - read_bits - - write_coils - - write_register - - read_registers - - write_registers - - read_registers - - All these functions are called with random values on a address - range defined by the following defines. -*/ -#define LOOP 1 -#define SERVER_ID 17 -#define ADDRESS_START 0 -#define ADDRESS_END 99 - -/* At each loop, the program works in the range ADDRESS_START to - * ADDRESS_END then ADDRESS_START + 1 to ADDRESS_END and so on. - */ -int main(void) -{ - modbus_t *ctx; - int rc; - int nb_fail; - int nb_loop; - int addr; - int nb; - uint8_t *tab_rq_bits; - uint8_t *tab_rp_bits; - uint16_t *tab_rq_registers; - uint16_t *tab_rw_rq_registers; - uint16_t *tab_rp_registers; - - /* RTU */ -/* - ctx = modbus_new_rtu("/dev/ttyUSB0", 19200, 'N', 8, 1); - modbus_set_slave(ctx, SERVER_ID); -*/ - - /* TCP */ - ctx = modbus_new_tcp("127.0.0.1", 1502); - modbus_set_debug(ctx, TRUE); - - if (modbus_connect(ctx) == -1) { - fprintf(stderr, "Connection failed: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - /* Allocate and initialize the different memory spaces */ - nb = ADDRESS_END - ADDRESS_START; - - tab_rq_bits = (uint8_t *) malloc(nb * sizeof(uint8_t)); - memset(tab_rq_bits, 0, nb * sizeof(uint8_t)); - - tab_rp_bits = (uint8_t *) malloc(nb * sizeof(uint8_t)); - memset(tab_rp_bits, 0, nb * sizeof(uint8_t)); - - tab_rq_registers = (uint16_t *) malloc(nb * sizeof(uint16_t)); - memset(tab_rq_registers, 0, nb * sizeof(uint16_t)); - - tab_rp_registers = (uint16_t *) malloc(nb * sizeof(uint16_t)); - memset(tab_rp_registers, 0, nb * sizeof(uint16_t)); - - tab_rw_rq_registers = (uint16_t *) malloc(nb * sizeof(uint16_t)); - memset(tab_rw_rq_registers, 0, nb * sizeof(uint16_t)); - - nb_loop = nb_fail = 0; - while (nb_loop++ < LOOP) { - for (addr = ADDRESS_START; addr <= ADDRESS_END; addr++) { - int i; - - /* Random numbers (short) */ - for (i=0; i<nb; i++) { - tab_rq_registers[i] = (uint16_t) (65535.0*rand() / (RAND_MAX + 1.0)); - tab_rw_rq_registers[i] = ~tab_rq_registers[i]; - tab_rq_bits[i] = tab_rq_registers[i] % 2; - } - nb = ADDRESS_END - addr; - - /* WRITE BIT */ - rc = modbus_write_bit(ctx, addr, tab_rq_bits[0]); - if (rc != 1) { - printf("ERROR modbus_write_bit (%d)\n", rc); - printf("Address = %d, value = %d\n", addr, tab_rq_bits[0]); - nb_fail++; - } else { - rc = modbus_read_bits(ctx, addr, 1, tab_rp_bits); - if (rc != 1 || tab_rq_bits[0] != tab_rp_bits[0]) { - printf("ERROR modbus_read_bits single (%d)\n", rc); - printf("address = %d\n", addr); - nb_fail++; - } - } - - /* MULTIPLE BITS */ - rc = modbus_write_bits(ctx, addr, nb, tab_rq_bits); - if (rc != nb) { - printf("ERROR modbus_write_bits (%d)\n", rc); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - rc = modbus_read_bits(ctx, addr, nb, tab_rp_bits); - if (rc != nb) { - printf("ERROR modbus_read_bits\n"); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - for (i=0; i<nb; i++) { - if (tab_rp_bits[i] != tab_rq_bits[i]) { - printf("ERROR modbus_read_bits\n"); - printf("Address = %d, value %d (0x%X) != %d (0x%X)\n", - addr, tab_rq_bits[i], tab_rq_bits[i], - tab_rp_bits[i], tab_rp_bits[i]); - nb_fail++; - } - } - } - } - - /* SINGLE REGISTER */ - rc = modbus_write_register(ctx, addr, tab_rq_registers[0]); - if (rc != 1) { - printf("ERROR modbus_write_register (%d)\n", rc); - printf("Address = %d, value = %d (0x%X)\n", - addr, tab_rq_registers[0], tab_rq_registers[0]); - nb_fail++; - } else { - rc = modbus_read_registers(ctx, addr, 1, tab_rp_registers); - if (rc != 1) { - printf("ERROR modbus_read_registers single (%d)\n", rc); - printf("Address = %d\n", addr); - nb_fail++; - } else { - if (tab_rq_registers[0] != tab_rp_registers[0]) { - printf("ERROR modbus_read_registers single\n"); - printf("Address = %d, value = %d (0x%X) != %d (0x%X)\n", - addr, tab_rq_registers[0], tab_rq_registers[0], - tab_rp_registers[0], tab_rp_registers[0]); - nb_fail++; - } - } - } - - /* MULTIPLE REGISTERS */ - rc = modbus_write_registers(ctx, addr, nb, tab_rq_registers); - if (rc != nb) { - printf("ERROR modbus_write_registers (%d)\n", rc); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - rc = modbus_read_registers(ctx, addr, nb, tab_rp_registers); - if (rc != nb) { - printf("ERROR modbus_read_registers (%d)\n", rc); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - for (i=0; i<nb; i++) { - if (tab_rq_registers[i] != tab_rp_registers[i]) { - printf("ERROR modbus_read_registers\n"); - printf("Address = %d, value %d (0x%X) != %d (0x%X)\n", - addr, tab_rq_registers[i], tab_rq_registers[i], - tab_rp_registers[i], tab_rp_registers[i]); - nb_fail++; - } - } - } - } - /* R/W MULTIPLE REGISTERS */ - rc = modbus_write_and_read_registers(ctx, - addr, nb, tab_rw_rq_registers, - addr, nb, tab_rp_registers); - if (rc != nb) { - printf("ERROR modbus_read_and_write_registers (%d)\n", rc); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - for (i=0; i<nb; i++) { - if (tab_rp_registers[i] != tab_rw_rq_registers[i]) { - printf("ERROR modbus_read_and_write_registers READ\n"); - printf("Address = %d, value %d (0x%X) != %d (0x%X)\n", - addr, tab_rp_registers[i], tab_rw_rq_registers[i], - tab_rp_registers[i], tab_rw_rq_registers[i]); - nb_fail++; - } - } - - rc = modbus_read_registers(ctx, addr, nb, tab_rp_registers); - if (rc != nb) { - printf("ERROR modbus_read_registers (%d)\n", rc); - printf("Address = %d, nb = %d\n", addr, nb); - nb_fail++; - } else { - for (i=0; i<nb; i++) { - if (tab_rw_rq_registers[i] != tab_rp_registers[i]) { - printf("ERROR modbus_read_and_write_registers WRITE\n"); - printf("Address = %d, value %d (0x%X) != %d (0x%X)\n", - addr, tab_rw_rq_registers[i], tab_rw_rq_registers[i], - tab_rp_registers[i], tab_rp_registers[i]); - nb_fail++; - } - } - } - } - } - - printf("Test: "); - if (nb_fail) - printf("%d FAILS\n", nb_fail); - else - printf("SUCCESS\n"); - } - - /* Free the memory */ - free(tab_rq_bits); - free(tab_rp_bits); - free(tab_rq_registers); - free(tab_rp_registers); - - /* Close the connection */ - modbus_close(ctx); - modbus_free(ctx); - - return 0; -} diff --git a/tests/random-test-client.o b/tests/random-test-client.o Binary files differdeleted file mode 100644 index b9ddf6f..0000000 --- a/tests/random-test-client.o +++ /dev/null diff --git a/tests/random-test-server b/tests/random-test-server Binary files differdeleted file mode 100755 index 5beca61..0000000 --- a/tests/random-test-server +++ /dev/null diff --git a/tests/random-test-server.c b/tests/random-test-server.c deleted file mode 100644 index 9569fe4..0000000 --- a/tests/random-test-server.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> - -#include <modbus.h> - -int main(void) -{ - int socket; - modbus_t *ctx; - modbus_mapping_t *mb_mapping; - - ctx = modbus_new_tcp("127.0.0.1", 1502); - /* modbus_set_debug(ctx, TRUE); */ - - mb_mapping = modbus_mapping_new(500, 500, 500, 500); - if (mb_mapping == NULL) { - fprintf(stderr, "Failed to allocate the mapping: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - socket = modbus_tcp_listen(ctx, 1); - modbus_tcp_accept(ctx, &socket); - - for (;;) { - uint8_t query[MODBUS_TCP_MAX_ADU_LENGTH]; - int rc; - - rc = modbus_receive(ctx, query); - if (rc != -1) { - /* rc is the query size */ - modbus_reply(ctx, query, rc, mb_mapping); - } else { - /* Connection closed by the client or error */ - break; - } - } - - printf("Quit the loop: %s\n", modbus_strerror(errno)); - - modbus_mapping_free(mb_mapping); - modbus_close(ctx); - modbus_free(ctx); - - return 0; -} diff --git a/tests/random-test-server.o b/tests/random-test-server.o Binary files differdeleted file mode 100644 index 7ea92e9..0000000 --- a/tests/random-test-server.o +++ /dev/null diff --git a/tests/unit-test-client b/tests/unit-test-client deleted file mode 100755 index 4e2b561..0000000 --- a/tests/unit-test-client +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# unit-test-client - temporary wrapper script for .libs/unit-test-client -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The unit-test-client program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file unit-test-client.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "unit-test-client:unit-test-client:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "unit-test-client:unit-test-client:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "unit-test-client:unit-test-client:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'unit-test-client' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/unit-test-client.c b/tests/unit-test-client.c deleted file mode 100644 index 533e6a7..0000000 --- a/tests/unit-test-client.c +++ /dev/null @@ -1,690 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <modbus.h> - -#include "unit-test.h" - -enum { - TCP, - TCP_PI, - RTU -}; - -int main(int argc, char *argv[]) -{ - uint8_t *tab_rp_bits; - uint16_t *tab_rp_registers; - uint16_t *tab_rp_registers_bad; - modbus_t *ctx; - int i; - uint8_t value; - int nb_points; - int rc; - float real; - struct timeval old_response_timeout; - struct timeval response_timeout; - int use_backend; - - if (argc > 1) { - if (strcmp(argv[1], "tcp") == 0) { - use_backend = TCP; - } else if (strcmp(argv[1], "tcppi") == 0) { - use_backend = TCP_PI; - } else if (strcmp(argv[1], "rtu") == 0) { - use_backend = RTU; - } else { - printf("Usage:\n %s [tcp|tcppi|rtu] - Modbus client for unit testing\n\n", argv[0]); - exit(1); - } - } else { - /* By default */ - use_backend = TCP; - } - - if (use_backend == TCP) { - ctx = modbus_new_tcp("127.0.0.1", 1502); - } else if (use_backend == TCP_PI) { - ctx = modbus_new_tcp_pi("::1", "1502"); - } else { - ctx = modbus_new_rtu("/dev/ttyUSB1", 115200, 'N', 8, 1); - } - if (ctx == NULL) { - fprintf(stderr, "Unable to allocate libmodbus context\n"); - return -1; - } - modbus_set_debug(ctx, TRUE); - modbus_set_error_recovery(ctx, - MODBUS_ERROR_RECOVERY_LINK | - MODBUS_ERROR_RECOVERY_PROTOCOL); - - if (use_backend == RTU) { - modbus_set_slave(ctx, SERVER_ID); - } - - if (modbus_connect(ctx) == -1) { - fprintf(stderr, "Connection failed: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - /* Allocate and initialize the memory to store the bits */ - nb_points = (UT_BITS_NB > UT_INPUT_BITS_NB) ? UT_BITS_NB : UT_INPUT_BITS_NB; - tab_rp_bits = (uint8_t *) malloc(nb_points * sizeof(uint8_t)); - memset(tab_rp_bits, 0, nb_points * sizeof(uint8_t)); - - /* Allocate and initialize the memory to store the registers */ - nb_points = (UT_REGISTERS_NB > UT_INPUT_REGISTERS_NB) ? - UT_REGISTERS_NB : UT_INPUT_REGISTERS_NB; - tab_rp_registers = (uint16_t *) malloc(nb_points * sizeof(uint16_t)); - memset(tab_rp_registers, 0, nb_points * sizeof(uint16_t)); - - printf("** UNIT TESTING **\n"); - - printf("\nTEST WRITE/READ:\n"); - - /** COIL BITS **/ - - /* Single */ - rc = modbus_write_bit(ctx, UT_BITS_ADDRESS, ON); - printf("1/2 modbus_write_bit: "); - if (rc == 1) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_bits(ctx, UT_BITS_ADDRESS, 1, tab_rp_bits); - printf("2/2 modbus_read_bits: "); - if (rc != 1) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - if (tab_rp_bits[0] != ON) { - printf("FAILED (%0X = != %0X)\n", tab_rp_bits[0], ON); - goto close; - } - printf("OK\n"); - /* End single */ - - /* Multiple bits */ - { - uint8_t tab_value[UT_BITS_NB]; - - modbus_set_bits_from_bytes(tab_value, 0, UT_BITS_NB, UT_BITS_TAB); - rc = modbus_write_bits(ctx, UT_BITS_ADDRESS, - UT_BITS_NB, tab_value); - printf("1/2 modbus_write_bits: "); - if (rc == UT_BITS_NB) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - } - - rc = modbus_read_bits(ctx, UT_BITS_ADDRESS, UT_BITS_NB, tab_rp_bits); - printf("2/2 modbus_read_bits: "); - if (rc != UT_BITS_NB) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - i = 0; - nb_points = UT_BITS_NB; - while (nb_points > 0) { - int nb_bits = (nb_points > 8) ? 8 : nb_points; - - value = modbus_get_byte_from_bits(tab_rp_bits, i*8, nb_bits); - if (value != UT_BITS_TAB[i]) { - printf("FAILED (%0X != %0X)\n", value, UT_BITS_TAB[i]); - goto close; - } - - nb_points -= nb_bits; - i++; - } - printf("OK\n"); - /* End of multiple bits */ - - /** DISCRETE INPUTS **/ - rc = modbus_read_input_bits(ctx, UT_INPUT_BITS_ADDRESS, - UT_INPUT_BITS_NB, tab_rp_bits); - printf("1/1 modbus_read_input_bits: "); - - if (rc != UT_INPUT_BITS_NB) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - i = 0; - nb_points = UT_INPUT_BITS_NB; - while (nb_points > 0) { - int nb_bits = (nb_points > 8) ? 8 : nb_points; - - value = modbus_get_byte_from_bits(tab_rp_bits, i*8, nb_bits); - if (value != UT_INPUT_BITS_TAB[i]) { - printf("FAILED (%0X != %0X)\n", value, UT_INPUT_BITS_TAB[i]); - goto close; - } - - nb_points -= nb_bits; - i++; - } - printf("OK\n"); - - /** HOLDING REGISTERS **/ - - /* Single register */ - rc = modbus_write_register(ctx, UT_REGISTERS_ADDRESS, 0x1234); - printf("1/2 modbus_write_register: "); - if (rc == 1) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - 1, tab_rp_registers); - printf("2/2 modbus_read_registers: "); - if (rc != 1) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - if (tab_rp_registers[0] != 0x1234) { - printf("FAILED (%0X != %0X)\n", - tab_rp_registers[0], 0x1234); - goto close; - } - printf("OK\n"); - /* End of single register */ - - /* Many registers */ - rc = modbus_write_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, UT_REGISTERS_TAB); - printf("1/5 modbus_write_registers: "); - if (rc == UT_REGISTERS_NB) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, tab_rp_registers); - printf("2/5 modbus_read_registers: "); - if (rc != UT_REGISTERS_NB) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - for (i=0; i < UT_REGISTERS_NB; i++) { - if (tab_rp_registers[i] != UT_REGISTERS_TAB[i]) { - printf("FAILED (%0X != %0X)\n", - tab_rp_registers[i], - UT_REGISTERS_TAB[i]); - goto close; - } - } - printf("OK\n"); - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - 0, tab_rp_registers); - printf("3/5 modbus_read_registers (0): "); - if (rc != 0) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - printf("OK\n"); - - nb_points = (UT_REGISTERS_NB > - UT_INPUT_REGISTERS_NB) ? - UT_REGISTERS_NB : UT_INPUT_REGISTERS_NB; - memset(tab_rp_registers, 0, nb_points * sizeof(uint16_t)); - - /* Write registers to zero from tab_rp_registers and store read registers - into tab_rp_registers. So the read registers must set to 0, except the - first one because there is an offset of 1 register on write. */ - rc = modbus_write_and_read_registers(ctx, - UT_REGISTERS_ADDRESS + 1, UT_REGISTERS_NB - 1, - tab_rp_registers, - UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, - tab_rp_registers); - printf("4/5 modbus_write_and_read_registers: "); - if (rc != UT_REGISTERS_NB) { - printf("FAILED (nb points %d != %d)\n", rc, UT_REGISTERS_NB); - goto close; - } - - if (tab_rp_registers[0] != UT_REGISTERS_TAB[0]) { - printf("FAILED (%0X != %0X)\n", - tab_rp_registers[0], UT_REGISTERS_TAB[0]); - } - - for (i=1; i < UT_REGISTERS_NB; i++) { - if (tab_rp_registers[i] != 0) { - printf("FAILED (%0X != %0X)\n", - tab_rp_registers[i], 0); - goto close; - } - } - printf("OK\n"); - - /* End of many registers */ - - - /** INPUT REGISTERS **/ - rc = modbus_read_input_registers(ctx, UT_INPUT_REGISTERS_ADDRESS, - UT_INPUT_REGISTERS_NB, - tab_rp_registers); - printf("1/1 modbus_read_input_registers: "); - if (rc != UT_INPUT_REGISTERS_NB) { - printf("FAILED (nb points %d)\n", rc); - goto close; - } - - for (i=0; i < UT_INPUT_REGISTERS_NB; i++) { - if (tab_rp_registers[i] != UT_INPUT_REGISTERS_TAB[i]) { - printf("FAILED (%0X != %0X)\n", - tab_rp_registers[i], UT_INPUT_REGISTERS_TAB[i]); - goto close; - } - } - printf("OK\n"); - - printf("\nTEST FLOATS\n"); - /** FLOAT **/ - printf("1/2 Set float: "); - modbus_set_float(UT_REAL, tab_rp_registers); - if (tab_rp_registers[1] == (UT_IREAL >> 16) && - tab_rp_registers[0] == (UT_IREAL & 0xFFFF)) { - printf("OK\n"); - } else { - printf("FAILED (%x != %x)\n", - *((uint32_t *)tab_rp_registers), UT_IREAL); - goto close; - } - - printf("2/2 Get float: "); - real = modbus_get_float(tab_rp_registers); - if (real == UT_REAL) { - printf("OK\n"); - } else { - printf("FAILED (%f != %f)\n", real, UT_REAL); - goto close; - } - - printf("\nAt this point, error messages doesn't mean the test has failed\n"); - - /** ILLEGAL DATA ADDRESS **/ - printf("\nTEST ILLEGAL DATA ADDRESS:\n"); - - /* The mapping begins at 0 and ends at address + nb_points so - * the addresses are not valid. */ - - rc = modbus_read_bits(ctx, UT_BITS_ADDRESS, - UT_BITS_NB + 1, tab_rp_bits); - printf("* modbus_read_bits: "); - if (rc == -1 && errno == EMBXILADD) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_input_bits(ctx, UT_INPUT_BITS_ADDRESS, - UT_INPUT_BITS_NB + 1, tab_rp_bits); - printf("* modbus_read_input_bits: "); - if (rc == -1 && errno == EMBXILADD) - printf("OK\n"); - else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB + 1, tab_rp_registers); - printf("* modbus_read_registers: "); - if (rc == -1 && errno == EMBXILADD) - printf("OK\n"); - else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_input_registers(ctx, UT_INPUT_REGISTERS_ADDRESS, - UT_INPUT_REGISTERS_NB + 1, - tab_rp_registers); - printf("* modbus_read_input_registers: "); - if (rc == -1 && errno == EMBXILADD) - printf("OK\n"); - else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_write_bit(ctx, UT_BITS_ADDRESS + UT_BITS_NB, ON); - printf("* modbus_write_bit: "); - if (rc == -1 && errno == EMBXILADD) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_write_bits(ctx, UT_BITS_ADDRESS + UT_BITS_NB, - UT_BITS_NB, tab_rp_bits); - printf("* modbus_write_coils: "); - if (rc == -1 && errno == EMBXILADD) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_write_registers(ctx, UT_REGISTERS_ADDRESS + UT_REGISTERS_NB, - UT_REGISTERS_NB, tab_rp_registers); - printf("* modbus_write_registers: "); - if (rc == -1 && errno == EMBXILADD) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - - /** TOO MANY DATA **/ - printf("\nTEST TOO MANY DATA ERROR:\n"); - - rc = modbus_read_bits(ctx, UT_BITS_ADDRESS, - MODBUS_MAX_READ_BITS + 1, tab_rp_bits); - printf("* modbus_read_bits: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_input_bits(ctx, UT_INPUT_BITS_ADDRESS, - MODBUS_MAX_READ_BITS + 1, tab_rp_bits); - printf("* modbus_read_input_bits: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - MODBUS_MAX_READ_REGISTERS + 1, - tab_rp_registers); - printf("* modbus_read_registers: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_read_input_registers(ctx, UT_INPUT_REGISTERS_ADDRESS, - MODBUS_MAX_READ_REGISTERS + 1, - tab_rp_registers); - printf("* modbus_read_input_registers: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - rc = modbus_write_bits(ctx, UT_BITS_ADDRESS, - MODBUS_MAX_WRITE_BITS + 1, tab_rp_bits); - printf("* modbus_write_bits: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - goto close; - printf("FAILED\n"); - } - - rc = modbus_write_registers(ctx, UT_REGISTERS_ADDRESS, - MODBUS_MAX_WRITE_REGISTERS + 1, - tab_rp_registers); - printf("* modbus_write_registers: "); - if (rc == -1 && errno == EMBMDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - /** SLAVE REPLY **/ - printf("\nTEST SLAVE REPLY:\n"); - modbus_set_slave(ctx, INVALID_SERVER_ID); - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, tab_rp_registers); - if (use_backend == RTU) { - const int RAW_REQ_LENGTH = 6; - uint8_t raw_req[] = { INVALID_SERVER_ID, 0x03, 0x00, 0x01, 0xFF, 0xFF }; - uint8_t rsp[MODBUS_TCP_MAX_ADU_LENGTH]; - - /* No response in RTU mode */ - printf("1/4-A No response from slave %d: ", INVALID_SERVER_ID); - - if (rc == -1 && errno == ETIMEDOUT) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - /* Send an invalid query with a wrong slave ID */ - modbus_send_raw_request(ctx, raw_req, - RAW_REQ_LENGTH * sizeof(uint8_t)); - rc = modbus_receive_confirmation(ctx, rsp); - - printf("1/4-B No response from slave %d with invalid request: ", - INVALID_SERVER_ID); - - if (rc == -1 && errno == ETIMEDOUT) { - printf("OK\n"); - } else { - printf("FAILED (%d)\n", rc); - goto close; - } - - } else { - /* Response in TCP mode */ - printf("1/4 Response from slave %d: ", 18); - - if (rc == UT_REGISTERS_NB) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - } - - rc = modbus_set_slave(ctx, MODBUS_BROADCAST_ADDRESS); - if (rc == -1) { - printf("Invalid broacast address\n"); - goto close; - } - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, tab_rp_registers); - printf("2/4 Reply after a broadcast query: "); - if (rc == UT_REGISTERS_NB) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - /* Restore slave */ - if (use_backend == RTU) { - modbus_set_slave(ctx, SERVER_ID); - } else { - modbus_set_slave(ctx, MODBUS_TCP_SLAVE); - } - - printf("3/4 Report slave ID: \n"); - /* tab_rp_bits is used to store bytes */ - rc = modbus_report_slave_id(ctx, tab_rp_bits); - if (rc == -1) { - printf("FAILED\n"); - goto close; - } - - /* Slave ID is an arbitraty number for libmodbus */ - if (rc > 0) { - printf("OK Slave ID is %d\n", tab_rp_bits[0]); - } else { - printf("FAILED\n"); - goto close; - } - - /* Run status indicator */ - if (rc > 1 && tab_rp_bits[1] == 0xFF) { - printf("OK Run Status Indicator is %s\n", tab_rp_bits[1] ? "ON" : "OFF"); - } else { - printf("FAILED\n"); - goto close; - } - - /* Print additional data as string */ - if (rc > 2) { - printf("Additional data: "); - for (i=2; i < rc; i++) { - printf("%c", tab_rp_bits[i]); - } - printf("\n"); - } - - /* Save original timeout */ - modbus_get_response_timeout(ctx, &old_response_timeout); - - /* Define a new and too short timeout */ - response_timeout.tv_sec = 0; - response_timeout.tv_usec = 0; - modbus_set_response_timeout(ctx, &response_timeout); - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB, tab_rp_registers); - printf("4/4 Too short timeout: "); - if (rc == -1 && errno == ETIMEDOUT) { - printf("OK\n"); - } else { - printf("FAILED (can fail on slow systems or Windows)\n"); - } - - /* Restore original timeout */ - modbus_set_response_timeout(ctx, &old_response_timeout); - - /* A wait and flush operation is done by the error recovery code of - * libmodbus */ - - /** BAD RESPONSE **/ - printf("\nTEST BAD RESPONSE ERROR:\n"); - - /* Allocate only the required space */ - tab_rp_registers_bad = (uint16_t *) malloc( - UT_REGISTERS_NB_SPECIAL * sizeof(uint16_t)); - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS, - UT_REGISTERS_NB_SPECIAL, tab_rp_registers_bad); - printf("* modbus_read_registers: "); - if (rc == -1 && errno == EMBBADDATA) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - free(tab_rp_registers_bad); - - /** MANUAL EXCEPTION **/ - printf("\nTEST MANUAL EXCEPTION:\n"); - - rc = modbus_read_registers(ctx, UT_REGISTERS_ADDRESS_SPECIAL, - UT_REGISTERS_NB, tab_rp_registers); - printf("* modbus_read_registers at special address: "); - if (rc == -1 && errno == EMBXSBUSY) { - printf("OK\n"); - } else { - printf("FAILED\n"); - goto close; - } - - /** RAW REQUEST */ - printf("\nTEST RAW REQUEST:\n"); - { - const int RAW_REQ_LENGTH = 6; - uint8_t raw_req[] = { (use_backend == RTU) ? SERVER_ID : 0xFF, - 0x03, 0x00, 0x01, 0x0, 0x05 }; - int req_length; - uint8_t rsp[MODBUS_TCP_MAX_ADU_LENGTH]; - - req_length = modbus_send_raw_request(ctx, raw_req, - RAW_REQ_LENGTH * sizeof(uint8_t)); - - printf("* modbus_send_raw_request: "); - if ((use_backend == RTU && req_length == (RAW_REQ_LENGTH + 2)) || - ((use_backend == TCP || use_backend == TCP_PI) && - req_length == (RAW_REQ_LENGTH + 6))) { - printf("OK\n"); - } else { - printf("FAILED (%d)\n", req_length); - goto close; - } - - printf("* modbus_receive_confirmation: "); - rc = modbus_receive_confirmation(ctx, rsp); - if ((use_backend == RTU && rc == 15) || - ((use_backend == TCP || use_backend == TCP_PI) && - rc == 19)) { - printf("OK\n"); - } else { - printf("FAILED (%d)\n", rc); - goto close; - } - } - - printf("\nALL TESTS PASS WITH SUCCESS.\n"); - -close: - /* Free the memory */ - free(tab_rp_bits); - free(tab_rp_registers); - - /* Close the connection */ - modbus_close(ctx); - modbus_free(ctx); - - return 0; -} diff --git a/tests/unit-test-client.o b/tests/unit-test-client.o Binary files differdeleted file mode 100644 index 8358604..0000000 --- a/tests/unit-test-client.o +++ /dev/null diff --git a/tests/unit-test-server b/tests/unit-test-server deleted file mode 100755 index a8d1c0e..0000000 --- a/tests/unit-test-server +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# unit-test-server - temporary wrapper script for .libs/unit-test-server -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The unit-test-server program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file unit-test-server.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "unit-test-server:unit-test-server:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "unit-test-server:unit-test-server:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "unit-test-server:unit-test-server:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'unit-test-server' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/unit-test-server.c b/tests/unit-test-server.c deleted file mode 100644 index 9a986c5..0000000 --- a/tests/unit-test-server.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <modbus.h> - -#include "unit-test.h" - -enum { - TCP, - TCP_PI, - RTU -}; - -int main(int argc, char*argv[]) -{ - int socket; - modbus_t *ctx; - modbus_mapping_t *mb_mapping; - int rc; - int i; - int use_backend; - uint8_t *query; - int header_length; - - if (argc > 1) { - if (strcmp(argv[1], "tcp") == 0) { - use_backend = TCP; - } else if (strcmp(argv[1], "tcppi") == 0) { - use_backend = TCP_PI; - } else if (strcmp(argv[1], "rtu") == 0) { - use_backend = RTU; - } else { - printf("Usage:\n %s [tcp|tcppi|rtu] - Modbus server for unit testing\n\n", argv[0]); - return -1; - } - } else { - /* By default */ - use_backend = TCP; - } - - if (use_backend == TCP) { - ctx = modbus_new_tcp("127.0.0.1", 1502); - query = malloc(MODBUS_TCP_MAX_ADU_LENGTH); - } else if (use_backend == TCP_PI) { - ctx = modbus_new_tcp_pi("::0", "1502"); - query = malloc(MODBUS_TCP_MAX_ADU_LENGTH); - } else { - ctx = modbus_new_rtu("/dev/ttyUSB0", 115200, 'N', 8, 1); - modbus_set_slave(ctx, SERVER_ID); - query = malloc(MODBUS_RTU_MAX_ADU_LENGTH); - } - header_length = modbus_get_header_length(ctx); - - modbus_set_debug(ctx, TRUE); - - mb_mapping = modbus_mapping_new( - UT_BITS_ADDRESS + UT_BITS_NB, - UT_INPUT_BITS_ADDRESS + UT_INPUT_BITS_NB, - UT_REGISTERS_ADDRESS + UT_REGISTERS_NB, - UT_INPUT_REGISTERS_ADDRESS + UT_INPUT_REGISTERS_NB); - if (mb_mapping == NULL) { - fprintf(stderr, "Failed to allocate the mapping: %s\n", - modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - - /* Examples from PI_MODBUS_300.pdf. - Only the read-only input values are assigned. */ - - /** INPUT STATUS **/ - modbus_set_bits_from_bytes(mb_mapping->tab_input_bits, - UT_INPUT_BITS_ADDRESS, UT_INPUT_BITS_NB, - UT_INPUT_BITS_TAB); - - /** INPUT REGISTERS **/ - for (i=0; i < UT_INPUT_REGISTERS_NB; i++) { - mb_mapping->tab_input_registers[UT_INPUT_REGISTERS_ADDRESS+i] = - UT_INPUT_REGISTERS_TAB[i];; - } - - if (use_backend == TCP) { - socket = modbus_tcp_listen(ctx, 1); - modbus_tcp_accept(ctx, &socket); - } else if (use_backend == TCP_PI) { - socket = modbus_tcp_pi_listen(ctx, 1); - modbus_tcp_pi_accept(ctx, &socket); - } else { - rc = modbus_connect(ctx); - if (rc == -1) { - fprintf(stderr, "Unable to connect %s\n", modbus_strerror(errno)); - modbus_free(ctx); - return -1; - } - } - - for (;;) { - rc = modbus_receive(ctx, query); - if (rc == -1) { - /* Connection closed by the client or error */ - break; - } - - /* Read holding registers */ - if (query[header_length] == 0x03) { - if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 3) - == UT_REGISTERS_NB_SPECIAL) { - printf("Set an incorrect number of values\n"); - MODBUS_SET_INT16_TO_INT8(query, header_length + 3, - UT_REGISTERS_NB_SPECIAL - 1); - } else if (MODBUS_GET_INT16_FROM_INT8(query, header_length + 1) - == UT_REGISTERS_ADDRESS_SPECIAL) { - printf("Reply to this special register address by an exception\n"); - modbus_reply_exception(ctx, query, - MODBUS_EXCEPTION_SLAVE_OR_SERVER_BUSY); - continue; - } - } - - rc = modbus_reply(ctx, query, rc, mb_mapping); - if (rc == -1) { - break; - } - } - - printf("Quit the loop: %s\n", modbus_strerror(errno)); - - if (use_backend == TCP) { - close(socket); - } - modbus_mapping_free(mb_mapping); - free(query); - modbus_free(ctx); - - return 0; -} diff --git a/tests/unit-test-server.o b/tests/unit-test-server.o Binary files differdeleted file mode 100644 index 7d3a2de..0000000 --- a/tests/unit-test-server.o +++ /dev/null diff --git a/tests/unit-test.h b/tests/unit-test.h deleted file mode 100644 index 78575c1..0000000 --- a/tests/unit-test.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright © 2008-2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef _UNIT_TEST_H_ -#define _UNIT_TEST_H_ - -#include <config.h> - -#ifdef HAVE_INTTYPES_H -#include <inttypes.h> -#endif -#ifdef HAVE_STDINT_H -# ifndef _MSC_VER -# include <stdint.h> -# else -# include "stdint.h" -# endif -#endif - -#define SERVER_ID 17 -#define INVALID_SERVER_ID 18 - -const uint16_t UT_BITS_ADDRESS = 0x13; -const uint16_t UT_BITS_NB = 0x25; -const uint8_t UT_BITS_TAB[] = { 0xCD, 0x6B, 0xB2, 0x0E, 0x1B }; - -const uint16_t UT_INPUT_BITS_ADDRESS = 0xC4; -const uint16_t UT_INPUT_BITS_NB = 0x16; -const uint8_t UT_INPUT_BITS_TAB[] = { 0xAC, 0xDB, 0x35 }; - -const uint16_t UT_REGISTERS_ADDRESS = 0x6B; -/* Raise a manual exception when this adress is used for the first byte */ -const uint16_t UT_REGISTERS_ADDRESS_SPECIAL = 0x6C; -const uint16_t UT_REGISTERS_NB = 0x3; -const uint16_t UT_REGISTERS_TAB[] = { 0x022B, 0x0001, 0x0064 }; -/* If the following value is used, a bad response is sent. - It's better to test with a lower value than - UT_REGISTERS_NB_POINTS to try to raise a segfault. */ -const uint16_t UT_REGISTERS_NB_SPECIAL = 0x2; - -const uint16_t UT_INPUT_REGISTERS_ADDRESS = 0x08; -const uint16_t UT_INPUT_REGISTERS_NB = 0x1; -const uint16_t UT_INPUT_REGISTERS_TAB[] = { 0x000A }; - -const float UT_REAL = 916.540649; -const uint32_t UT_IREAL = 0x4465229a; - -#endif /* _UNIT_TEST_H_ */ diff --git a/tests/version b/tests/version deleted file mode 100755 index 7fa8075..0000000 --- a/tests/version +++ /dev/null @@ -1,225 +0,0 @@ -#! /bin/bash - -# version - temporary wrapper script for .libs/version -# Generated by libtool (GNU libtool) 2.4 Debian-2.4-3 -# -# The version program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command="(cd /home/jmccrohan/bin/libmodbus/tests; { test -z \"\${LIBRARY_PATH+set}\" || unset LIBRARY_PATH || { LIBRARY_PATH=; export LIBRARY_PATH; }; }; { test -z \"\${COMPILER_PATH+set}\" || unset COMPILER_PATH || { COMPILER_PATH=; export COMPILER_PATH; }; }; { test -z \"\${GCC_EXEC_PREFIX+set}\" || unset GCC_EXEC_PREFIX || { GCC_EXEC_PREFIX=; export GCC_EXEC_PREFIX; }; }; { test -z \"\${LD_RUN_PATH+set}\" || unset LD_RUN_PATH || { LD_RUN_PATH=; export LD_RUN_PATH; }; }; { test -z \"\${LD_LIBRARY_PATH+set}\" || unset LD_LIBRARY_PATH || { LD_LIBRARY_PATH=; export LD_LIBRARY_PATH; }; }; PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11; export PATH; gcc -g -O2 -g -O2 -Wall -Werror -o \$progdir/\$file version.o ../src/.libs/libmodbus.so -Wl,-rpath -Wl,/home/jmccrohan/bin/libmodbus/src/.libs)" - -# This environment variable determines our operation mode. -if test "$libtool_install_magic" = "%%%MAGIC variable%%%"; then - # install mode needs the following variables: - generated_by_libtool_version='2.4' - notinst_deplibs=' ../src/libmodbus.la' -else - # When we are sourced in execute mode, $file and $ECHO are already set. - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - file="$0" - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - ECHO="printf %s\\n" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string --lt- -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's ../libtool value, followed by no. -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=$0 - shift - for lt_opt - do - case "$lt_opt" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%/[^/]*$%%'` - test "X$lt_dump_D" = "X$lt_script_arg0" && lt_dump_D=. - lt_dump_F=`$ECHO "X$lt_script_arg0" | /bin/sed -e 's/^X//' -e 's%^.*/%%'` - cat "$lt_dump_D/$lt_dump_F" - exit 0 - ;; - --lt-*) - $ECHO "Unrecognized --lt- option: '$lt_opt'" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n "$lt_option_debug"; then - echo "version:version:${LINENO}: libtool wrapper (GNU libtool) 2.4 Debian-2.4-3" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - $ECHO "version:version:${LINENO}: newargv[$lt_dump_args_N]: $lt_arg" - lt_dump_args_N=`expr $lt_dump_args_N + 1` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ - - if test -n "$lt_option_debug"; then - $ECHO "version:version:${LINENO}: newargv[0]: $progdir/$program" 1>&2 - func_lt_dump_args ${1+"$@"} 1>&2 - fi - exec "$progdir/$program" ${1+"$@"} - - $ECHO "$0: cannot exec $program $*" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from $@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case $lt_wr_arg in - --lt-*) ;; - *) set x "$@" "$lt_wr_arg"; shift;; - esac - shift - done - func_exec_program_core ${1+"$@"} -} - - # Parse options - func_parse_lt_options "$0" ${1+"$@"} - - # Find the directory that this script lives in. - thisdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - test "x$thisdir" = "x$file" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=`ls -ld "$file" | /bin/sed -n 's/.*-> //p'` - while test -n "$file"; do - destdir=`$ECHO "$file" | /bin/sed 's%/[^/]*$%%'` - - # If there was a directory component, then change thisdir. - if test "x$destdir" != "x$file"; then - case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) thisdir="$destdir" ;; - *) thisdir="$thisdir/$destdir" ;; - esac - fi - - file=`$ECHO "$file" | /bin/sed 's%^.*/%%'` - file=`ls -ld "$thisdir/$file" | /bin/sed -n 's/.*-> //p'` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=no - if test "$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR" = "yes"; then - # special case for '.' - if test "$thisdir" = "."; then - thisdir=`pwd` - fi - # remove .libs from thisdir - case "$thisdir" in - *[\\/].libs ) thisdir=`$ECHO "$thisdir" | /bin/sed 's%[\\/][^\\/]*$%%'` ;; - .libs ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=`cd "$thisdir" && pwd` - test -n "$absdir" && thisdir="$absdir" - - program=lt-'version' - progdir="$thisdir/.libs" - - if test ! -f "$progdir/$program" || - { file=`ls -1dt "$progdir/$program" "$progdir/../$program" 2>/dev/null | /bin/sed 1q`; \ - test "X$file" != "X$progdir/$program"; }; then - - file="$$-$program" - - if test ! -d "$progdir"; then - mkdir "$progdir" - else - rm -f "$progdir/$file" - fi - - # relink executable if necessary - if test -n "$relink_command"; then - if relink_command_output=`eval $relink_command 2>&1`; then : - else - printf %s\n "$relink_command_output" >&2 - rm -f "$progdir/$file" - exit 1 - fi - fi - - mv -f "$progdir/$file" "$progdir/$program" 2>/dev/null || - { rm -f "$progdir/$program"; - mv -f "$progdir/$file" "$progdir/$program"; } - rm -f "$progdir/$file" - fi - - if test -f "$progdir/$program"; then - if test "$libtool_execute_magic" != "%%%MAGIC variable%%%"; then - # Run the actual program with our arguments. - func_exec_program ${1+"$@"} - fi - else - # The program doesn't exist. - $ECHO "$0: error: \`$progdir/$program' does not exist" 1>&2 - $ECHO "This script is just a wrapper for $program." 1>&2 - $ECHO "See the libtool documentation for more information." 1>&2 - exit 1 - fi -fi diff --git a/tests/version.c b/tests/version.c deleted file mode 100644 index e0fc569..0000000 --- a/tests/version.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright © 2010 Stéphane Raimbault <stephane.raimbault@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdio.h> -#include <modbus.h> - -int main(void) -{ - printf("Compiled with libmodbus version %s\n", LIBMODBUS_VERSION_STRING); - printf("Linked with libmodbus version %d.%d.%d\n", - libmodbus_version_major, libmodbus_version_minor, libmodbus_version_micro); - - if (LIBMODBUS_VERSION_CHECK(2, 1, 0)) { - printf("The functions to read/write float values are available (2.1.0).\n"); - } - - if (LIBMODBUS_VERSION_CHECK(2, 1, 1)) { - printf("Oh gosh, brand new API (2.1.1)!\n"); - } - - return 0; -} diff --git a/tests/version.o b/tests/version.o Binary files differdeleted file mode 100644 index fa29586..0000000 --- a/tests/version.o +++ /dev/null |