aboutsummaryrefslogtreecommitdiff
path: root/contrib/ntp/sntp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/sntp/tests')
-rw-r--r--contrib/ntp/sntp/tests/Makefile.am256
-rw-r--r--contrib/ntp/sntp/tests/Makefile.in1611
-rw-r--r--contrib/ntp/sntp/tests/crypto.c163
-rw-r--r--contrib/ntp/sntp/tests/data/debug-input-lfp-bin3
-rw-r--r--contrib/ntp/sntp/tests/data/debug-input-lfp-dec3
-rw-r--r--contrib/ntp/sntp/tests/data/debug-input-pkt8
-rw-r--r--contrib/ntp/sntp/tests/data/key-test-ascii2
-rw-r--r--contrib/ntp/sntp/tests/data/key-test-comments3
-rw-r--r--contrib/ntp/sntp/tests/data/key-test-empty0
-rw-r--r--contrib/ntp/sntp/tests/data/key-test-hex3
-rw-r--r--contrib/ntp/sntp/tests/data/key-test-invalid-hex2
-rw-r--r--contrib/ntp/sntp/tests/data/kod-expected-multiple3
-rw-r--r--contrib/ntp/sntp/tests/data/kod-expected-single1
-rw-r--r--contrib/ntp/sntp/tests/data/kod-test-blanks6
-rw-r--r--contrib/ntp/sntp/tests/data/kod-test-correct2
-rw-r--r--contrib/ntp/sntp/tests/data/kod-test-empty0
-rw-r--r--contrib/ntp/sntp/tests/fileHandlingTest.c97
-rw-r--r--contrib/ntp/sntp/tests/fileHandlingTest.h.in26
-rw-r--r--contrib/ntp/sntp/tests/keyFile.c190
-rw-r--r--contrib/ntp/sntp/tests/kodDatabase.c141
-rw-r--r--contrib/ntp/sntp/tests/kodFile.c156
-rw-r--r--contrib/ntp/sntp/tests/networking.c7
-rw-r--r--contrib/ntp/sntp/tests/packetHandling.c313
-rw-r--r--contrib/ntp/sntp/tests/packetProcessing.c457
-rw-r--r--contrib/ntp/sntp/tests/run-crypto.c65
-rw-r--r--contrib/ntp/sntp/tests/run-keyFile.c64
-rw-r--r--contrib/ntp/sntp/tests/run-kodDatabase.c67
-rw-r--r--contrib/ntp/sntp/tests/run-kodFile.c66
-rw-r--r--contrib/ntp/sntp/tests/run-networking.c52
-rw-r--r--contrib/ntp/sntp/tests/run-packetHandling.c78
-rw-r--r--contrib/ntp/sntp/tests/run-packetProcessing.c89
-rw-r--r--contrib/ntp/sntp/tests/run-t-log.c57
-rw-r--r--contrib/ntp/sntp/tests/run-utilities.c69
-rw-r--r--contrib/ntp/sntp/tests/sntptest.c33
-rw-r--r--contrib/ntp/sntp/tests/sntptest.h11
-rw-r--r--contrib/ntp/sntp/tests/t-log.c87
-rwxr-xr-xcontrib/ntp/sntp/tests/tests-runner13
-rw-r--r--contrib/ntp/sntp/tests/utilities.c205
38 files changed, 4409 insertions, 0 deletions
diff --git a/contrib/ntp/sntp/tests/Makefile.am b/contrib/ntp/sntp/tests/Makefile.am
new file mode 100644
index 000000000000..0e14a87b176e
--- /dev/null
+++ b/contrib/ntp/sntp/tests/Makefile.am
@@ -0,0 +1,256 @@
+NULL =
+BUILT_SOURCES =
+EXTRA_PROGRAMS =
+
+CLEANFILES = \
+ debug-output-lfp-bin \
+ debug-output-lfp-dec \
+ debug-output-pkt \
+ kod-output-blank \
+ kod-output-multiple \
+ kod-output-single \
+ testLogfile.log \
+ testLogfile2.log \
+ $(NULL)
+
+DISTCLEANFILES = \
+ kod-output-blank \
+ kod-output-single \
+ kod-output-multiple \
+ testLogfile.log \
+ testLogfile2.log \
+ $(NULL)
+
+std_unity_list = \
+ $(srcdir)/../unity/auto/generate_test_runner.rb \
+ $(NULL)
+
+run_unity = cd $(srcdir) && ruby ../unity/auto/generate_test_runner.rb
+
+# Use EXTRA_PROGRAMS for test files that are under development but
+# not production-ready
+#EXTRA_PROGRAMS += test-packetHandling test-packetProcessing
+
+check_PROGRAMS = \
+ test-crypto \
+ test-keyFile \
+ test-log \
+ test-networking \
+ test-packetHandling \
+ test-packetProcessing \
+ test-utilities \
+ $(NULL)
+
+if BUILD_TEST_KODDATABASE
+check_PROGRAMS += test-kodDatabase
+endif
+
+if BUILD_TEST_KODFILE
+check_PROGRAMS += test-kodFile
+endif
+
+noinst_HEADERS = \
+ sntptest.h \
+ $(NULL)
+
+dist_check_SCRIPTS = tests-runner
+
+EXTRA_DIST = \
+ data/debug-input-lfp-bin \
+ data/debug-input-lfp-dec \
+ data/debug-input-pkt \
+ data/key-test-ascii \
+ data/key-test-comments \
+ data/key-test-empty \
+ data/key-test-hex \
+ data/key-test-invalid-hex \
+ data/kod-expected-multiple \
+ data/kod-expected-single \
+ data/kod-test-blanks \
+ data/kod-test-correct \
+ data/kod-test-empty \
+ $(NULL)
+
+CLEANFILES += \
+ data/kod-output-multiple \
+ data/kod-output-single \
+ data/debug-output-pkt \
+ data/debug-output-lfp-dec \
+ data/kod-output-blank \
+ data/debug-output-lfp-bin \
+ $(NULL)
+
+#split into LDADD and tests_LDADD?
+base_LDADD = \
+ ../libsntp.a \
+ $(LIBOPTS_LDADD) \
+ $(LDADD_LIBEVENT) \
+ $(top_builddir)/../libntp/libntp.a \
+ $(LDADD_LIBNTP) \
+ $(LDADD_NTP) \
+ $(NULL)
+
+LDADD = \
+ $(base_LDADD) \
+ $(top_builddir)/unity/libunity.a \
+ $(LIBM) \
+ $(NULL)
+
+AM_CFLAGS = $(CFLAGS_NTP)
+
+AM_CPPFLAGS = $(SNTP_INCS)
+AM_CPPFLAGS += -I$(srcdir)/..
+AM_CPPFLAGS += -I$(top_srcdir)/../tests
+AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
+AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
+AM_CPPFLAGS += $(CPPFLAGS_NTP)
+AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
+#AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
+AM_CPPFLAGS += -I$(top_srcdir)/unity
+
+AM_LDFLAGS = $(LDFLAGS_NTP)
+
+BUILT_SOURCES += \
+ $(srcdir)/run-crypto.c \
+ $(srcdir)/run-keyFile.c \
+ $(srcdir)/run-kodDatabase.c \
+ $(srcdir)/run-kodFile.c \
+ $(srcdir)/run-networking.c \
+ $(srcdir)/run-packetHandling.c \
+ $(srcdir)/run-packetProcessing.c \
+ $(srcdir)/run-utilities.c \
+ $(NULL)
+
+test_networking_SOURCES = \
+ networking.c \
+ run-networking.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_packetHandling_SOURCES = \
+ packetHandling.c \
+ run-packetHandling.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_kodDatabase_SOURCES = \
+ kodDatabase.c \
+ run-kodDatabase.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_keyFile_SOURCES = \
+ fileHandlingTest.c \
+ keyFile.c \
+ run-keyFile.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_kodFile_SOURCES = \
+ fileHandlingTest.c \
+ kodFile.c \
+ run-kodFile.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_packetProcessing_SOURCES = \
+ packetProcessing.c \
+ run-packetProcessing.c \
+ sntptest.c \
+ $(NULL)
+
+test_utilities_SOURCES = \
+ fileHandlingTest.c \
+ utilities.c \
+ run-utilities.c \
+ $(NULL)
+
+test_crypto_CFLAGS = \
+ $(CFLAGS_LIBEVENT) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+test_crypto_SOURCES = \
+ crypto.c \
+ run-crypto.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_log_SOURCES = \
+ t-log.c \
+ run-t-log.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+
+$(srcdir)/run-kodFile.c: $(srcdir)/kodFile.c $(std_unity_list)
+ $(run_unity) kodFile.c run-kodFile.c
+
+$(srcdir)/run-keyFile.c: $(srcdir)/keyFile.c $(std_unity_list)
+ $(run_unity) keyFile.c run-keyFile.c
+
+$(srcdir)/run-kodDatabase.c: $(srcdir)/kodDatabase.c $(std_unity_list)
+ $(run_unity) kodDatabase.c run-kodDatabase.c
+
+$(srcdir)/run-networking.c: $(srcdir)/networking.c $(std_unity_list)
+ $(run_unity) networking.c run-networking.c
+
+$(srcdir)/run-packetProcessing.c: $(srcdir)/packetProcessing.c $(std_unity_list)
+ $(run_unity) packetProcessing.c run-packetProcessing.c
+
+$(srcdir)/run-packetHandling.c: $(srcdir)/packetHandling.c $(std_unity_list)
+ $(run_unity) packetHandling.c run-packetHandling.c
+
+$(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list)
+ $(run_unity) utilities.c run-utilities.c
+
+$(srcdir)/run-crypto.c: $(srcdir)/crypto.c $(std_unity_list)
+ $(run_unity) crypto.c run-crypto.c
+
+$(srcdir)/run-t-log.c: $(srcdir)/t-log.c $(std_unity_list)
+ $(run_unity) t-log.c run-t-log.c
+
+
+#$(srcdir)/../version.c: $(srcdir)/../version.c
+# gcc -o version.o ../version.c
+
+TESTS =
+
+if !NTP_CROSSCOMPILE
+TESTS += $(check_PROGRAMS)
+endif
+#if !NTP_CROSSCOMPILE
+#TESTS += tests-runner
+#endif
+
+## ensure ../libsntp.a is built
+
+BUILT_SOURCES += check-libsntp
+CLEANFILES += check-libsntp
+
+check-libsntp: ../libsntp.a
+ @echo stamp > $@
+
+../libsntp.a:
+ cd .. && $(MAKE) $(AM_MAKEFLAGS) libsntp.a
+
+## check-libntp.mf - automake fragment
+## slightly adapted for deeper directory
+
+BUILT_SOURCES += check-libntp check-libunity
+CLEANFILES += check-libntp check-libunity
+
+check-libntp: ../../libntp/libntp.a
+ @echo stamp > $@
+
+../../libntp/libntp.a:
+ cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
+
+check-libunity: ../unity/libunity.a
+ @echo stamp > $@
+
+../unity/libunity.a:
+ cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a
+
+include $(top_srcdir)/depsver.mf
+include $(top_srcdir)/includes.mf
diff --git a/contrib/ntp/sntp/tests/Makefile.in b/contrib/ntp/sntp/tests/Makefile.in
new file mode 100644
index 000000000000..e55794787465
--- /dev/null
+++ b/contrib/ntp/sntp/tests/Makefile.in
@@ -0,0 +1,1611 @@
+# Makefile.in generated by automake 1.15 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2014 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = { \
+ if test -z '$(MAKELEVEL)'; then \
+ false; \
+ elif test -n '$(MAKE_HOST)'; then \
+ true; \
+ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
+ true; \
+ else \
+ false; \
+ fi; \
+}
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+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@
+EXTRA_PROGRAMS =
+check_PROGRAMS = test-crypto$(EXEEXT) test-keyFile$(EXEEXT) \
+ test-log$(EXEEXT) test-networking$(EXEEXT) \
+ test-packetHandling$(EXEEXT) test-packetProcessing$(EXEEXT) \
+ test-utilities$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
+ $(am__EXEEXT_3)
+@BUILD_TEST_KODDATABASE_TRUE@am__append_1 = test-kodDatabase
+@BUILD_TEST_KODFILE_TRUE@am__append_2 = test-kodFile
+@NTP_CROSSCOMPILE_FALSE@am__append_3 = $(check_PROGRAMS)
+subdir = tests
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \
+ $(top_srcdir)/libopts/m4/stdnoreturn.m4 \
+ $(top_srcdir)/m4/hms_search_lib.m4 $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/m4/ntp_cacheversion.m4 \
+ $(top_srcdir)/m4/ntp_compiler.m4 \
+ $(top_srcdir)/m4/ntp_crosscompile.m4 \
+ $(top_srcdir)/m4/ntp_debug.m4 $(top_srcdir)/m4/ntp_dir_sep.m4 \
+ $(top_srcdir)/m4/ntp_facilitynames.m4 \
+ $(top_srcdir)/m4/ntp_googletest.m4 \
+ $(top_srcdir)/m4/ntp_ipv6.m4 $(top_srcdir)/m4/ntp_lib_m.m4 \
+ $(top_srcdir)/m4/ntp_libevent.m4 \
+ $(top_srcdir)/m4/ntp_libntp.m4 \
+ $(top_srcdir)/m4/ntp_lineeditlibs.m4 \
+ $(top_srcdir)/m4/ntp_locinfo.m4 \
+ $(top_srcdir)/m4/ntp_openssl.m4 \
+ $(top_srcdir)/m4/ntp_pkg_config.m4 \
+ $(top_srcdir)/m4/ntp_prog_cc.m4 $(top_srcdir)/m4/ntp_sntp.m4 \
+ $(top_srcdir)/m4/ntp_sysexits.m4 \
+ $(top_srcdir)/m4/ntp_unitytest.m4 \
+ $(top_srcdir)/m4/ntp_ver_suffix.m4 \
+ $(top_srcdir)/m4/openldap-thread-check.m4 \
+ $(top_srcdir)/m4/openldap.m4 $(top_srcdir)/m4/os_cflags.m4 \
+ $(top_srcdir)/m4/snprintf.m4 \
+ $(top_srcdir)/m4/sntp_problemtests.m4 \
+ $(top_srcdir)/m4/version.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+DIST_COMMON = $(srcdir)/Makefile.am $(dist_check_SCRIPTS) \
+ $(noinst_HEADERS) $(am__DIST_COMMON)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = fileHandlingTest.h
+CONFIG_CLEAN_VPATH_FILES =
+am__EXEEXT_1 =
+@BUILD_TEST_KODDATABASE_TRUE@am__EXEEXT_2 = test-kodDatabase$(EXEEXT)
+@BUILD_TEST_KODFILE_TRUE@am__EXEEXT_3 = test-kodFile$(EXEEXT)
+am__objects_1 =
+am_test_crypto_OBJECTS = test_crypto-crypto.$(OBJEXT) \
+ test_crypto-run-crypto.$(OBJEXT) test_crypto-version.$(OBJEXT) \
+ $(am__objects_1)
+test_crypto_OBJECTS = $(am_test_crypto_OBJECTS)
+test_crypto_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+am__DEPENDENCIES_2 = ../libsntp.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1) $(top_builddir)/../libntp/libntp.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+test_crypto_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+test_crypto_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_crypto_CFLAGS) \
+ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_test_keyFile_OBJECTS = fileHandlingTest.$(OBJEXT) keyFile.$(OBJEXT) \
+ run-keyFile.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+test_keyFile_OBJECTS = $(am_test_keyFile_OBJECTS)
+test_keyFile_LDADD = $(LDADD)
+test_keyFile_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_kodDatabase_OBJECTS = kodDatabase.$(OBJEXT) \
+ run-kodDatabase.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+test_kodDatabase_OBJECTS = $(am_test_kodDatabase_OBJECTS)
+test_kodDatabase_LDADD = $(LDADD)
+test_kodDatabase_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_kodFile_OBJECTS = fileHandlingTest.$(OBJEXT) kodFile.$(OBJEXT) \
+ run-kodFile.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+test_kodFile_OBJECTS = $(am_test_kodFile_OBJECTS)
+test_kodFile_LDADD = $(LDADD)
+test_kodFile_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_log_OBJECTS = t-log.$(OBJEXT) run-t-log.$(OBJEXT) \
+ version.$(OBJEXT) $(am__objects_1)
+test_log_OBJECTS = $(am_test_log_OBJECTS)
+test_log_LDADD = $(LDADD)
+test_log_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_networking_OBJECTS = networking.$(OBJEXT) \
+ run-networking.$(OBJEXT) version.$(OBJEXT) $(am__objects_1)
+test_networking_OBJECTS = $(am_test_networking_OBJECTS)
+test_networking_LDADD = $(LDADD)
+test_networking_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_packetHandling_OBJECTS = packetHandling.$(OBJEXT) \
+ run-packetHandling.$(OBJEXT) version.$(OBJEXT) \
+ $(am__objects_1)
+test_packetHandling_OBJECTS = $(am_test_packetHandling_OBJECTS)
+test_packetHandling_LDADD = $(LDADD)
+test_packetHandling_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_packetProcessing_OBJECTS = packetProcessing.$(OBJEXT) \
+ run-packetProcessing.$(OBJEXT) sntptest.$(OBJEXT) \
+ $(am__objects_1)
+test_packetProcessing_OBJECTS = $(am_test_packetProcessing_OBJECTS)
+test_packetProcessing_LDADD = $(LDADD)
+test_packetProcessing_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_test_utilities_OBJECTS = fileHandlingTest.$(OBJEXT) \
+ utilities.$(OBJEXT) run-utilities.$(OBJEXT) $(am__objects_1)
+test_utilities_OBJECTS = $(am_test_utilities_OBJECTS)
+test_utilities_LDADD = $(LDADD)
+test_utilities_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/libevent/build-aux/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_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+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_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(test_crypto_SOURCES) $(test_keyFile_SOURCES) \
+ $(test_kodDatabase_SOURCES) $(test_kodFile_SOURCES) \
+ $(test_log_SOURCES) $(test_networking_SOURCES) \
+ $(test_packetHandling_SOURCES) \
+ $(test_packetProcessing_SOURCES) $(test_utilities_SOURCES)
+DIST_SOURCES = $(test_crypto_SOURCES) $(test_keyFile_SOURCES) \
+ $(test_kodDatabase_SOURCES) $(test_kodFile_SOURCES) \
+ $(test_log_SOURCES) $(test_networking_SOURCES) \
+ $(test_packetHandling_SOURCES) \
+ $(test_packetProcessing_SOURCES) $(test_utilities_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+HEADERS = $(noinst_HEADERS)
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+LOG_DRIVER = $(SHELL) $(top_srcdir)/libevent/build-aux/test-driver
+LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) \
+ $(top_srcdir)/libevent/build-aux/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__DIST_COMMON = $(srcdir)/Makefile.in \
+ $(srcdir)/fileHandlingTest.h.in $(top_srcdir)/depsver.mf \
+ $(top_srcdir)/includes.mf \
+ $(top_srcdir)/libevent/build-aux/depcomp \
+ $(top_srcdir)/libevent/build-aux/test-driver
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BUILD_THREAD = @BUILD_THREAD@
+CALC_TICKADJ_DB = @CALC_TICKADJ_DB@
+CALC_TICKADJ_DL = @CALC_TICKADJ_DL@
+CALC_TICKADJ_DS = @CALC_TICKADJ_DS@
+CALC_TICKADJ_MS = @CALC_TICKADJ_MS@
+CALC_TICKADJ_NI = @CALC_TICKADJ_NI@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@
+CFLAGS_NTP = @CFLAGS_NTP@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPPFLAGS_LIBEVENT = @CPPFLAGS_LIBEVENT@
+CPPFLAGS_NTP = @CPPFLAGS_NTP@
+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@
+EDITLINE_LIBS = @EDITLINE_LIBS@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+GTEST_CONFIG = @GTEST_CONFIG@
+GTEST_CPPFLAGS = @GTEST_CPPFLAGS@
+GTEST_CXXFLAGS = @GTEST_CXXFLAGS@
+GTEST_LDFLAGS = @GTEST_LDFLAGS@
+GTEST_LIBS = @GTEST_LIBS@
+HAVE_INLINE = @HAVE_INLINE@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDADD_LIBEVENT = @LDADD_LIBEVENT@
+LDADD_LIBNTP = @LDADD_LIBNTP@
+LDADD_LIBUTIL = @LDADD_LIBUTIL@
+LDADD_NTP = @LDADD_NTP@
+LDFLAGS = @LDFLAGS@
+LDFLAGS_NTP = @LDFLAGS_NTP@
+LIBISC_PTHREADS_NOTHREADS = @LIBISC_PTHREADS_NOTHREADS@
+LIBM = @LIBM@
+LIBOBJS = @LIBOBJS@
+LIBOPTS_CFLAGS = @LIBOPTS_CFLAGS@
+LIBOPTS_DIR = @LIBOPTS_DIR@
+LIBOPTS_LDADD = @LIBOPTS_LDADD@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIBTOOL_DEPS = @LIBTOOL_DEPS@
+LIB_SYSLOG = @LIB_SYSLOG@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTHREAD_LIBS = @LTHREAD_LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MANTAGFMT = @MANTAGFMT@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NTPDATE_DB = @NTPDATE_DB@
+NTPDATE_DL = @NTPDATE_DL@
+NTPDATE_DS = @NTPDATE_DS@
+NTPDATE_MS = @NTPDATE_MS@
+NTPDATE_NI = @NTPDATE_NI@
+NTPDC_DB = @NTPDC_DB@
+NTPDC_DL = @NTPDC_DL@
+NTPDC_DS = @NTPDC_DS@
+NTPDC_MS = @NTPDC_MS@
+NTPDC_NI = @NTPDC_NI@
+NTPDSIM_DB = @NTPDSIM_DB@
+NTPDSIM_DL = @NTPDSIM_DL@
+NTPDSIM_DS = @NTPDSIM_DS@
+NTPDSIM_MS = @NTPDSIM_MS@
+NTPDSIM_NI = @NTPDSIM_NI@
+NTPD_DB = @NTPD_DB@
+NTPD_DL = @NTPD_DL@
+NTPD_DS = @NTPD_DS@
+NTPD_MS = @NTPD_MS@
+NTPD_NI = @NTPD_NI@
+NTPQ_DB = @NTPQ_DB@
+NTPQ_DL = @NTPQ_DL@
+NTPQ_DS = @NTPQ_DS@
+NTPQ_MS = @NTPQ_MS@
+NTPQ_NI = @NTPQ_NI@
+NTPSNMPD_DB = @NTPSNMPD_DB@
+NTPSNMPD_DL = @NTPSNMPD_DL@
+NTPSNMPD_DS = @NTPSNMPD_DS@
+NTPSNMPD_MS = @NTPSNMPD_MS@
+NTPSNMPD_NI = @NTPSNMPD_NI@
+NTPSWEEP_DB = @NTPSWEEP_DB@
+NTPSWEEP_DL = @NTPSWEEP_DL@
+NTPSWEEP_DS = @NTPSWEEP_DS@
+NTPSWEEP_MS = @NTPSWEEP_MS@
+NTPSWEEP_NI = @NTPSWEEP_NI@
+NTPTIME_DB = @NTPTIME_DB@
+NTPTIME_DL = @NTPTIME_DL@
+NTPTIME_DS = @NTPTIME_DS@
+NTPTIME_MS = @NTPTIME_MS@
+NTPTIME_NI = @NTPTIME_NI@
+NTPTRACE_DB = @NTPTRACE_DB@
+NTPTRACE_DL = @NTPTRACE_DL@
+NTPTRACE_DS = @NTPTRACE_DS@
+NTPTRACE_MS = @NTPTRACE_MS@
+NTPTRACE_NI = @NTPTRACE_NI@
+NTP_FORCE_LIBEVENT_DIST = @NTP_FORCE_LIBEVENT_DIST@
+NTP_KEYGEN_DB = @NTP_KEYGEN_DB@
+NTP_KEYGEN_DL = @NTP_KEYGEN_DL@
+NTP_KEYGEN_DS = @NTP_KEYGEN_DS@
+NTP_KEYGEN_MS = @NTP_KEYGEN_MS@
+NTP_KEYGEN_NI = @NTP_KEYGEN_NI@
+NTP_WAIT_DB = @NTP_WAIT_DB@
+NTP_WAIT_DL = @NTP_WAIT_DL@
+NTP_WAIT_DS = @NTP_WAIT_DS@
+NTP_WAIT_MS = @NTP_WAIT_MS@
+NTP_WAIT_NI = @NTP_WAIT_NI@
+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_RUBY = @PATH_RUBY@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POSIX_SHELL = @POSIX_SHELL@
+PTHREAD_LIBS = @PTHREAD_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SNTP = @SNTP@
+SNTP_DB = @SNTP_DB@
+SNTP_DL = @SNTP_DL@
+SNTP_DS = @SNTP_DS@
+SNTP_MS = @SNTP_MS@
+SNTP_NI = @SNTP_NI@
+STDNORETURN_H = @STDNORETURN_H@
+STRIP = @STRIP@
+TICKADJ_DB = @TICKADJ_DB@
+TICKADJ_DL = @TICKADJ_DL@
+TICKADJ_DS = @TICKADJ_DS@
+TICKADJ_MS = @TICKADJ_MS@
+TICKADJ_NI = @TICKADJ_NI@
+TIMETRIM_DB = @TIMETRIM_DB@
+TIMETRIM_DL = @TIMETRIM_DL@
+TIMETRIM_DS = @TIMETRIM_DS@
+TIMETRIM_MS = @TIMETRIM_MS@
+TIMETRIM_NI = @TIMETRIM_NI@
+UPDATE_LEAP_DB = @UPDATE_LEAP_DB@
+UPDATE_LEAP_DL = @UPDATE_LEAP_DL@
+UPDATE_LEAP_DS = @UPDATE_LEAP_DS@
+UPDATE_LEAP_MS = @UPDATE_LEAP_MS@
+UPDATE_LEAP_NI = @UPDATE_LEAP_NI@
+VERSION = @VERSION@
+VER_SUFFIX = @VER_SUFFIX@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+NULL =
+#if !NTP_CROSSCOMPILE
+#TESTS += tests-runner
+#endif
+BUILT_SOURCES = $(srcdir)/run-crypto.c $(srcdir)/run-keyFile.c \
+ $(srcdir)/run-kodDatabase.c $(srcdir)/run-kodFile.c \
+ $(srcdir)/run-networking.c $(srcdir)/run-packetHandling.c \
+ $(srcdir)/run-packetProcessing.c $(srcdir)/run-utilities.c \
+ $(NULL) check-libsntp check-libntp check-libunity .deps-ver
+CLEANFILES = debug-output-lfp-bin debug-output-lfp-dec \
+ debug-output-pkt kod-output-blank kod-output-multiple \
+ kod-output-single testLogfile.log testLogfile2.log $(NULL) \
+ data/kod-output-multiple data/kod-output-single \
+ data/debug-output-pkt data/debug-output-lfp-dec \
+ data/kod-output-blank data/debug-output-lfp-bin $(NULL) \
+ check-libsntp check-libntp check-libunity .deps-ver
+DISTCLEANFILES = \
+ kod-output-blank \
+ kod-output-single \
+ kod-output-multiple \
+ testLogfile.log \
+ testLogfile2.log \
+ $(NULL)
+
+std_unity_list = \
+ $(srcdir)/../unity/auto/generate_test_runner.rb \
+ $(NULL)
+
+run_unity = cd $(srcdir) && ruby ../unity/auto/generate_test_runner.rb
+noinst_HEADERS = \
+ sntptest.h \
+ $(NULL)
+
+dist_check_SCRIPTS = tests-runner
+EXTRA_DIST = \
+ data/debug-input-lfp-bin \
+ data/debug-input-lfp-dec \
+ data/debug-input-pkt \
+ data/key-test-ascii \
+ data/key-test-comments \
+ data/key-test-empty \
+ data/key-test-hex \
+ data/key-test-invalid-hex \
+ data/kod-expected-multiple \
+ data/kod-expected-single \
+ data/kod-test-blanks \
+ data/kod-test-correct \
+ data/kod-test-empty \
+ $(NULL)
+
+
+#split into LDADD and tests_LDADD?
+base_LDADD = \
+ ../libsntp.a \
+ $(LIBOPTS_LDADD) \
+ $(LDADD_LIBEVENT) \
+ $(top_builddir)/../libntp/libntp.a \
+ $(LDADD_LIBNTP) \
+ $(LDADD_NTP) \
+ $(NULL)
+
+LDADD = \
+ $(base_LDADD) \
+ $(top_builddir)/unity/libunity.a \
+ $(LIBM) \
+ $(NULL)
+
+AM_CFLAGS = $(CFLAGS_NTP)
+#AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
+AM_CPPFLAGS = $(SNTP_INCS) -I$(srcdir)/.. -I$(top_srcdir)/../tests \
+ $(LIBOPTS_CFLAGS) $(CPPFLAGS_LIBEVENT) $(CPPFLAGS_NTP) \
+ -DUNITY_INCLUDE_CONFIG_H -I$(top_srcdir)/unity
+AM_LDFLAGS = $(LDFLAGS_NTP)
+test_networking_SOURCES = \
+ networking.c \
+ run-networking.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_packetHandling_SOURCES = \
+ packetHandling.c \
+ run-packetHandling.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_kodDatabase_SOURCES = \
+ kodDatabase.c \
+ run-kodDatabase.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_keyFile_SOURCES = \
+ fileHandlingTest.c \
+ keyFile.c \
+ run-keyFile.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_kodFile_SOURCES = \
+ fileHandlingTest.c \
+ kodFile.c \
+ run-kodFile.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_packetProcessing_SOURCES = \
+ packetProcessing.c \
+ run-packetProcessing.c \
+ sntptest.c \
+ $(NULL)
+
+test_utilities_SOURCES = \
+ fileHandlingTest.c \
+ utilities.c \
+ run-utilities.c \
+ $(NULL)
+
+test_crypto_CFLAGS = \
+ $(CFLAGS_LIBEVENT) \
+ $(AM_CFLAGS) \
+ $(NULL)
+
+test_crypto_SOURCES = \
+ crypto.c \
+ run-crypto.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+test_log_SOURCES = \
+ t-log.c \
+ run-t-log.c \
+ $(top_builddir)/version.c \
+ $(NULL)
+
+
+#$(srcdir)/../version.c: $(srcdir)/../version.c
+# gcc -o version.o ../version.c
+TESTS = $(am__append_3)
+SNTP_INCS = -I$(top_srcdir)/../include \
+ -I$(top_srcdir)/../lib/isc/include \
+ -I$(top_srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \
+ -I$(top_srcdir)/../lib/isc/unix/include
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/depsver.mf $(top_srcdir)/includes.mf $(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
+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_srcdir)/depsver.mf $(top_srcdir)/includes.mf $(am__empty):
+
+$(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):
+fileHandlingTest.h: $(top_builddir)/config.status $(srcdir)/fileHandlingTest.h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+test-crypto$(EXEEXT): $(test_crypto_OBJECTS) $(test_crypto_DEPENDENCIES) $(EXTRA_test_crypto_DEPENDENCIES)
+ @rm -f test-crypto$(EXEEXT)
+ $(AM_V_CCLD)$(test_crypto_LINK) $(test_crypto_OBJECTS) $(test_crypto_LDADD) $(LIBS)
+
+test-keyFile$(EXEEXT): $(test_keyFile_OBJECTS) $(test_keyFile_DEPENDENCIES) $(EXTRA_test_keyFile_DEPENDENCIES)
+ @rm -f test-keyFile$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_keyFile_OBJECTS) $(test_keyFile_LDADD) $(LIBS)
+
+test-kodDatabase$(EXEEXT): $(test_kodDatabase_OBJECTS) $(test_kodDatabase_DEPENDENCIES) $(EXTRA_test_kodDatabase_DEPENDENCIES)
+ @rm -f test-kodDatabase$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_kodDatabase_OBJECTS) $(test_kodDatabase_LDADD) $(LIBS)
+
+test-kodFile$(EXEEXT): $(test_kodFile_OBJECTS) $(test_kodFile_DEPENDENCIES) $(EXTRA_test_kodFile_DEPENDENCIES)
+ @rm -f test-kodFile$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_kodFile_OBJECTS) $(test_kodFile_LDADD) $(LIBS)
+
+test-log$(EXEEXT): $(test_log_OBJECTS) $(test_log_DEPENDENCIES) $(EXTRA_test_log_DEPENDENCIES)
+ @rm -f test-log$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_log_OBJECTS) $(test_log_LDADD) $(LIBS)
+
+test-networking$(EXEEXT): $(test_networking_OBJECTS) $(test_networking_DEPENDENCIES) $(EXTRA_test_networking_DEPENDENCIES)
+ @rm -f test-networking$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_networking_OBJECTS) $(test_networking_LDADD) $(LIBS)
+
+test-packetHandling$(EXEEXT): $(test_packetHandling_OBJECTS) $(test_packetHandling_DEPENDENCIES) $(EXTRA_test_packetHandling_DEPENDENCIES)
+ @rm -f test-packetHandling$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_packetHandling_OBJECTS) $(test_packetHandling_LDADD) $(LIBS)
+
+test-packetProcessing$(EXEEXT): $(test_packetProcessing_OBJECTS) $(test_packetProcessing_DEPENDENCIES) $(EXTRA_test_packetProcessing_DEPENDENCIES)
+ @rm -f test-packetProcessing$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_packetProcessing_OBJECTS) $(test_packetProcessing_LDADD) $(LIBS)
+
+test-utilities$(EXEEXT): $(test_utilities_OBJECTS) $(test_utilities_DEPENDENCIES) $(EXTRA_test_utilities_DEPENDENCIES)
+ @rm -f test-utilities$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(test_utilities_OBJECTS) $(test_utilities_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileHandlingTest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyFile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kodDatabase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kodFile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetHandling.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packetProcessing.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-keyFile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-kodDatabase.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-kodFile.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-networking.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-packetHandling.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-packetProcessing.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-t-log.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run-utilities.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sntptest.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t-log.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crypto-crypto.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crypto-run-crypto.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_crypto-version.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utilities.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
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+
+.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
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(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
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+test_crypto-crypto.o: crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-crypto.o -MD -MP -MF $(DEPDIR)/test_crypto-crypto.Tpo -c -o test_crypto-crypto.o `test -f 'crypto.c' || echo '$(srcdir)/'`crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-crypto.Tpo $(DEPDIR)/test_crypto-crypto.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto.c' object='test_crypto-crypto.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-crypto.o `test -f 'crypto.c' || echo '$(srcdir)/'`crypto.c
+
+test_crypto-crypto.obj: crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-crypto.obj -MD -MP -MF $(DEPDIR)/test_crypto-crypto.Tpo -c -o test_crypto-crypto.obj `if test -f 'crypto.c'; then $(CYGPATH_W) 'crypto.c'; else $(CYGPATH_W) '$(srcdir)/crypto.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-crypto.Tpo $(DEPDIR)/test_crypto-crypto.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crypto.c' object='test_crypto-crypto.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-crypto.obj `if test -f 'crypto.c'; then $(CYGPATH_W) 'crypto.c'; else $(CYGPATH_W) '$(srcdir)/crypto.c'; fi`
+
+test_crypto-run-crypto.o: run-crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-run-crypto.o -MD -MP -MF $(DEPDIR)/test_crypto-run-crypto.Tpo -c -o test_crypto-run-crypto.o `test -f 'run-crypto.c' || echo '$(srcdir)/'`run-crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-run-crypto.Tpo $(DEPDIR)/test_crypto-run-crypto.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-crypto.c' object='test_crypto-run-crypto.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-run-crypto.o `test -f 'run-crypto.c' || echo '$(srcdir)/'`run-crypto.c
+
+test_crypto-run-crypto.obj: run-crypto.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-run-crypto.obj -MD -MP -MF $(DEPDIR)/test_crypto-run-crypto.Tpo -c -o test_crypto-run-crypto.obj `if test -f 'run-crypto.c'; then $(CYGPATH_W) 'run-crypto.c'; else $(CYGPATH_W) '$(srcdir)/run-crypto.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-run-crypto.Tpo $(DEPDIR)/test_crypto-run-crypto.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-crypto.c' object='test_crypto-run-crypto.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-run-crypto.obj `if test -f 'run-crypto.c'; then $(CYGPATH_W) 'run-crypto.c'; else $(CYGPATH_W) '$(srcdir)/run-crypto.c'; fi`
+
+test_crypto-version.o: $(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-version.o -MD -MP -MF $(DEPDIR)/test_crypto-version.Tpo -c -o test_crypto-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-version.Tpo $(DEPDIR)/test_crypto-version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_crypto-version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c
+
+test_crypto-version.obj: $(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -MT test_crypto-version.obj -MD -MP -MF $(DEPDIR)/test_crypto-version.Tpo -c -o test_crypto-version.obj `if test -f '$(top_builddir)/version.c'; then $(CYGPATH_W) '$(top_builddir)/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/version.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_crypto-version.Tpo $(DEPDIR)/test_crypto-version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_crypto-version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_crypto_CFLAGS) $(CFLAGS) -c -o test_crypto-version.obj `if test -f '$(top_builddir)/version.c'; then $(CYGPATH_W) '$(top_builddir)/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/version.c'; fi`
+
+version.o: $(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.o -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c
+
+version.obj: $(top_builddir)/version.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT version.obj -MD -MP -MF $(DEPDIR)/version.Tpo -c -o version.obj `if test -f '$(top_builddir)/version.c'; then $(CYGPATH_W) '$(top_builddir)/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/version.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/version.Tpo $(DEPDIR)/version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o version.obj `if test -f '$(top_builddir)/version.c'; then $(CYGPATH_W) '$(top_builddir)/version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/version.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ 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-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ elif test -n "$$redo_logs"; then \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS) $(dist_check_SCRIPTS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+test-crypto.log: test-crypto$(EXEEXT)
+ @p='test-crypto$(EXEEXT)'; \
+ b='test-crypto'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-keyFile.log: test-keyFile$(EXEEXT)
+ @p='test-keyFile$(EXEEXT)'; \
+ b='test-keyFile'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-log.log: test-log$(EXEEXT)
+ @p='test-log$(EXEEXT)'; \
+ b='test-log'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-networking.log: test-networking$(EXEEXT)
+ @p='test-networking$(EXEEXT)'; \
+ b='test-networking'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-packetHandling.log: test-packetHandling$(EXEEXT)
+ @p='test-packetHandling$(EXEEXT)'; \
+ b='test-packetHandling'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-packetProcessing.log: test-packetProcessing$(EXEEXT)
+ @p='test-packetProcessing$(EXEEXT)'; \
+ b='test-packetProcessing'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-utilities.log: test-utilities$(EXEEXT)
+ @p='test-utilities$(EXEEXT)'; \
+ b='test-utilities'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-kodDatabase.log: test-kodDatabase$(EXEEXT)
+ @p='test-kodDatabase$(EXEEXT)'; \
+ b='test-kodDatabase'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+test-kodFile.log: test-kodFile$(EXEEXT)
+ @p='test-kodFile$(EXEEXT)'; \
+ b='test-kodFile'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) \
+ $(dist_check_SCRIPTS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(HEADERS)
+installdirs:
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+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)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ 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: all check check-am install install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am 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 \
+ recheck tags tags-am uninstall uninstall-am
+
+.PRECIOUS: Makefile
+
+
+$(srcdir)/run-kodFile.c: $(srcdir)/kodFile.c $(std_unity_list)
+ $(run_unity) kodFile.c run-kodFile.c
+
+$(srcdir)/run-keyFile.c: $(srcdir)/keyFile.c $(std_unity_list)
+ $(run_unity) keyFile.c run-keyFile.c
+
+$(srcdir)/run-kodDatabase.c: $(srcdir)/kodDatabase.c $(std_unity_list)
+ $(run_unity) kodDatabase.c run-kodDatabase.c
+
+$(srcdir)/run-networking.c: $(srcdir)/networking.c $(std_unity_list)
+ $(run_unity) networking.c run-networking.c
+
+$(srcdir)/run-packetProcessing.c: $(srcdir)/packetProcessing.c $(std_unity_list)
+ $(run_unity) packetProcessing.c run-packetProcessing.c
+
+$(srcdir)/run-packetHandling.c: $(srcdir)/packetHandling.c $(std_unity_list)
+ $(run_unity) packetHandling.c run-packetHandling.c
+
+$(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list)
+ $(run_unity) utilities.c run-utilities.c
+
+$(srcdir)/run-crypto.c: $(srcdir)/crypto.c $(std_unity_list)
+ $(run_unity) crypto.c run-crypto.c
+
+$(srcdir)/run-t-log.c: $(srcdir)/t-log.c $(std_unity_list)
+ $(run_unity) t-log.c run-t-log.c
+
+check-libsntp: ../libsntp.a
+ @echo stamp > $@
+
+../libsntp.a:
+ cd .. && $(MAKE) $(AM_MAKEFLAGS) libsntp.a
+
+check-libntp: ../../libntp/libntp.a
+ @echo stamp > $@
+
+../../libntp/libntp.a:
+ cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
+
+check-libunity: ../unity/libunity.a
+ @echo stamp > $@
+
+../unity/libunity.a:
+ cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a
+$(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver
+ @[ -f $@ ] || \
+ cp $(top_srcdir)/deps-ver $@
+ @[ -w $@ ] || \
+ chmod ug+w $@
+ @cmp $(top_srcdir)/deps-ver $@ > /dev/null || ( \
+ $(MAKE) $(AM_MAKEFLAGS) clean && \
+ echo -n "Prior $(subdir)/$(DEPDIR) version " && \
+ cat $@ && \
+ rm -rf $(DEPDIR) && \
+ mkdir $(DEPDIR) && \
+ case "$(top_builddir)" in \
+ .) \
+ ./config.status Makefile depfiles \
+ ;; \
+ *) \
+ cd "$(top_builddir)" && \
+ ./config.status $(subdir)/Makefile depfiles && \
+ cd $(subdir) \
+ ;; \
+ esac && \
+ echo -n "Cleaned $(subdir)/$(DEPDIR) version " && \
+ cat $(top_srcdir)/deps-ver \
+ )
+ cp $(top_srcdir)/deps-ver $@
+
+.deps-ver: $(top_srcdir)/deps-ver
+ @[ ! -d $(DEPDIR) ] || $(MAKE) $(AM_MAKEFLAGS) $(DEPDIR)/deps-ver
+ @touch $@
+
+#
+# depsver.mf included in Makefile.am for directories with .deps
+#
+# When building in the same directory with sources that change over
+# time, such as when tracking using bk, the .deps files can become
+# stale with respect to moved, deleted, or superceded headers. Most
+# commonly, this would exhibit as make reporting a failure to make a
+# header file which is no longer in the location given. To address
+# this issue, we use a deps-ver file which is updated with each change
+# that breaks old .deps files. A copy of deps-ver is made into
+# $(DEPDIR) if not already present. If $(DEPDIR)/deps-ver is present
+# with different contents than deps-ver, we make clean to ensure all
+# .o files built before the incompatible change are rebuilt along with
+# their updated .deps files, then remove $(DEPDIR) and recreate it as
+# empty stubs.
+#
+# It is normal when configured with --disable-dependency-tracking for
+# the DEPDIR to not have been created. For this reason, we use the
+# intermediate target .deps-ver, which invokes make recursively if
+# DEPDIR exists.
+#
+# If you modify depsver.mf, please make the changes to the master
+# copy, the one in sntp is copied by the bootstrap script from it.
+#
+# This comment block follows rather than leads the related code so that
+# it stays with it in the generated Makefile.in and Makefile.
+#
+
+# 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/contrib/ntp/sntp/tests/crypto.c b/contrib/ntp/sntp/tests/crypto.c
new file mode 100644
index 000000000000..fb2dc62981f3
--- /dev/null
+++ b/contrib/ntp/sntp/tests/crypto.c
@@ -0,0 +1,163 @@
+#include "config.h"
+#include "unity.h"
+#include "ntp_types.h"
+
+#include "sntptest.h"
+#include "crypto.h"
+
+#define MD5_LENGTH 16
+#define SHA1_LENGTH 20
+
+
+void test_MakeMd5Mac(void);
+void test_MakeSHA1Mac(void);
+void test_VerifyCorrectMD5(void);
+void test_VerifySHA1(void);
+void test_VerifyFailure(void);
+void test_PacketSizeNotMultipleOfFourBytes(void);
+
+
+void
+test_MakeMd5Mac(void)
+{
+ const char* PKT_DATA = "abcdefgh0123";
+ const int PKT_LEN = strlen(PKT_DATA);
+ const char* EXPECTED_DIGEST =
+ "\x52\x6c\xb8\x38\xaf\x06\x5a\xfb\x6c\x98\xbb\xc0\x9b\x0a\x7a\x1b";
+ char actual[MD5_LENGTH];
+
+ struct key md5;
+ md5.next = NULL;
+ md5.key_id = 10;
+ md5.key_len = 6;
+ memcpy(&md5.key_seq, "md5seq", md5.key_len);
+ memcpy(&md5.type, "MD5", 4);
+
+ TEST_ASSERT_EQUAL(MD5_LENGTH,
+ make_mac(PKT_DATA, PKT_LEN, MD5_LENGTH, &md5, actual));
+
+ TEST_ASSERT_TRUE(memcmp(EXPECTED_DIGEST, actual, MD5_LENGTH) == 0);
+}
+
+
+void
+test_MakeSHA1Mac(void)
+{
+#ifdef OPENSSL
+
+ const char* PKT_DATA = "abcdefgh0123";
+ const int PKT_LEN = strlen(PKT_DATA);
+ const char* EXPECTED_DIGEST =
+ "\x17\xaa\x82\x97\xc7\x17\x13\x6a\x9b\xa9"
+ "\x63\x85\xb4\xce\xbe\x94\xa0\x97\x16\x1d";
+ char actual[SHA1_LENGTH];
+
+ struct key sha1;
+ sha1.next = NULL;
+ sha1.key_id = 20;
+ sha1.key_len = 7;
+ memcpy(&sha1.key_seq, "sha1seq", sha1.key_len);
+ memcpy(&sha1.type, "SHA1", 5);
+
+ TEST_ASSERT_EQUAL(SHA1_LENGTH,
+ make_mac(PKT_DATA, PKT_LEN, SHA1_LENGTH, &sha1, actual));
+
+ TEST_ASSERT_EQUAL_MEMORY(EXPECTED_DIGEST, actual, SHA1_LENGTH);
+
+#else
+
+ TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
+
+#endif /* OPENSSL */
+}
+
+
+void
+test_VerifyCorrectMD5(void)
+{
+ const char* PKT_DATA =
+ "sometestdata" /* Data */
+ "\0\0\0\0" /* Key-ID (unused) */
+ "\xc7\x58\x99\xdd\x99\x32\x0f\x71" /* MAC */
+ "\x2b\x7b\xfe\x4f\xa2\x32\xcf\xac";
+ const int PKT_LEN = 12;
+
+ struct key md5;
+ md5.next = NULL;
+ md5.key_id = 0;
+ md5.key_len = 6;
+ memcpy(&md5.key_seq, "md5key", md5.key_len);
+ memcpy(&md5.type, "MD5", 4);
+
+ TEST_ASSERT_TRUE(auth_md5(PKT_DATA, PKT_LEN, MD5_LENGTH, &md5));
+}
+
+
+void
+test_VerifySHA1(void)
+{
+#ifdef OPENSSL
+
+ const char* PKT_DATA =
+ "sometestdata" /* Data */
+ "\0\0\0\0" /* Key-ID (unused) */
+ "\xad\x07\xde\x36\x39\xa6\x77\xfa\x5b\xce" /* MAC */
+ "\x2d\x8a\x7d\x06\x96\xe6\x0c\xbc\xed\xe1";
+ const int PKT_LEN = 12;
+
+ struct key sha1;
+ sha1.next = NULL;
+ sha1.key_id = 0;
+ sha1.key_len = 7;
+ memcpy(&sha1.key_seq, "sha1key", sha1.key_len);
+ memcpy(&sha1.type, "SHA1", 5);
+
+ TEST_ASSERT_TRUE(auth_md5(PKT_DATA, PKT_LEN, SHA1_LENGTH, &sha1));
+
+#else
+
+ TEST_IGNORE_MESSAGE("OpenSSL not found, skipping...");
+
+#endif /* OPENSSL */
+}
+
+void
+test_VerifyFailure(void)
+{
+ /* We use a copy of the MD5 verification code, but modify the
+ * last bit to make sure verification fails.
+ */
+ const char* PKT_DATA =
+ "sometestdata" /* Data */
+ "\0\0\0\0" /* Key-ID (unused) */
+ "\xc7\x58\x99\xdd\x99\x32\x0f\x71" /* MAC */
+ "\x2b\x7b\xfe\x4f\xa2\x32\xcf\x00"; /* Last byte is wrong! */
+ const int PKT_LEN = 12;
+
+ struct key md5;
+ md5.next = NULL;
+ md5.key_id = 0;
+ md5.key_len = 6;
+ memcpy(&md5.key_seq, "md5key", md5.key_len);
+ memcpy(&md5.type, "MD5", 4);
+
+ TEST_ASSERT_FALSE(auth_md5(PKT_DATA, PKT_LEN, MD5_LENGTH, &md5));
+}
+
+
+void
+test_PacketSizeNotMultipleOfFourBytes(void)
+{
+ const char* PKT_DATA = "123456";
+ const int PKT_LEN = 6;
+ char actual[MD5_LENGTH];
+
+ struct key md5;
+ md5.next = NULL;
+ md5.key_id = 10;
+ md5.key_len = 6;
+ memcpy(&md5.key_seq, "md5seq", md5.key_len);
+ memcpy(&md5.type, "MD5", 4);
+
+ TEST_ASSERT_EQUAL(0, make_mac(PKT_DATA, PKT_LEN, MD5_LENGTH, &md5, actual));
+}
diff --git a/contrib/ntp/sntp/tests/data/debug-input-lfp-bin b/contrib/ntp/sntp/tests/data/debug-input-lfp-bin
new file mode 100644
index 000000000000..99d559cc23d2
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/debug-input-lfp-bin
@@ -0,0 +1,3 @@
+--------------------------------------------------------------------------------
+0: 00000000 1: 00000000 2: 00000000 3: 00111111 4: 00000000 5: 00000000 6: 00000000 7: 01111111
+--------------------------------------------------------------------------------
diff --git a/contrib/ntp/sntp/tests/data/debug-input-lfp-dec b/contrib/ntp/sntp/tests/data/debug-input-lfp-dec
new file mode 100644
index 000000000000..6e81c854347f
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/debug-input-lfp-dec
@@ -0,0 +1,3 @@
+--------------------------------------------------------------------------------
+0: 0 1: 0 2: 24 3: 166 4: 0 5: 4 6: 181 7: 22
+--------------------------------------------------------------------------------
diff --git a/contrib/ntp/sntp/tests/data/debug-input-pkt b/contrib/ntp/sntp/tests/data/debug-input-pkt
new file mode 100644
index 000000000000..ff61b75263cb
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/debug-input-pkt
@@ -0,0 +1,8 @@
+--------------------------------------------------------------------------------
+0: 24 1: 0 2: 0 3: 0 4: 0 5: 0 6: 0 7: 0
+8: 0 9: 0 10: 0 11: 0 12: 0 13: 0 14: 0 15: 0
+16: 0 17: 0 18: 0 19: 0 20: 0 21: 0 22: 0 23: 0
+24: 0 25: 0 26: 0 27: 0 28: 0 29: 0 30: 0 31: 0
+32: 0 33: 0 34: 0 35: 0 36: 0 37: 0 38: 0 39: 0
+40: 0 41: 0 42: 0 43: 8 44: 7f 45: ff 46: ff 47: ff
+--------------------------------------------------------------------------------
diff --git a/contrib/ntp/sntp/tests/data/key-test-ascii b/contrib/ntp/sntp/tests/data/key-test-ascii
new file mode 100644
index 000000000000..9240c819462b
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/key-test-ascii
@@ -0,0 +1,2 @@
+50 MD5 asciikeyOne
+40 MD5 asciikeyTwo
diff --git a/contrib/ntp/sntp/tests/data/key-test-comments b/contrib/ntp/sntp/tests/data/key-test-comments
new file mode 100644
index 000000000000..437049effedc
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/key-test-comments
@@ -0,0 +1,3 @@
+# This is an initial comment, this file should contain 2 keys.
+34 MD5 xyz #This is a comment after an ASCII key.
+10 MD5 010101010101010101010101010101 #Comment after hex key.
diff --git a/contrib/ntp/sntp/tests/data/key-test-empty b/contrib/ntp/sntp/tests/data/key-test-empty
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/key-test-empty
diff --git a/contrib/ntp/sntp/tests/data/key-test-hex b/contrib/ntp/sntp/tests/data/key-test-hex
new file mode 100644
index 000000000000..fb704c5fd94e
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/key-test-hex
@@ -0,0 +1,3 @@
+10 MD5 0123456789abcdef0123456789
+20 MD5 111111111111111111111111111111
+30 MD5 01010101010101010101010101
diff --git a/contrib/ntp/sntp/tests/data/key-test-invalid-hex b/contrib/ntp/sntp/tests/data/key-test-invalid-hex
new file mode 100644
index 000000000000..0933ed00bc7e
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/key-test-invalid-hex
@@ -0,0 +1,2 @@
+30 MD5 0101010101010101010101010101gh
+10 MD5 010101010101010101010101010101
diff --git a/contrib/ntp/sntp/tests/data/kod-expected-multiple b/contrib/ntp/sntp/tests/data/kod-expected-multiple
new file mode 100644
index 000000000000..c6ba292779eb
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/kod-expected-multiple
@@ -0,0 +1,3 @@
+000000000000abcd DENY 192.0.2.1
+000000000000abcd RSTR 192.0.2.5
+000000000000abcd RATE example.com
diff --git a/contrib/ntp/sntp/tests/data/kod-expected-single b/contrib/ntp/sntp/tests/data/kod-expected-single
new file mode 100644
index 000000000000..8ad3c7ccc17d
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/kod-expected-single
@@ -0,0 +1 @@
+0000000000000001 DENY host1
diff --git a/contrib/ntp/sntp/tests/data/kod-test-blanks b/contrib/ntp/sntp/tests/data/kod-test-blanks
new file mode 100644
index 000000000000..5c20e7271e57
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/kod-test-blanks
@@ -0,0 +1,6 @@
+
+0000000012345678 DENY 192.0.2.5
+
+0000000000000fff RSTR 192.0.2.100
+000000000000abcd DENY example.com
+
diff --git a/contrib/ntp/sntp/tests/data/kod-test-correct b/contrib/ntp/sntp/tests/data/kod-test-correct
new file mode 100644
index 000000000000..8a3e230ea0f9
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/kod-test-correct
@@ -0,0 +1,2 @@
+0000000012345678 DENY 192.0.2.5
+0000000000000fff RSTR 192.0.2.100
diff --git a/contrib/ntp/sntp/tests/data/kod-test-empty b/contrib/ntp/sntp/tests/data/kod-test-empty
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/ntp/sntp/tests/data/kod-test-empty
diff --git a/contrib/ntp/sntp/tests/fileHandlingTest.c b/contrib/ntp/sntp/tests/fileHandlingTest.c
new file mode 100644
index 000000000000..8acad5498f8b
--- /dev/null
+++ b/contrib/ntp/sntp/tests/fileHandlingTest.c
@@ -0,0 +1,97 @@
+
+#include "config.h"
+#include "stdlib.h"
+#include "sntptest.h"
+
+#include "fileHandlingTest.h" /* required because of the h.in thingy */
+
+#include <string.h>
+#include <unistd.h>
+
+const char *
+CreatePath(
+ const char * filename,
+ enum DirectoryType argument
+ )
+{
+ const char srcdir[] = SRCDIR_DEF;//"@abs_srcdir@/data/";
+ size_t plen = sizeof(srcdir) + strlen(filename) + 1;
+ char * path = emalloc(plen);
+ ssize_t retc;
+
+ UNUSED_ARG(argument);
+
+ retc = snprintf(path, plen, "%s%s", srcdir, filename);
+ if (retc <= 0 || (size_t)retc >= plen)
+ exit(1);
+ return path;
+}
+
+
+void
+DestroyPath(
+ const char * pathname
+ )
+{
+ /* use a union to get terminally rid of the 'const' attribute */
+ union {
+ const char *ccp;
+ void *vp;
+ } any;
+
+ any.ccp = pathname;
+ free(any.vp);
+}
+
+
+int
+GetFileSize(
+ FILE * file
+ )
+{
+ fseek(file, 0L, SEEK_END);
+ int length = ftell(file);
+ fseek(file, 0L, SEEK_SET);
+
+ return length;
+}
+
+
+bool
+CompareFileContent(
+ FILE * expected,
+ FILE * actual
+ )
+{
+ int currentLine = 1;
+
+ char actualLine[1024];
+ char expectedLine[1024];
+ size_t lenAct = sizeof actualLine;
+ size_t lenExp = sizeof expectedLine;
+
+ while ( ( (fgets(actualLine, lenAct, actual)) != NULL)
+ && ( (fgets(expectedLine, lenExp, expected)) != NULL )
+ ) {
+
+
+ if( strcmp(actualLine,expectedLine) !=0 ){
+ printf("Comparision failed on line %d",currentLine);
+ return FALSE;
+ }
+
+ currentLine++;
+ }
+
+ return TRUE;
+}
+
+
+void
+ClearFile(
+ const char * filename
+ )
+{
+ if (!truncate(filename, 0))
+ exit(1);
+}
diff --git a/contrib/ntp/sntp/tests/fileHandlingTest.h.in b/contrib/ntp/sntp/tests/fileHandlingTest.h.in
new file mode 100644
index 000000000000..b93ed9e90293
--- /dev/null
+++ b/contrib/ntp/sntp/tests/fileHandlingTest.h.in
@@ -0,0 +1,26 @@
+#ifndef FILE_HANDLING_TEST_H
+#define FILE_HANDLING_TEST_H
+
+#include "config.h"
+#include "stdlib.h"
+#include "sntptest.h"
+
+#include <string.h>
+#include <unistd.h>
+
+
+enum DirectoryType {
+ INPUT_DIR = 0,
+ OUTPUT_DIR = 1
+};
+
+#define SRCDIR_DEF "@abs_srcdir@/data/";
+
+extern const char * CreatePath(const char* filename,
+ enum DirectoryType argument);
+extern void DestroyPath(const char* pathname);
+extern int GetFileSize(FILE *file);
+extern bool CompareFileContent(FILE* expected, FILE* actual);
+extern void ClearFile(const char * filename) ;
+
+#endif // FILE_HANDLING_TEST_H
diff --git a/contrib/ntp/sntp/tests/keyFile.c b/contrib/ntp/sntp/tests/keyFile.c
new file mode 100644
index 000000000000..395ca0dc10e8
--- /dev/null
+++ b/contrib/ntp/sntp/tests/keyFile.c
@@ -0,0 +1,190 @@
+#include "config.h"
+#include "fileHandlingTest.h"
+
+#include "ntp_stdlib.h"
+#include "ntp_types.h"
+#include "crypto.h"
+
+#include "unity.h"
+
+bool CompareKeys(struct key expected, struct key actual);
+bool CompareKeysAlternative(int key_id,int key_len,const char* type,const char* key_seq,struct key actual);
+void test_ReadEmptyKeyFile(void);
+void test_ReadASCIIKeys(void);
+void test_ReadHexKeys(void);
+void test_ReadKeyFileWithComments(void);
+void test_ReadKeyFileWithInvalidHex(void);
+
+
+bool
+CompareKeys(
+ struct key expected,
+ struct key actual
+ )
+{
+ if (expected.key_id != actual.key_id) {
+ printf("Expected key_id: %d but was: %d\n",
+ expected.key_id, actual.key_id);
+ return FALSE;
+ }
+ if (expected.key_len != actual.key_len) {
+ printf("Expected key_len: %d but was: %d\n",
+ expected.key_len, actual.key_len);
+ return FALSE;
+ }
+ if (strcmp(expected.type, actual.type) != 0) {
+ printf("Expected key_type: %s but was: %s\n",
+ expected.type, actual.type);
+ return FALSE;
+
+ }
+ if (memcmp(expected.key_seq, actual.key_seq, expected.key_len) != 0) {
+ printf("Key mismatch!\n");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+bool
+CompareKeysAlternative(
+ int key_id,
+ int key_len,
+ const char * type,
+ const char * key_seq,
+ struct key actual
+ )
+{
+ struct key temp;
+
+ temp.key_id = key_id;
+ temp.key_len = key_len;
+ strlcpy(temp.type, type, sizeof(temp.type));
+ memcpy(temp.key_seq, key_seq, key_len);
+
+ return CompareKeys(temp, actual);
+}
+
+
+void
+test_ReadEmptyKeyFile(void)
+{
+ struct key * keys = NULL;
+ const char * path = CreatePath("key-test-empty", INPUT_DIR);
+
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(0, auth_init(path, &keys));
+ TEST_ASSERT_NULL(keys);
+
+ DestroyPath(path);
+}
+
+
+void
+test_ReadASCIIKeys(void)
+{
+ struct key * keys = NULL;
+ struct key * result = NULL;
+ const char * path = CreatePath("key-test-ascii", INPUT_DIR);
+
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(2, auth_init(path, &keys));
+ TEST_ASSERT_NOT_NULL(keys);
+
+ DestroyPath(path);
+
+ get_key(40, &result);
+ TEST_ASSERT_NOT_NULL(result);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(40, 11, "MD5", "asciikeyTwo", *result));
+
+ result = NULL;
+ get_key(50, &result);
+ TEST_ASSERT_NOT_NULL(result);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(50, 11, "MD5", "asciikeyOne", *result));
+}
+
+
+void
+test_ReadHexKeys(void)
+{
+ struct key * keys = NULL;
+ struct key * result = NULL;
+ const char * path = CreatePath("key-test-hex", INPUT_DIR);
+ char data1[15];
+ char data2[13];
+
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(3, auth_init(path, &keys));
+ TEST_ASSERT_NOT_NULL(keys);
+ DestroyPath(path);
+
+ get_key(10, &result);
+ TEST_ASSERT_NOT_NULL(result);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(10, 13, "MD5",
+ "\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89", *result));
+
+ result = NULL;
+ get_key(20, &result);
+ TEST_ASSERT_NOT_NULL(result);
+
+ memset(data1, 0x11, 15);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(20, 15, "MD5", data1, *result));
+
+ result = NULL;
+ get_key(30, &result);
+ TEST_ASSERT_NOT_NULL(result);
+
+ memset(data2, 0x01, 13);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result));
+}
+
+
+void
+test_ReadKeyFileWithComments(void)
+{
+ struct key * keys = NULL;
+ struct key * result = NULL;
+ const char * path = CreatePath("key-test-comments", INPUT_DIR);
+ char data[15];
+
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(2, auth_init(path, &keys));
+ TEST_ASSERT_NOT_NULL(keys);
+ DestroyPath(path);
+
+ get_key(10, &result);
+ TEST_ASSERT_NOT_NULL(result);
+
+ memset(data, 0x01, 15);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(10, 15, "MD5", data, *result));
+
+ result = NULL;
+ get_key(34, &result);
+ TEST_ASSERT_NOT_NULL(result);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(34, 3, "MD5", "xyz", *result));
+}
+
+
+void
+test_ReadKeyFileWithInvalidHex(void)
+{
+ struct key * keys = NULL;
+ struct key * result = NULL;
+ const char * path = CreatePath("key-test-invalid-hex", INPUT_DIR);
+ char data[15];
+
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(1, auth_init(path, &keys));
+ TEST_ASSERT_NOT_NULL(keys);
+ DestroyPath(path);
+
+ get_key(10, &result);
+ TEST_ASSERT_NOT_NULL(result);
+
+ memset(data, 0x01, 15);
+ TEST_ASSERT_TRUE(CompareKeysAlternative(10, 15, "MD5", data, *result));
+
+ result = NULL;
+ get_key(30, &result); /* Should not exist, and result should remain NULL. */
+ TEST_ASSERT_NULL(result);
+}
diff --git a/contrib/ntp/sntp/tests/kodDatabase.c b/contrib/ntp/sntp/tests/kodDatabase.c
new file mode 100644
index 000000000000..3c0569471515
--- /dev/null
+++ b/contrib/ntp/sntp/tests/kodDatabase.c
@@ -0,0 +1,141 @@
+#include "config.h"
+
+#include "ntp_workimpl.h"
+#include "ntp_types.h"
+#include "sntptest.h"
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+#include "kod_management.h"
+#include "ntp_io.h"
+
+#include "unity.h"
+
+void setUp(void);
+void test_SingleEntryHandling(void);
+void test_MultipleEntryHandling(void);
+void test_NoMatchInSearch(void);
+void test_AddDuplicate(void);
+void test_DeleteEntry(void);
+
+
+void
+setUp(void) {
+ kod_init_kod_db("/dev/null", TRUE);
+ init_lib();
+}
+
+
+void
+test_SingleEntryHandling(void) {
+ const char HOST[] = "192.0.2.5";
+ const char REASON[] = "DENY";
+
+ add_entry(HOST, REASON);
+
+ struct kod_entry* result;
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOST, &result));
+ TEST_ASSERT_EQUAL_STRING(HOST, result->hostname);
+ TEST_ASSERT_EQUAL_STRING(REASON, result->type);
+}
+
+
+void
+test_MultipleEntryHandling(void) {
+ const char HOST1[] = "192.0.2.3";
+ const char REASON1[] = "DENY";
+
+ const char HOST2[] = "192.0.5.5";
+ const char REASON2[] = "RATE";
+
+ const char HOST3[] = "192.0.10.1";
+ const char REASON3[] = "DENY";
+
+ add_entry(HOST1, REASON1);
+ add_entry(HOST2, REASON2);
+ add_entry(HOST3, REASON3);
+
+ struct kod_entry* result;
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOST1, &result));
+ TEST_ASSERT_EQUAL_STRING(HOST1, result->hostname);
+ TEST_ASSERT_EQUAL_STRING(REASON1, result->type);
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOST2, &result));
+ TEST_ASSERT_EQUAL_STRING(HOST2, result->hostname);
+ TEST_ASSERT_EQUAL_STRING(REASON2, result->type);
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOST3, &result));
+ TEST_ASSERT_EQUAL_STRING(HOST3, result->hostname);
+ TEST_ASSERT_EQUAL_STRING(REASON3, result->type);
+
+ free(result);
+}
+
+
+void
+test_NoMatchInSearch(void) {
+ const char HOST_ADD[] = "192.0.2.6";
+ const char HOST_NOTADD[] = "192.0.6.1";
+ const char REASON[] = "DENY";
+
+ add_entry(HOST_ADD, REASON);
+
+ struct kod_entry* result;
+
+ TEST_ASSERT_EQUAL(0, search_entry(HOST_NOTADD, &result));
+ TEST_ASSERT_TRUE(result == NULL);
+}
+
+
+void
+test_AddDuplicate(void) {
+ const char HOST[] = "192.0.2.3";
+ const char REASON1[] = "RATE";
+ const char REASON2[] = "DENY";
+
+ add_entry(HOST, REASON1);
+ struct kod_entry* result1;
+ TEST_ASSERT_EQUAL(1, search_entry(HOST, &result1));
+
+ /*
+ * Sleeps for two seconds since we want to ensure that
+ * the timestamp is updated to a new value.
+ */
+ sleep(2);
+
+ add_entry(HOST, REASON2);
+ struct kod_entry* result2;
+ TEST_ASSERT_EQUAL(1, search_entry(HOST, &result2));
+
+ TEST_ASSERT_FALSE(result1->timestamp == result2->timestamp);
+
+ free(result1);
+ free(result2);
+}
+
+
+void
+test_DeleteEntry(void) {
+ const char HOST1[] = "192.0.2.1";
+ const char HOST2[] = "192.0.2.2";
+ const char HOST3[] = "192.0.2.3";
+ const char REASON[] = "DENY";
+
+ add_entry(HOST1, REASON);
+ add_entry(HOST2, REASON);
+ add_entry(HOST3, REASON);
+
+ struct kod_entry* result;
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOST2, &result));
+ free(result);
+
+ delete_entry(HOST2, REASON);
+
+ TEST_ASSERT_EQUAL(0, search_entry(HOST2, &result));
+
+ // Ensure that the other entry is still there.
+ TEST_ASSERT_EQUAL(1, search_entry(HOST1, &result));
+ free(result);
+}
diff --git a/contrib/ntp/sntp/tests/kodFile.c b/contrib/ntp/sntp/tests/kodFile.c
new file mode 100644
index 000000000000..f99d8cf2084c
--- /dev/null
+++ b/contrib/ntp/sntp/tests/kodFile.c
@@ -0,0 +1,156 @@
+#include "config.h"
+
+#include "ntp_types.h"
+#include "ntp_stdlib.h" // For estrdup()
+#include "fileHandlingTest.h"
+#include "kod_management.h"
+
+#include "unity.h"
+
+/*
+ * We access some parts of the kod database directly, without
+ * going through the public interface
+ */
+extern int kod_db_cnt;
+extern struct kod_entry** kod_db;
+extern char* kod_db_file;
+
+void setUp(void);
+void test_ReadEmptyFile(void);
+void test_ReadCorrectFile(void);
+void test_ReadFileWithBlankLines(void);
+void test_WriteEmptyFile(void);
+void test_WriteFileWithSingleEntry(void);
+void test_WriteFileWithMultipleEntries(void);
+
+
+void
+setUp(void) {
+ kod_db_cnt = 0;
+ kod_db = NULL;
+ init_lib();
+}
+
+
+void
+test_ReadEmptyFile(void) {
+ kod_init_kod_db(CreatePath("kod-test-empty", INPUT_DIR), TRUE);
+
+ TEST_ASSERT_EQUAL(0, kod_db_cnt);
+}
+
+
+void
+test_ReadCorrectFile(void) {
+ kod_init_kod_db(CreatePath("kod-test-correct", INPUT_DIR), TRUE);
+
+ TEST_ASSERT_EQUAL(2, kod_db_cnt);
+
+ struct kod_entry* res;
+
+ TEST_ASSERT_EQUAL(1, search_entry("192.0.2.5", &res));
+ TEST_ASSERT_EQUAL_STRING("DENY", res->type);
+ TEST_ASSERT_EQUAL_STRING("192.0.2.5", res->hostname);
+ TEST_ASSERT_EQUAL(0x12345678, res->timestamp);
+
+ TEST_ASSERT_EQUAL(1, search_entry("192.0.2.100", &res));
+ TEST_ASSERT_EQUAL_STRING("RSTR", res->type);
+ TEST_ASSERT_EQUAL_STRING("192.0.2.100", res->hostname);
+ TEST_ASSERT_EQUAL(0xfff, res->timestamp);
+}
+
+
+void
+test_ReadFileWithBlankLines(void) {
+ kod_init_kod_db(CreatePath("kod-test-blanks", INPUT_DIR), TRUE);
+
+ TEST_ASSERT_EQUAL(3, kod_db_cnt);
+
+ struct kod_entry* res;
+
+ TEST_ASSERT_EQUAL(1, search_entry("192.0.2.5", &res));
+ TEST_ASSERT_EQUAL_STRING("DENY", res->type);
+ TEST_ASSERT_EQUAL_STRING("192.0.2.5", res->hostname);
+ TEST_ASSERT_EQUAL(0x12345678, res->timestamp);
+
+ TEST_ASSERT_EQUAL(1, search_entry("192.0.2.100", &res));
+ TEST_ASSERT_EQUAL_STRING("RSTR", res->type);
+ TEST_ASSERT_EQUAL_STRING("192.0.2.100", res->hostname);
+ TEST_ASSERT_EQUAL(0xfff, res->timestamp);
+
+ TEST_ASSERT_EQUAL(1, search_entry("example.com", &res));
+ TEST_ASSERT_EQUAL_STRING("DENY", res->type);
+ TEST_ASSERT_EQUAL_STRING("example.com", res->hostname);
+ TEST_ASSERT_EQUAL(0xabcd, res->timestamp);
+}
+
+
+void
+test_WriteEmptyFile(void) {
+ kod_db_file = estrdup("kod-output-blank");
+ write_kod_db();
+
+ // Open file and ensure that the filesize is 0 bytes.
+ FILE * is = fopen(kod_db_file, "rb");
+ TEST_ASSERT_NOT_NULL(is);
+
+ TEST_ASSERT_EQUAL(0, GetFileSize(is));
+
+ fclose(is);
+}
+
+
+void
+test_WriteFileWithSingleEntry(void) {
+ kod_db_file = estrdup("kod-output-single");
+ add_entry("host1", "DENY");
+
+ // Here we must manipulate the timestamps, so they match the one in
+ // the expected file.
+
+ kod_db[0]->timestamp = 1;
+
+ write_kod_db();
+
+ // Open file and compare sizes.
+ FILE * actual = fopen(kod_db_file, "rb");
+ FILE * expected = fopen(CreatePath("kod-expected-single", INPUT_DIR),"rb");
+
+ TEST_ASSERT_NOT_NULL(actual);
+ TEST_ASSERT_NOT_NULL(expected);
+
+ TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual));
+
+ TEST_ASSERT_TRUE(CompareFileContent(expected, actual));
+}
+
+
+void
+test_WriteFileWithMultipleEntries(void) {
+ kod_db_file = estrdup("kod-output-multiple");
+ add_entry("example.com", "RATE");
+ add_entry("192.0.2.1", "DENY");
+ add_entry("192.0.2.5", "RSTR");
+
+ //
+ // Manipulate timestamps. This is a bit of a hack, ideally these
+ // tests should not care about the internal representation.
+ //
+ kod_db[0]->timestamp = 0xabcd;
+ kod_db[1]->timestamp = 0xabcd;
+ kod_db[2]->timestamp = 0xabcd;
+
+ write_kod_db();
+
+ // Open file and compare sizes and content.
+ FILE * actual = fopen(kod_db_file, "rb");
+ FILE * expected = fopen(CreatePath("kod-expected-multiple", INPUT_DIR),"rb");
+
+ TEST_ASSERT_NOT_NULL(actual);
+ TEST_ASSERT_NOT_NULL(expected);
+
+
+ TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual));
+
+ TEST_ASSERT_TRUE(CompareFileContent(expected, actual));
+}
diff --git a/contrib/ntp/sntp/tests/networking.c b/contrib/ntp/sntp/tests/networking.c
new file mode 100644
index 000000000000..e2e37123952e
--- /dev/null
+++ b/contrib/ntp/sntp/tests/networking.c
@@ -0,0 +1,7 @@
+#include "config.h"
+
+#include "sntptest.h"
+
+#include "networking.h"
+
+#include "unity.h"
diff --git a/contrib/ntp/sntp/tests/packetHandling.c b/contrib/ntp/sntp/tests/packetHandling.c
new file mode 100644
index 000000000000..595efa3b129a
--- /dev/null
+++ b/contrib/ntp/sntp/tests/packetHandling.c
@@ -0,0 +1,313 @@
+#include "config.h"
+#include "ntp_debug.h"
+#include "ntp_stdlib.h"
+#include "ntp_types.h"
+
+#include "sntptest.h"
+
+#include "kod_management.h"
+#include "main.h"
+#include "networking.h"
+#include "ntp.h"
+
+#include "unity.h"
+
+void setUp(void);
+int LfpEquality(const l_fp expected, const l_fp actual);
+void test_GenerateUnauthenticatedPacket(void);
+void test_GenerateAuthenticatedPacket(void);
+void test_OffsetCalculationPositiveOffset(void);
+void test_OffsetCalculationNegativeOffset(void);
+void test_HandleUnusableServer(void);
+void test_HandleUnusablePacket(void);
+void test_HandleServerAuthenticationFailure(void);
+void test_HandleKodDemobilize(void);
+void test_HandleKodRate(void);
+void test_HandleCorrectPacket(void);
+
+
+void
+setUp(void)
+{
+ init_lib();
+}
+
+
+int
+LfpEquality(
+ const l_fp expected,
+ const l_fp actual
+ )
+{
+ return !!(L_ISEQU(&expected, &actual));
+}
+
+
+void
+test_GenerateUnauthenticatedPacket(void)
+{
+ struct pkt testpkt;
+ struct timeval xmt;
+ l_fp expected_xmt, actual_xmt;
+
+ GETTIMEOFDAY(&xmt, NULL);
+ xmt.tv_sec += JAN_1970;
+
+ TEST_ASSERT_EQUAL(LEN_PKT_NOMAC,
+ generate_pkt(&testpkt, &xmt, 0, NULL));
+
+ TEST_ASSERT_EQUAL(LEAP_NOTINSYNC, PKT_LEAP(testpkt.li_vn_mode));
+ TEST_ASSERT_EQUAL(NTP_VERSION, PKT_VERSION(testpkt.li_vn_mode));
+ TEST_ASSERT_EQUAL(MODE_CLIENT, PKT_MODE(testpkt.li_vn_mode));
+
+ TEST_ASSERT_EQUAL(STRATUM_UNSPEC, PKT_TO_STRATUM(testpkt.stratum));
+ TEST_ASSERT_EQUAL(8, testpkt.ppoll);
+
+ TVTOTS(&xmt, &expected_xmt);
+ NTOHL_FP(&testpkt.xmt, &actual_xmt);
+ TEST_ASSERT_TRUE(LfpEquality(expected_xmt, actual_xmt));
+}
+
+
+void
+test_GenerateAuthenticatedPacket(void)
+{
+ static const int EXPECTED_PKTLEN = LEN_PKT_NOMAC + MAX_MD5_LEN;
+
+ struct key testkey;
+ struct pkt testpkt;
+ struct timeval xmt;
+ l_fp expected_xmt, actual_xmt;
+ char expected_mac[MAX_MD5_LEN];
+
+ testkey.next = NULL;
+ testkey.key_id = 30;
+ testkey.key_len = 9;
+ memcpy(testkey.key_seq, "123456789", testkey.key_len);
+ memcpy(testkey.type, "MD5", 3);
+
+ GETTIMEOFDAY(&xmt, NULL);
+ xmt.tv_sec += JAN_1970;
+
+ TEST_ASSERT_EQUAL(EXPECTED_PKTLEN,
+ generate_pkt(&testpkt, &xmt, testkey.key_id, &testkey));
+
+ TEST_ASSERT_EQUAL(LEAP_NOTINSYNC, PKT_LEAP(testpkt.li_vn_mode));
+ TEST_ASSERT_EQUAL(NTP_VERSION, PKT_VERSION(testpkt.li_vn_mode));
+ TEST_ASSERT_EQUAL(MODE_CLIENT, PKT_MODE(testpkt.li_vn_mode));
+
+ TEST_ASSERT_EQUAL(STRATUM_UNSPEC, PKT_TO_STRATUM(testpkt.stratum));
+ TEST_ASSERT_EQUAL(8, testpkt.ppoll);
+
+ TVTOTS(&xmt, &expected_xmt);
+ NTOHL_FP(&testpkt.xmt, &actual_xmt);
+ TEST_ASSERT_TRUE(LfpEquality(expected_xmt, actual_xmt));
+
+ TEST_ASSERT_EQUAL(testkey.key_id, ntohl(testpkt.exten[0]));
+
+ TEST_ASSERT_EQUAL(MAX_MD5_LEN - 4, /* Remove the key_id, only keep the mac. */
+ make_mac(&testpkt, LEN_PKT_NOMAC, MAX_MD5_LEN, &testkey, expected_mac));
+ TEST_ASSERT_EQUAL_MEMORY(expected_mac, (char*)&testpkt.exten[1], MAX_MD5_LEN -4);
+}
+
+
+void
+test_OffsetCalculationPositiveOffset(void)
+{
+ struct pkt rpkt;
+ l_fp reftime, tmp;
+ struct timeval dst;
+ double offset, precision, synch_distance;
+
+ rpkt.precision = -16; /* 0,000015259 */
+ rpkt.rootdelay = HTONS_FP(DTOUFP(0.125));
+ rpkt.rootdisp = HTONS_FP(DTOUFP(0.25));
+
+ /* Synch Distance: (0.125+0.25)/2.0 == 0.1875 */
+ get_systime(&reftime);
+ HTONL_FP(&reftime, &rpkt.reftime);
+
+ /* T1 - Originate timestamp */
+ tmp.l_ui = 1000000000UL;
+ tmp.l_uf = 0UL;
+ HTONL_FP(&tmp, &rpkt.org);
+
+ /* T2 - Receive timestamp */
+ tmp.l_ui = 1000000001UL;
+ tmp.l_uf = 2147483648UL;
+ HTONL_FP(&tmp, &rpkt.rec);
+
+ /* T3 - Transmit timestamp */
+ tmp.l_ui = 1000000002UL;
+ tmp.l_uf = 0UL;
+ HTONL_FP(&tmp, &rpkt.xmt);
+
+ /* T4 - Destination timestamp as standard timeval */
+ tmp.l_ui = 1000000001UL;
+ tmp.l_uf = 0UL;
+ TSTOTV(&tmp, &dst);
+ dst.tv_sec -= JAN_1970;
+
+ offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance);
+
+ TEST_ASSERT_EQUAL_DOUBLE(1.25, offset);
+ TEST_ASSERT_EQUAL_DOUBLE(1. / ULOGTOD(16), precision);
+ /* 1.1250150000000001 ? */
+ TEST_ASSERT_EQUAL_DOUBLE(1.125015, synch_distance);
+}
+
+
+void
+test_OffsetCalculationNegativeOffset(void)
+{
+ struct pkt rpkt;
+ l_fp reftime, tmp;
+ struct timeval dst;
+ double offset, precision, synch_distance;
+
+ rpkt.precision = -1;
+ rpkt.rootdelay = HTONS_FP(DTOUFP(0.5));
+ rpkt.rootdisp = HTONS_FP(DTOUFP(0.5));
+
+ /* Synch Distance is (0.5+0.5)/2.0, or 0.5 */
+ get_systime(&reftime);
+ HTONL_FP(&reftime, &rpkt.reftime);
+
+ /* T1 - Originate timestamp */
+ tmp.l_ui = 1000000001UL;
+ tmp.l_uf = 0UL;
+ HTONL_FP(&tmp, &rpkt.org);
+
+ /* T2 - Receive timestamp */
+ tmp.l_ui = 1000000000UL;
+ tmp.l_uf = 2147483648UL;
+ HTONL_FP(&tmp, &rpkt.rec);
+
+ /*/ T3 - Transmit timestamp */
+ tmp.l_ui = 1000000001UL;
+ tmp.l_uf = 2147483648UL;
+ HTONL_FP(&tmp, &rpkt.xmt);
+
+ /* T4 - Destination timestamp as standard timeval */
+ tmp.l_ui = 1000000003UL;
+ tmp.l_uf = 0UL;
+
+ TSTOTV(&tmp, &dst);
+ dst.tv_sec -= JAN_1970;
+
+ offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance);
+
+ TEST_ASSERT_EQUAL_DOUBLE(-1, offset);
+ TEST_ASSERT_EQUAL_DOUBLE(1. / ULOGTOD(1), precision);
+ TEST_ASSERT_EQUAL_DOUBLE(1.3333483333333334, synch_distance);
+}
+
+
+void
+test_HandleUnusableServer(void)
+{
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+
+ ZERO(rpkt);
+ ZERO(host);
+ rpktl = SERVER_UNUSEABLE;
+ TEST_ASSERT_EQUAL(-1, handle_pkt(rpktl, &rpkt, &host, ""));
+}
+
+
+void
+test_HandleUnusablePacket(void)
+{
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+
+ ZERO(rpkt);
+ ZERO(host);
+ rpktl = PACKET_UNUSEABLE;
+ TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, ""));
+}
+
+
+void
+test_HandleServerAuthenticationFailure(void)
+{
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+
+ ZERO(rpkt);
+ ZERO(host);
+ rpktl = SERVER_AUTH_FAIL;
+ TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, ""));
+}
+
+
+void
+test_HandleKodDemobilize(void)
+{
+ static const char * HOSTNAME = "192.0.2.1";
+ static const char * REASON = "DENY";
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+ struct kod_entry * entry;
+
+ rpktl = KOD_DEMOBILIZE;
+ ZERO(rpkt);
+ memcpy(&rpkt.refid, REASON, 4);
+ ZERO(host);
+ host.sa4.sin_family = AF_INET;
+ host.sa4.sin_addr.s_addr = inet_addr(HOSTNAME);
+
+ /* Test that the KOD-entry is added to the database. */
+ kod_init_kod_db("/dev/null", TRUE);
+
+ TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, HOSTNAME));
+
+ TEST_ASSERT_EQUAL(1, search_entry(HOSTNAME, &entry));
+ TEST_ASSERT_EQUAL_MEMORY(REASON, entry->type, 4);
+}
+
+
+void
+test_HandleKodRate(void)
+{
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+
+ ZERO(rpkt);
+ ZERO(host);
+ rpktl = KOD_RATE;
+ TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, ""));
+}
+
+
+void
+test_HandleCorrectPacket(void)
+{
+ struct pkt rpkt;
+ sockaddr_u host;
+ int rpktl;
+ l_fp now;
+
+ /* We don't want our testing code to actually change the system clock. */
+ TEST_ASSERT_FALSE(ENABLED_OPT(STEP));
+ TEST_ASSERT_FALSE(ENABLED_OPT(SLEW));
+
+ get_systime(&now);
+ HTONL_FP(&now, &rpkt.reftime);
+ HTONL_FP(&now, &rpkt.org);
+ HTONL_FP(&now, &rpkt.rec);
+ HTONL_FP(&now, &rpkt.xmt);
+ rpktl = LEN_PKT_NOMAC;
+ ZERO(host);
+ AF(&host) = AF_INET;
+
+ TEST_ASSERT_EQUAL(0, handle_pkt(rpktl, &rpkt, &host, ""));
+}
+
+/* packetHandling.c */
diff --git a/contrib/ntp/sntp/tests/packetProcessing.c b/contrib/ntp/sntp/tests/packetProcessing.c
new file mode 100644
index 000000000000..660b5b6e20f1
--- /dev/null
+++ b/contrib/ntp/sntp/tests/packetProcessing.c
@@ -0,0 +1,457 @@
+#include "config.h"
+
+#include "sntptest.h"
+#include "networking.h"
+#include "ntp_stdlib.h"
+#include "unity.h"
+
+
+const char * Version = "stub unit test Version string";
+
+/* Hacks into the key database. */
+extern struct key* key_ptr;
+extern int key_cnt;
+
+
+void PrepareAuthenticationTest(int key_id,int key_len,const char* type,const void* key_seq);
+void PrepareAuthenticationTestMD5(int key_id,int key_len,const void* key_seq);
+void setUp(void);
+void tearDown(void);
+void test_TooShortLength(void);
+void test_LengthNotMultipleOfFour(void);
+void test_TooShortExtensionFieldLength(void);
+void test_UnauthenticatedPacketReject(void);
+void test_CryptoNAKPacketReject(void);
+void test_AuthenticatedPacketInvalid(void);
+void test_AuthenticatedPacketUnknownKey(void);
+void test_ServerVersionTooOld(void);
+void test_ServerVersionTooNew(void);
+void test_NonWantedMode(void);
+void test_KoDRate(void);
+void test_KoDDeny(void);
+void test_RejectUnsyncedServer(void);
+void test_RejectWrongResponseServerMode(void);
+void test_AcceptNoSentPacketBroadcastMode(void);
+void test_CorrectUnauthenticatedPacket(void);
+void test_CorrectAuthenticatedPacketMD5(void);
+void test_CorrectAuthenticatedPacketSHA1(void);
+
+/* [Bug 2998] There are some issues whith the definition of 'struct pkt'
+ * when AUTOKEY is undefined -- the formal struct is too small to hold
+ * all the extension fields that are going to be tested. We have to make
+ * sure we have the extra bytes, or the test yield undefined results due
+ * to buffer overrun.
+ */
+#ifndef AUTOKEY
+# define EXTRA_BUFSIZE 256
+#else
+# define EXTRA_BUFSIZE 0
+#endif
+
+union tpkt {
+ struct pkt p;
+ u_char b[sizeof(struct pkt) + EXTRA_BUFSIZE];
+};
+
+static union tpkt testpkt;
+static union tpkt testspkt;
+static sockaddr_u testsock;
+bool restoreKeyDb;
+
+
+void
+PrepareAuthenticationTest(
+ int key_id,
+ int key_len,
+ const char * type,
+ const void * key_seq
+ )
+{
+ char str[25];
+ snprintf(str, 25, "%d", key_id);
+ ActivateOption("-a", str);
+
+ key_cnt = 1;
+ key_ptr = emalloc(sizeof(struct key));
+ key_ptr->next = NULL;
+ key_ptr->key_id = key_id;
+ key_ptr->key_len = key_len;
+ memcpy(key_ptr->type, "MD5", 3);
+
+ TEST_ASSERT_TRUE(key_len < sizeof(key_ptr->key_seq));
+
+ memcpy(key_ptr->key_seq, key_seq, key_ptr->key_len);
+ restoreKeyDb = true;
+}
+
+
+void
+PrepareAuthenticationTestMD5(
+ int key_id,
+ int key_len,
+ const void * key_seq
+ )
+{
+ PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq);
+}
+
+
+void
+setUp(void)
+{
+
+ sntptest();
+ restoreKeyDb = false;
+
+ /* Initialize the test packet and socket,
+ * so they contain at least some valid data.
+ */
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION,
+ MODE_SERVER);
+ testpkt.p.stratum = STRATUM_REFCLOCK;
+ memcpy(&testpkt.p.refid, "GPS\0", 4);
+
+ /* Set the origin timestamp of the received packet to the
+ * same value as the transmit timestamp of the sent packet.
+ */
+ l_fp tmp;
+ tmp.l_ui = 1000UL;
+ tmp.l_uf = 0UL;
+
+ HTONL_FP(&tmp, &testpkt.p.org);
+ HTONL_FP(&tmp, &testspkt.p.xmt);
+}
+
+
+void
+tearDown(void)
+{
+ if (restoreKeyDb) {
+ key_cnt = 0;
+ free(key_ptr);
+ key_ptr = NULL;
+ }
+
+ sntptest_destroy(); /* only on the final test!! if counter == 0 etc... */
+}
+
+
+void
+test_TooShortLength(void)
+{
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC - 1,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC - 1,
+ MODE_BROADCAST, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_LengthNotMultipleOfFour(void)
+{
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC + 6,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC + 3,
+ MODE_BROADCAST, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_TooShortExtensionFieldLength(void)
+{
+ /* [Bug 2998] We have to get around the formal specification of
+ * the extension field if AUTOKEY is undefined. (At least CLANG
+ * issues a warning in this case. It's just a warning, but
+ * still...
+ */
+ uint32_t * pe = testpkt.p.exten + 7;
+
+ /* The lower 16-bits are the length of the extension field.
+ * This lengths must be multiples of 4 bytes, which gives
+ * a minimum of 4 byte extension field length.
+ */
+ *pe = htonl(3); /* 3 bytes is too short. */
+
+ /* We send in a pkt_len of header size + 4 byte extension
+ * header + 24 byte MAC, this prevents the length error to
+ * be caught at an earlier stage
+ */
+ int pkt_len = LEN_PKT_NOMAC + 4 + 24;
+
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_UnauthenticatedPacketReject(void)
+{
+ /* Activate authentication option */
+ ActivateOption("-a", "123");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ int pkt_len = LEN_PKT_NOMAC;
+
+ /* We demand authentication, but no MAC header is present. */
+ TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_CryptoNAKPacketReject(void)
+{
+ /* Activate authentication option */
+ ActivateOption("-a", "123");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ int pkt_len = LEN_PKT_NOMAC + 4; /* + 4 byte MAC = Crypto-NAK */
+
+ TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_AuthenticatedPacketInvalid(void)
+{
+ /* Activate authentication option */
+ PrepareAuthenticationTestMD5(50, 9, "123456789");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ /* Prepare the packet. */
+ int pkt_len = LEN_PKT_NOMAC;
+
+ testpkt.p.exten[0] = htonl(50);
+ int mac_len = make_mac(&testpkt.p, pkt_len,
+ MAX_MD5_LEN, key_ptr,
+ &testpkt.p.exten[1]);
+
+ pkt_len += 4 + mac_len;
+
+ /* Now, alter the MAC so it becomes invalid. */
+ testpkt.p.exten[1] += 1;
+
+ TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_AuthenticatedPacketUnknownKey(void)
+{
+ /* Activate authentication option */
+ PrepareAuthenticationTestMD5(30, 9, "123456789");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ /* Prepare the packet. Note that the Key-ID expected is 30, but
+ * the packet has a key id of 50.
+ */
+ int pkt_len = LEN_PKT_NOMAC;
+
+ testpkt.p.exten[0] = htonl(50);
+ int mac_len = make_mac(&testpkt.p, pkt_len,
+ MAX_MD5_LEN, key_ptr,
+ &testpkt.p.exten[1]);
+ pkt_len += 4 + mac_len;
+
+ TEST_ASSERT_EQUAL(SERVER_AUTH_FAIL,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_ServerVersionTooOld(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_OLDVERSION - 1,
+ MODE_CLIENT);
+ TEST_ASSERT_TRUE(PKT_VERSION(testpkt.p.li_vn_mode) < NTP_OLDVERSION);
+
+ int pkt_len = LEN_PKT_NOMAC;
+
+ TEST_ASSERT_EQUAL(SERVER_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_ServerVersionTooNew(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_VERSION + 1,
+ MODE_CLIENT);
+ TEST_ASSERT_TRUE(PKT_VERSION(testpkt.p.li_vn_mode) > NTP_VERSION);
+
+ int pkt_len = LEN_PKT_NOMAC;
+
+ TEST_ASSERT_EQUAL(SERVER_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_NonWantedMode(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_VERSION,
+ MODE_CLIENT);
+
+ /* The packet has a mode of MODE_CLIENT, but process_pkt expects
+ * MODE_SERVER
+ */
+ TEST_ASSERT_EQUAL(SERVER_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+/* Tests bug 1597 */
+void
+test_KoDRate(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.stratum = STRATUM_PKT_UNSPEC;
+ memcpy(&testpkt.p.refid, "RATE", 4);
+
+ TEST_ASSERT_EQUAL(KOD_RATE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_KoDDeny(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.stratum = STRATUM_PKT_UNSPEC;
+ memcpy(&testpkt.p.refid, "DENY", 4);
+
+ TEST_ASSERT_EQUAL(KOD_DEMOBILIZE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_RejectUnsyncedServer(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC,
+ NTP_VERSION,
+ MODE_SERVER);
+
+ TEST_ASSERT_EQUAL(SERVER_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_RejectWrongResponseServerMode(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ l_fp tmp;
+ tmp.l_ui = 1000UL;
+ tmp.l_uf = 0UL;
+ HTONL_FP(&tmp, &testpkt.p.org);
+
+ tmp.l_ui = 2000UL;
+ tmp.l_uf = 0UL;
+ HTONL_FP(&tmp, &testspkt.p.xmt);
+
+ TEST_ASSERT_EQUAL(PACKET_UNUSEABLE,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_AcceptNoSentPacketBroadcastMode(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ testpkt.p.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_VERSION,
+ MODE_BROADCAST);
+
+ TEST_ASSERT_EQUAL(LEN_PKT_NOMAC,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_BROADCAST, NULL, "UnitTest"));
+}
+
+
+void
+test_CorrectUnauthenticatedPacket(void)
+{
+ TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION));
+
+ TEST_ASSERT_EQUAL(LEN_PKT_NOMAC,
+ process_pkt(&testpkt.p, &testsock, LEN_PKT_NOMAC,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_CorrectAuthenticatedPacketMD5(void)
+{
+ PrepareAuthenticationTestMD5(10, 15, "123456789abcdef");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ int pkt_len = LEN_PKT_NOMAC;
+
+ /* Prepare the packet. */
+ testpkt.p.exten[0] = htonl(10);
+ int mac_len = make_mac(&testpkt.p, pkt_len,
+ MAX_MD5_LEN, key_ptr,
+ &testpkt.p.exten[1]);
+
+ pkt_len += 4 + mac_len;
+
+ TEST_ASSERT_EQUAL(pkt_len,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
+
+
+void
+test_CorrectAuthenticatedPacketSHA1(void)
+{
+ PrepareAuthenticationTest(20, 15, "SHA1", "abcdefghijklmno");
+ TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION));
+
+ int pkt_len = LEN_PKT_NOMAC;
+
+ /* Prepare the packet. */
+ testpkt.p.exten[0] = htonl(20);
+ int mac_len = make_mac(&testpkt.p, pkt_len,
+ MAX_MAC_LEN, key_ptr,
+ &testpkt.p.exten[1]);
+
+ pkt_len += 4 + mac_len;
+
+ TEST_ASSERT_EQUAL(pkt_len,
+ process_pkt(&testpkt.p, &testsock, pkt_len,
+ MODE_SERVER, &testspkt.p, "UnitTest"));
+}
diff --git a/contrib/ntp/sntp/tests/run-crypto.c b/contrib/ntp/sntp/tests/run-crypto.c
new file mode 100644
index 000000000000..8b2a73528f4a
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-crypto.c
@@ -0,0 +1,65 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_types.h"
+#include "sntptest.h"
+#include "crypto.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_MakeMd5Mac(void);
+extern void test_MakeSHA1Mac(void);
+extern void test_VerifyCorrectMD5(void);
+extern void test_VerifySHA1(void);
+extern void test_VerifyFailure(void);
+extern void test_PacketSizeNotMultipleOfFourBytes(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("crypto.c");
+ RUN_TEST(test_MakeMd5Mac, 12);
+ RUN_TEST(test_MakeSHA1Mac, 13);
+ RUN_TEST(test_VerifyCorrectMD5, 14);
+ RUN_TEST(test_VerifySHA1, 15);
+ RUN_TEST(test_VerifyFailure, 16);
+ RUN_TEST(test_PacketSizeNotMultipleOfFourBytes, 17);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-keyFile.c b/contrib/ntp/sntp/tests/run-keyFile.c
new file mode 100644
index 000000000000..862910903f9c
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-keyFile.c
@@ -0,0 +1,64 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "fileHandlingTest.h"
+#include "ntp_stdlib.h"
+#include "ntp_types.h"
+#include "crypto.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_ReadEmptyKeyFile(void);
+extern void test_ReadASCIIKeys(void);
+extern void test_ReadHexKeys(void);
+extern void test_ReadKeyFileWithComments(void);
+extern void test_ReadKeyFileWithInvalidHex(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("keyFile.c");
+ RUN_TEST(test_ReadEmptyKeyFile, 12);
+ RUN_TEST(test_ReadASCIIKeys, 13);
+ RUN_TEST(test_ReadHexKeys, 14);
+ RUN_TEST(test_ReadKeyFileWithComments, 15);
+ RUN_TEST(test_ReadKeyFileWithInvalidHex, 16);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-kodDatabase.c b/contrib/ntp/sntp/tests/run-kodDatabase.c
new file mode 100644
index 000000000000..f655a6adb850
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-kodDatabase.c
@@ -0,0 +1,67 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_workimpl.h"
+#include "ntp_types.h"
+#include "sntptest.h"
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+#include "kod_management.h"
+#include "ntp_io.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_SingleEntryHandling(void);
+extern void test_MultipleEntryHandling(void);
+extern void test_NoMatchInSearch(void);
+extern void test_AddDuplicate(void);
+extern void test_DeleteEntry(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("kodDatabase.c");
+ RUN_TEST(test_SingleEntryHandling, 14);
+ RUN_TEST(test_MultipleEntryHandling, 15);
+ RUN_TEST(test_NoMatchInSearch, 16);
+ RUN_TEST(test_AddDuplicate, 17);
+ RUN_TEST(test_DeleteEntry, 18);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-kodFile.c b/contrib/ntp/sntp/tests/run-kodFile.c
new file mode 100644
index 000000000000..3943550391e9
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-kodFile.c
@@ -0,0 +1,66 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_types.h"
+#include "ntp_stdlib.h"
+#include "fileHandlingTest.h"
+#include "kod_management.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_ReadEmptyFile(void);
+extern void test_ReadCorrectFile(void);
+extern void test_ReadFileWithBlankLines(void);
+extern void test_WriteEmptyFile(void);
+extern void test_WriteFileWithSingleEntry(void);
+extern void test_WriteFileWithMultipleEntries(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("kodFile.c");
+ RUN_TEST(test_ReadEmptyFile, 19);
+ RUN_TEST(test_ReadCorrectFile, 20);
+ RUN_TEST(test_ReadFileWithBlankLines, 21);
+ RUN_TEST(test_WriteEmptyFile, 22);
+ RUN_TEST(test_WriteFileWithSingleEntry, 23);
+ RUN_TEST(test_WriteFileWithMultipleEntries, 24);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-networking.c b/contrib/ntp/sntp/tests/run-networking.c
new file mode 100644
index 000000000000..70caaa034fea
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-networking.c
@@ -0,0 +1,52 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "sntptest.h"
+#include "networking.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("networking.c");
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-packetHandling.c b/contrib/ntp/sntp/tests/run-packetHandling.c
new file mode 100644
index 000000000000..bc20d7f48ba4
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-packetHandling.c
@@ -0,0 +1,78 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_debug.h"
+#include "ntp_stdlib.h"
+#include "ntp_types.h"
+#include "sntptest.h"
+#include "kod_management.h"
+#include "main.h"
+#include "networking.h"
+#include "ntp.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_GenerateUnauthenticatedPacket(void);
+extern void test_GenerateAuthenticatedPacket(void);
+extern void test_OffsetCalculationPositiveOffset(void);
+extern void test_OffsetCalculationNegativeOffset(void);
+extern void test_HandleUnusableServer(void);
+extern void test_HandleUnusablePacket(void);
+extern void test_HandleServerAuthenticationFailure(void);
+extern void test_HandleKodDemobilize(void);
+extern void test_HandleKodRate(void);
+extern void test_HandleCorrectPacket(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("packetHandling.c");
+ RUN_TEST(test_GenerateUnauthenticatedPacket, 17);
+ RUN_TEST(test_GenerateAuthenticatedPacket, 18);
+ RUN_TEST(test_OffsetCalculationPositiveOffset, 19);
+ RUN_TEST(test_OffsetCalculationNegativeOffset, 20);
+ RUN_TEST(test_HandleUnusableServer, 21);
+ RUN_TEST(test_HandleUnusablePacket, 22);
+ RUN_TEST(test_HandleServerAuthenticationFailure, 23);
+ RUN_TEST(test_HandleKodDemobilize, 24);
+ RUN_TEST(test_HandleKodRate, 25);
+ RUN_TEST(test_HandleCorrectPacket, 26);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-packetProcessing.c b/contrib/ntp/sntp/tests/run-packetProcessing.c
new file mode 100644
index 000000000000..38f855273c66
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-packetProcessing.c
@@ -0,0 +1,89 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "sntptest.h"
+#include "networking.h"
+#include "ntp_stdlib.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_TooShortLength(void);
+extern void test_LengthNotMultipleOfFour(void);
+extern void test_TooShortExtensionFieldLength(void);
+extern void test_UnauthenticatedPacketReject(void);
+extern void test_CryptoNAKPacketReject(void);
+extern void test_AuthenticatedPacketInvalid(void);
+extern void test_AuthenticatedPacketUnknownKey(void);
+extern void test_ServerVersionTooOld(void);
+extern void test_ServerVersionTooNew(void);
+extern void test_NonWantedMode(void);
+extern void test_KoDRate(void);
+extern void test_KoDDeny(void);
+extern void test_RejectUnsyncedServer(void);
+extern void test_RejectWrongResponseServerMode(void);
+extern void test_AcceptNoSentPacketBroadcastMode(void);
+extern void test_CorrectUnauthenticatedPacket(void);
+extern void test_CorrectAuthenticatedPacketMD5(void);
+extern void test_CorrectAuthenticatedPacketSHA1(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("packetProcessing.c");
+ RUN_TEST(test_TooShortLength, 20);
+ RUN_TEST(test_LengthNotMultipleOfFour, 21);
+ RUN_TEST(test_TooShortExtensionFieldLength, 22);
+ RUN_TEST(test_UnauthenticatedPacketReject, 23);
+ RUN_TEST(test_CryptoNAKPacketReject, 24);
+ RUN_TEST(test_AuthenticatedPacketInvalid, 25);
+ RUN_TEST(test_AuthenticatedPacketUnknownKey, 26);
+ RUN_TEST(test_ServerVersionTooOld, 27);
+ RUN_TEST(test_ServerVersionTooNew, 28);
+ RUN_TEST(test_NonWantedMode, 29);
+ RUN_TEST(test_KoDRate, 30);
+ RUN_TEST(test_KoDDeny, 31);
+ RUN_TEST(test_RejectUnsyncedServer, 32);
+ RUN_TEST(test_RejectWrongResponseServerMode, 33);
+ RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 34);
+ RUN_TEST(test_CorrectUnauthenticatedPacket, 35);
+ RUN_TEST(test_CorrectAuthenticatedPacketMD5, 36);
+ RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 37);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-t-log.c b/contrib/ntp/sntp/tests/run-t-log.c
new file mode 100644
index 000000000000..8d1234570f68
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-t-log.c
@@ -0,0 +1,57 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "ntp_types.h"
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void testChangePrognameInMysyslog(void);
+extern void testOpenLogfileTest(void);
+extern void testWriteInCustomLogfile(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("t-log.c");
+ RUN_TEST(testChangePrognameInMysyslog, 10);
+ RUN_TEST(testOpenLogfileTest, 11);
+ RUN_TEST(testWriteInCustomLogfile, 12);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/run-utilities.c b/contrib/ntp/sntp/tests/run-utilities.c
new file mode 100644
index 000000000000..7c2237bbe159
--- /dev/null
+++ b/contrib/ntp/sntp/tests/run-utilities.c
@@ -0,0 +1,69 @@
+/* AUTOGENERATED FILE. DO NOT EDIT. */
+
+//=======Test Runner Used To Run Each Test Below=====
+#define RUN_TEST(TestFunc, TestLineNum) \
+{ \
+ Unity.CurrentTestName = #TestFunc; \
+ Unity.CurrentTestLineNumber = TestLineNum; \
+ Unity.NumberOfTests++; \
+ if (TEST_PROTECT()) \
+ { \
+ setUp(); \
+ TestFunc(); \
+ } \
+ if (TEST_PROTECT() && !TEST_IS_IGNORED) \
+ { \
+ tearDown(); \
+ } \
+ UnityConcludeTest(); \
+}
+
+//=======Automagically Detected Files To Include=====
+#include "unity.h"
+#include <setjmp.h>
+#include <stdio.h>
+#include "config.h"
+#include "sntptest.h"
+#include "fileHandlingTest.h"
+#include "main.h"
+#include "utilities.h"
+#include <math.h>
+
+//=======External Functions This Runner Calls=====
+extern void setUp(void);
+extern void tearDown(void);
+extern void test_IPv4Address(void);
+extern void test_IPv6Address(void);
+extern void test_SetLiVnMode1(void);
+extern void test_SetLiVnMode2(void);
+extern void test_PktOutput(void);
+extern void test_LfpOutputBinaryFormat(void);
+extern void test_LfpOutputDecimalFormat(void);
+
+
+//=======Test Reset Option=====
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+char const *progname;
+
+
+//=======MAIN=====
+int main(int argc, char *argv[])
+{
+ progname = argv[0];
+ UnityBegin("utilities.c");
+ RUN_TEST(test_IPv4Address, 16);
+ RUN_TEST(test_IPv6Address, 17);
+ RUN_TEST(test_SetLiVnMode1, 18);
+ RUN_TEST(test_SetLiVnMode2, 19);
+ RUN_TEST(test_PktOutput, 20);
+ RUN_TEST(test_LfpOutputBinaryFormat, 21);
+ RUN_TEST(test_LfpOutputDecimalFormat, 22);
+
+ return (UnityEnd());
+}
diff --git a/contrib/ntp/sntp/tests/sntptest.c b/contrib/ntp/sntp/tests/sntptest.c
new file mode 100644
index 000000000000..73c1ad26f396
--- /dev/null
+++ b/contrib/ntp/sntp/tests/sntptest.c
@@ -0,0 +1,33 @@
+
+#include "config.h"
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+#include "sntptest.h"
+
+void
+sntptest(void) {
+ optionSaveState(&sntpOptions);
+}
+
+
+void
+sntptest_destroy(void) {
+ optionRestore(&sntpOptions);
+}
+
+
+void
+ActivateOption(const char* option, const char* argument) {
+
+ const int ARGV_SIZE = 4;
+
+ char* opts[ARGV_SIZE];
+
+ opts[0] = estrdup("sntpopts");
+ opts[1] = estrdup(option);
+ opts[2] = estrdup(argument);
+ opts[3] = estrdup("127.0.0.1");
+
+ optionProcess(&sntpOptions, ARGV_SIZE, opts);
+}
+
diff --git a/contrib/ntp/sntp/tests/sntptest.h b/contrib/ntp/sntp/tests/sntptest.h
new file mode 100644
index 000000000000..82e2562dd290
--- /dev/null
+++ b/contrib/ntp/sntp/tests/sntptest.h
@@ -0,0 +1,11 @@
+#ifndef SNTPTEST_H
+#define SNTPTEST_H
+
+#include "ntp_stdlib.h"
+#include "sntp-opts.h"
+
+void sntptest(void);
+void sntptest_destroy(void);
+void ActivateOption(const char* option, const char* argument);
+
+#endif // SNTPTEST_H
diff --git a/contrib/ntp/sntp/tests/t-log.c b/contrib/ntp/sntp/tests/t-log.c
new file mode 100644
index 000000000000..08d4b6c59b2f
--- /dev/null
+++ b/contrib/ntp/sntp/tests/t-log.c
@@ -0,0 +1,87 @@
+#include "config.h"
+#include "unity.h"
+#include "ntp_types.h"
+
+
+//#include "log.h"
+#include "log.c"
+
+void setUp(void);
+void testChangePrognameInMysyslog(void);
+void testOpenLogfileTest(void);
+void testWriteInCustomLogfile(void);
+
+
+void
+setUp(void) {
+ init_lib();
+}
+
+
+//in var/log/syslog (may differ depending on your OS), logged name of the program will be "TEST_PROGNAME".
+
+void
+testChangePrognameInMysyslog(void)
+{
+ sntp_init_logging("TEST_PROGNAME");
+ msyslog(LOG_ERR, "TESTING sntp_init_logging()");
+
+ return;
+}
+
+//writes log files in your own file instead of syslog! (MAY BE USEFUL TO SUPPRESS ERROR MESSAGES!)
+
+void
+testOpenLogfileTest(void)
+{
+ sntp_init_logging("TEST_PROGNAME2"); //this name is consistent through the entire program unless changed
+ open_logfile("testLogfile.log");
+ //open_logfile("/var/log/syslog"); //this gives me "Permission Denied" when i do %m
+
+ msyslog(LOG_ERR, "Cannot open log file %s","abcXX");
+ //cleanup_log(); //unnecessary after log.c fix!
+
+ return;
+}
+
+
+//multiple cleanup_log() causes segfault. Probably the reason it's static. Opening multiple open_logfile(name) will cause segfault x.x I'm guessing it's not intended to be changed. Cleanup after unity test doesn't fix it, looks like. Calling in tearDown() also causes issues.
+
+void
+testWriteInCustomLogfile(void)
+{
+ char testString[256] = "12345 ABC";
+ char testName[256] = "TEST_PROGNAME3";
+
+ (void)remove("testLogfile2.log");
+
+ sntp_init_logging(testName);
+ open_logfile("testLogfile2.log"); // ./ causing issues
+ //sntp_init_logging(testName);
+
+
+ msyslog(LOG_ERR, "%s", testString);
+ FILE * f = fopen("testLogfile2.log","r");
+ char line[256];
+
+ TEST_ASSERT_TRUE( f != NULL);
+
+ //should be only 1 line
+ while (fgets(line, sizeof(line), f)) {
+ printf("%s", line);
+ }
+
+
+ char* x = strstr(line,testName);
+
+ TEST_ASSERT_TRUE( x != NULL);
+
+ x = strstr(line,testString);
+ TEST_ASSERT_TRUE( x != NULL);
+ //cleanup_log();
+ fclose(f); //using this will also cause segfault, because at the end, log.c will call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file);
+ //After the 1st fclose, syslog_file = NULL, and is never reset -> hopefully fixed by editing log.c
+ //TEST_ASSERT_EQUAL_STRING(testString,line); //doesn't work, line is dynamic because the process name is random.
+
+ return;
+}
diff --git a/contrib/ntp/sntp/tests/tests-runner b/contrib/ntp/sntp/tests/tests-runner
new file mode 100755
index 000000000000..412516ca6536
--- /dev/null
+++ b/contrib/ntp/sntp/tests/tests-runner
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# $builddir is always .
+builddir=.
+# $srcdir will be set to the correct directory when this script is called from
+# the Makefiles generated by Automake.
+
+# Create output directory.
+mkdir -p $builddir/data
+
+# Test executable expects two arguments: test_input_dir and test_output_dir.
+./tests $srcdir/data $builddir/data
+
diff --git a/contrib/ntp/sntp/tests/utilities.c b/contrib/ntp/sntp/tests/utilities.c
new file mode 100644
index 000000000000..a68aaacae9ae
--- /dev/null
+++ b/contrib/ntp/sntp/tests/utilities.c
@@ -0,0 +1,205 @@
+#include "config.h"
+
+#include "sntptest.h"
+#include "fileHandlingTest.h"
+#include "main.h"
+#include "utilities.h"
+
+#include "unity.h"
+
+#include <math.h>
+
+sockaddr_u CreateSockaddr4(const char* address);
+struct addrinfo CreateAddrinfo(sockaddr_u* sock);
+void InitDebugTest(const char * filename);
+void FinishDebugTest(const char * expected,const char * actual);
+void test_IPv4Address(void);
+void test_IPv6Address(void);
+void test_SetLiVnMode1(void);
+void test_SetLiVnMode2(void);
+void test_PktOutput(void);
+void test_LfpOutputBinaryFormat(void);
+void test_LfpOutputDecimalFormat(void);
+
+
+const char * Version = "stub unit test Version string";
+
+
+sockaddr_u
+CreateSockaddr4(const char* address) {
+ sockaddr_u s;
+ s.sa4.sin_family = AF_INET;
+ s.sa4.sin_addr.s_addr = inet_addr(address);
+ SET_PORT(&s, 123);
+
+ return s;
+}
+
+
+struct addrinfo
+CreateAddrinfo(sockaddr_u* sock) {
+ struct addrinfo a;
+ a.ai_family = sock->sa.sa_family;
+ a.ai_addrlen = SIZEOF_SOCKADDR(a.ai_family);
+ a.ai_addr = &sock->sa;
+ return a;
+}
+
+
+bool outputFileOpened;
+FILE* outputFile;
+
+
+void
+InitDebugTest(const char * filename) {
+ // Clear the contents of the current file.
+ // Open the output file
+ outputFile = fopen(filename, "w+");
+ TEST_ASSERT_NOT_NULL(outputFile);
+ outputFileOpened = true;
+}
+
+
+// Closes outputFile, and compare contents.
+void
+FinishDebugTest(const char * expected,
+ const char * actual) {
+ if (outputFileOpened)
+ fclose(outputFile);
+
+ FILE * e = fopen(expected,"rb");
+ FILE * a = fopen(actual,"rb");
+ TEST_ASSERT_NOT_NULL(e);
+ TEST_ASSERT_NOT_NULL(a);
+
+ CompareFileContent(e, a);
+}
+
+
+/*
+ * These tests are essentially a copy of the tests for socktoa()
+ * in libntp. If sntp switches to using that functions, these
+ * tests can be removed.
+ */
+
+void
+test_IPv4Address(void) {
+ const char* ADDR = "192.0.2.10";
+
+ sockaddr_u input = CreateSockaddr4(ADDR);
+ struct addrinfo inputA = CreateAddrinfo(&input);
+
+ TEST_ASSERT_EQUAL_STRING(ADDR, ss_to_str(&input));
+ TEST_ASSERT_EQUAL_STRING(ADDR, addrinfo_to_str(&inputA));
+}
+
+
+void
+test_IPv6Address(void) {
+ const struct in6_addr address = { { {
+ 0x20, 0x01, 0x0d, 0xb8,
+ 0x85, 0xa3, 0x08, 0xd3,
+ 0x13, 0x19, 0x8a, 0x2e,
+ 0x03, 0x70, 0x73, 0x34
+ } } };
+ const char * expected = "2001:db8:85a3:8d3:1319:8a2e:370:7334";
+ sockaddr_u input;
+ struct addrinfo inputA;
+
+ memset(&input, 0, sizeof(input));
+ input.sa6.sin6_family = AF_INET6;
+ input.sa6.sin6_addr = address;
+ TEST_ASSERT_EQUAL_STRING(expected, ss_to_str(&input));
+
+ inputA = CreateAddrinfo(&input);
+ TEST_ASSERT_EQUAL_STRING(expected, addrinfo_to_str(&inputA));
+}
+
+
+void
+test_SetLiVnMode1(void) {
+ struct pkt expected;
+ expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_VERSION,
+ MODE_SERVER);
+
+ struct pkt actual;
+ set_li_vn_mode(&actual, LEAP_NOWARNING, NTP_VERSION,
+ MODE_SERVER);
+
+ TEST_ASSERT_EQUAL(expected.li_vn_mode, actual.li_vn_mode);
+}
+
+
+void
+test_SetLiVnMode2(void) {
+ struct pkt expected;
+ expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC,
+ NTP_OLDVERSION,
+ MODE_BROADCAST);
+
+ struct pkt actual;
+ set_li_vn_mode(&actual, LEAP_NOTINSYNC, NTP_OLDVERSION,
+ MODE_BROADCAST);
+
+ TEST_ASSERT_EQUAL(expected.li_vn_mode, actual.li_vn_mode);
+}
+
+/* Debug utilities tests */
+
+void
+test_PktOutput(void) {
+ char * filename = "debug-output-pkt";
+ InitDebugTest(filename);
+
+ struct pkt testpkt;
+ memset(&testpkt, 0, sizeof(struct pkt));
+ testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING,
+ NTP_VERSION,
+ MODE_SERVER);
+
+ l_fp test;
+ test.l_ui = 8;
+ test.l_uf = 2147483647; // Lots of ones.
+ HTONL_FP(&test, &testpkt.xmt);
+
+ pkt_output(&testpkt, LEN_PKT_NOMAC, outputFile);
+
+ FinishDebugTest(CreatePath("debug-input-pkt", INPUT_DIR), filename);
+}
+
+
+void
+test_LfpOutputBinaryFormat(void) {
+ char * filename = "debug-output-lfp-bin";//CreatePath("debug-output-lfp-bin", OUTPUT_DIR);
+ InitDebugTest(filename);
+
+ l_fp test;
+ test.l_ui = 63; // 00000000 00000000 00000000 00111111
+ test.l_uf = 127; // 00000000 00000000 00000000 01111111
+
+ l_fp network;
+ HTONL_FP(&test, &network);
+
+ l_fp_output_bin(&network, outputFile);
+
+ FinishDebugTest(CreatePath("debug-input-lfp-bin", INPUT_DIR), filename);
+}
+
+
+void
+test_LfpOutputDecimalFormat(void) {
+ char * filename = "debug-output-lfp-dec";
+ InitDebugTest(filename);
+
+ l_fp test;
+ test.l_ui = 6310; // 0x000018A6
+ test.l_uf = 308502; // 0x00004B516
+
+ l_fp network;
+ HTONL_FP(&test, &network);
+
+ l_fp_output_dec(&network, outputFile);
+
+ FinishDebugTest(CreatePath("debug-input-lfp-dec", INPUT_DIR), filename);
+}