diff options
Diffstat (limited to 'contrib/ntp/sntp')
92 files changed, 1994 insertions, 4824 deletions
diff --git a/contrib/ntp/sntp/Makefile.am b/contrib/ntp/sntp/Makefile.am index dfd303a..5c30fc2 100644 --- a/contrib/ntp/sntp/Makefile.am +++ b/contrib/ntp/sntp/Makefile.am @@ -38,27 +38,13 @@ bin_PROGRAMS = @SNTP_DB@ libexec_PROGRAMS = @SNTP_DL@ sbin_PROGRAMS = @SNTP_DS@ -## -## DIST_SUBDIRS is typically automatically derived by automake including -## all possible SUBDIRS values, as even items which are not built are -## typically distributed. -## -## To allow us to avoid configuring the libevent tearoff entirely when -## it is not needed, we define DIST_SUBDIRS manually excluding libevent -## when not building it, and in that case arrange for its distribution -## with EXTRA_DIST copying the entire directory and libevent-dist-hook -## cleaning unwanted VCS remnants. -## -## When we are building libevent, it is distributed conventionally, by -## recursive make dist in sntp including libevent. -## - SUBDIRS = include scripts unity -DIST_SUBDIRS = include scripts unity +DIST_FAIL = if BUILD_LIBEVENT SUBDIRS += libevent -DIST_SUBDIRS += libevent +else +DIST_FAIL += "--enable-local-libevent" endif if NEED_LIBOPTS @@ -70,8 +56,6 @@ noinst_LIBRARIES = libsntp.a SUBDIRS += tests endif -DIST_SUBDIRS += libopts tests - libsntp_a_SOURCES = \ crypto.c \ kod_management.c \ @@ -94,7 +78,6 @@ noinst_HEADERS = \ main.h \ networking.h \ sntp-opts.h \ - tests_main.h \ utilities.h \ $(NULL) @@ -285,11 +268,19 @@ $(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(src libtool: $(LIBTOOL_DEPS) ./config.status --recheck -libevent-dist-hook: - if test -n "$(NTP_FORCE_LIBEVENT_DIST)" ; then rm -rf $(distdir)/libevent/autom4te.cache $(distdir)/libevent/config.h.in~ ; find $(distdir)/libevent -type d -name SCCS -print | xargs rm -rf ; fi - -dist-hook: libevent-dist-hook - @: do-nothing action to avoid default SCCS get +# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST. +# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am +# but explicit in Makefile.in). This check doesn't help with distclean. +libevent: distdir-pre-check + +# HMS: Stops the build for gmake or pmake +distdir-pre-check: + case "$(DIST_FAIL)" in \ + '') ;; \ + *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.); \ + echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution."; \ + exit 1 ;; \ + esac include $(top_srcdir)/bincheck.mf include $(top_srcdir)/check-libntp.mf diff --git a/contrib/ntp/sntp/Makefile.in b/contrib/ntp/sntp/Makefile.in index c796888..39f7dc7 100644 --- a/contrib/ntp/sntp/Makefile.in +++ b/contrib/ntp/sntp/Makefile.in @@ -97,7 +97,7 @@ build_triplet = @build@ host_triplet = @host@ EXTRA_PROGRAMS = sntp$(EXEEXT) @BUILD_LIBEVENT_TRUE@am__append_1 = libevent -@BUILD_LIBEVENT_TRUE@am__append_2 = libevent +@BUILD_LIBEVENT_FALSE@am__append_2 = "--enable-local-libevent" @NEED_LIBOPTS_TRUE@am__append_3 = libopts @BUILD_SNTP_TRUE@am__append_4 = tests subdir = . @@ -278,6 +278,7 @@ am__define_uniq_tagged_files = \ ETAGS = etags CTAGS = ctags CSCOPE = cscope +DIST_SUBDIRS = include scripts unity libevent libopts tests am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/bincheck.mf $(top_srcdir)/check-libntp.mf \ $(top_srcdir)/check-libopts.mf $(top_srcdir)/depsver.mf \ @@ -347,6 +348,7 @@ 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@ @@ -355,6 +357,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -408,6 +411,7 @@ 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@ @@ -596,7 +600,7 @@ libexec_PROGRAMS = @SNTP_DL@ sbin_PROGRAMS = @SNTP_DS@ SUBDIRS = include scripts unity $(am__append_1) $(am__append_3) \ $(am__append_4) -DIST_SUBDIRS = include scripts unity $(am__append_2) libopts tests +DIST_FAIL = $(am__append_2) @BUILD_SNTP_TRUE@noinst_LIBRARIES = libsntp.a libsntp_a_SOURCES = \ crypto.c \ @@ -620,7 +624,6 @@ noinst_HEADERS = \ main.h \ networking.h \ sntp-opts.h \ - tests_main.h \ utilities.h \ $(NULL) @@ -1206,9 +1209,6 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ @@ -1471,9 +1471,9 @@ uninstall-man: uninstall-man1 uninstall-man8 am--refresh check check-am clean clean-binPROGRAMS \ clean-cscope clean-generic clean-libexecPROGRAMS clean-libtool \ clean-noinstLIBRARIES clean-sbinPROGRAMS cscope cscopelist-am \ - ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \ - distclean distclean-compile distclean-generic distclean-hdr \ + ctags ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \ + dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ distclean-libtool distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-binPROGRAMS install-data \ @@ -1610,11 +1610,19 @@ $(srcdir)/sntp.html: $(srcdir)/invoke-sntp.menu $(srcdir)/invoke-sntp.texi $(src libtool: $(LIBTOOL_DEPS) ./config.status --recheck -libevent-dist-hook: - if test -n "$(NTP_FORCE_LIBEVENT_DIST)" ; then rm -rf $(distdir)/libevent/autom4te.cache $(distdir)/libevent/config.h.in~ ; find $(distdir)/libevent -type d -name SCCS -print | xargs rm -rf ; fi - -dist-hook: libevent-dist-hook - @: do-nothing action to avoid default SCCS get +# HMS: libevent/ is a target if it's in EXTRA_DIST via NTP_FORCE_LIBEVENT_DIST. +# Note that libevent/ is already in DIST_SUBDIRS (implicit in Makefile.am +# but explicit in Makefile.in). This check doesn't help with distclean. +libevent: distdir-pre-check + +# HMS: Stops the build for gmake or pmake +distdir-pre-check: + case "$(DIST_FAIL)" in \ + '') ;; \ + *) $(error re-run configure adding $(DIST_FAIL) if you want to make a distribution.); \ + echo "re-run configure adding $(DIST_FAIL) if you want to make a distribution."; \ + exit 1 ;; \ + esac install-exec-hook: @test -z "${bin_PROGRAMS}${bin_SCRIPTS}" \ diff --git a/contrib/ntp/sntp/configure b/contrib/ntp/sntp/configure index 5798489..74d0587 100755 --- a/contrib/ntp/sntp/configure +++ b/contrib/ntp/sntp/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sntp 4.2.8p3. +# Generated by GNU Autoconf 2.69 for sntp 4.2.8p4. # # Report bugs to <http://bugs.ntp.org./>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sntp' PACKAGE_TARNAME='sntp' -PACKAGE_VERSION='4.2.8p3' -PACKAGE_STRING='sntp 4.2.8p3' +PACKAGE_VERSION='4.2.8p4' +PACKAGE_STRING='sntp 4.2.8p4' PACKAGE_BUGREPORT='http://bugs.ntp.org./' PACKAGE_URL='http://www.ntp.org./' @@ -660,6 +660,7 @@ BUILD_LIBEVENT_FALSE BUILD_LIBEVENT_TRUE LDADD_LIBEVENT CPPFLAGS_LIBEVENT +CFLAGS_LIBEVENT PKG_CONFIG NTP_FORCE_LIBEVENT_DIST LIBOPTS_DIR @@ -696,6 +697,8 @@ PTHREADS_FALSE PTHREADS_TRUE LIBISC_PTHREADS_NOTHREADS PTHREAD_LIBS +LTHREAD_LIBS +BUILD_THREAD HAVE_INLINE LDADD_LIBUTIL ALLOCA @@ -1488,7 +1491,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sntp 4.2.8p3 to adapt to many kinds of systems. +\`configure' configures sntp 4.2.8p4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1558,7 +1561,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sntp 4.2.8p3:";; + short | recursive ) echo "Configuration of sntp 4.2.8p4:";; esac cat <<\_ACEOF @@ -1703,7 +1706,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sntp configure 4.2.8p3 +sntp configure 4.2.8p4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2533,7 +2536,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sntp $as_me 4.2.8p3, which was +It was created by sntp $as_me 4.2.8p4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2912,6 +2915,12 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + # Bump sntp_configure_cache_version for each change to configure.ac or # .m4 files which invalidates cached values from previous configure @@ -3524,7 +3533,7 @@ fi # Define the identity of the package. PACKAGE='sntp' - VERSION='4.2.8p3' + VERSION='4.2.8p4' cat >>confdefs.h <<_ACEOF @@ -6552,7 +6561,7 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking additional compiler flags" >&5 $as_echo_n "checking additional compiler flags... " >&6; } - # allow ntp_os_flags to be preset to skip this stuff + # allow ntp_os_cflags to be preset to skip this stuff case "${ntp_os_cflags+set}" in set) ;; @@ -6640,7 +6649,7 @@ $as_echo_n "checking additional compiler flags... " >&6; } ;; esac esac - case "$ntp_os_flags" in + case "$ntp_os_cflags" in '') ntp_os_cflags_msg="none needed" ;; @@ -6651,6 +6660,38 @@ $as_echo_n "checking additional compiler flags... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_os_cflags_msg" >&5 $as_echo "$ntp_os_cflags_msg" >&6; } { ntp_os_cflags_msg=; unset ntp_os_cflags_msg;} + ### + { $as_echo "$as_me:${as_lineno-$LINENO}: checking additional linker flags" >&5 +$as_echo_n "checking additional linker flags... " >&6; } + # HMS: The following might still need tweaking + # allow ntp_os_ldflags to be preset to skip this stuff + case "${ntp_os_ldflags+set}" in + set) + ;; + *) + ntp_os_ldflags= + case "$host_os" in + hpux*) + case "$GCC" in + yes) + ntp_os_ldflags="-Wl,+allowdups" + ;; + esac + ;; + esac + ;; + esac + case "$ntp_os_ldflags" in + '') + ntp_os_ldflags_msg="none needed" + ;; + *) + ntp_os_ldflags_msg="$ntp_os_ldflags" + esac + LDFLAGS_NTP="$LDFLAGS_NTP $ntp_os_ldflags" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_os_ldflags_msg" >&5 +$as_echo "$ntp_os_ldflags_msg" >&6; } + { ntp_os_ldflags_msg=; unset ntp_os_ldflags_msg;} @@ -10527,7 +10568,8 @@ fi have_pthreads=no case "$enable_thread_support" in - yes) + no) ;; + *) ol_found_pthreads=no @@ -13944,6 +13986,9 @@ $as_echo "$ol_cv_pthread_lib_lpthreads" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: ol_link_threads: <$ol_link_threads> ol_link_pthreads <$ol_link_pthreads>" >&5 +$as_echo "$as_me: ol_link_threads: <$ol_link_threads> ol_link_pthreads <$ol_link_pthreads>" >&6;} + if test $ol_link_threads != no ; then LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads" @@ -14984,6 +15029,10 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + case "$ol_found_pthreads" in yes) saved_LIBS="$LIBS" @@ -15009,56 +15058,6 @@ done yes) PTHREAD_LIBS="$LTHREAD_LIBS" have_pthreads=yes - # Bug 2332: With GCC we need to force a reference to libgcc_s - # (if libgcc_s exists) or the combination of - # threads + setuid + mlockall does not work on linux because - # thread cancellation fails to load libgcc_s with dlopen(). - # We have to pass this all as linker options to avoid argument - # reordering by libtool. - case "$GCC$with_gnu_ld" in - yesyes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -lgcc_s" >&5 -$as_echo_n "checking for exit in -lgcc_s... " >&6; } -if ${ac_cv_lib_gcc_s_exit+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lgcc_s $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char exit (); -int -main () -{ -return exit (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_gcc_s_exit=yes -else - ac_cv_lib_gcc_s_exit=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcc_s_exit" >&5 -$as_echo "$ac_cv_lib_gcc_s_exit" >&6; } -if test "x$ac_cv_lib_gcc_s_exit" = xyes; then : - PTHREAD_LIBS="$LTHREAD_LIBS -Wl,--no-as-needed,-lgcc_s,--as-needed" -fi - - ;; - esac esac esac esac @@ -25132,6 +25131,7 @@ ntp_libevent_tearoff=libevent + case "$ntp_use_local_libevent" in yes) ;; @@ -25145,6 +25145,7 @@ $as_echo_n "checking if libevent $ntp_libevent_min_version or later is installed ntp_use_local_libevent=no { $as_echo "$as_me:${as_lineno-$LINENO}: Using the installed libevent" >&5 $as_echo "$as_me: Using the installed libevent" >&6;} + CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads` CPPFLAGS_LIBEVENT=`$PKG_CONFIG --cflags-only-I libevent` # HMS: I hope the following is accurate. # We don't need -levent, we only need -levent_core. @@ -25174,6 +25175,9 @@ $as_echo "$as_me: Using the installed libevent" >&6;} $as_echo "yes" >&6; } else ntp_use_local_libevent=yes + # HMS: do we only need to do this if LIBISC_PTHREADS_NOTHREADS + # is "pthreads"? + CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads` { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi @@ -25199,6 +25203,7 @@ $as_echo "$as_me: Using libevent tearoff" >&6;} esac esac + if test "x$ntp_use_local_libevent" = "xyes"; then BUILD_LIBEVENT_TRUE= BUILD_LIBEVENT_FALSE='#' @@ -31104,7 +31109,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sntp $as_me 4.2.8p3, which was +This file was extended by sntp $as_me 4.2.8p4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -31171,7 +31176,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sntp config.status 4.2.8p3 +sntp config.status 4.2.8p4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/contrib/ntp/sntp/configure.ac b/contrib/ntp/sntp/configure.ac index c0c98dc..a08aa13 100644 --- a/contrib/ntp/sntp/configure.ac +++ b/contrib/ntp/sntp/configure.ac @@ -11,6 +11,7 @@ AC_INIT( ) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_AUX_DIR([libevent/build-aux]) +AC_LANG([C]) # Bump sntp_configure_cache_version for each change to configure.ac or # .m4 files which invalidates cached values from previous configure diff --git a/contrib/ntp/sntp/include/Makefile.in b/contrib/ntp/sntp/include/Makefile.in index 8289b41..1c8a179 100644 --- a/contrib/ntp/sntp/include/Makefile.in +++ b/contrib/ntp/sntp/include/Makefile.in @@ -156,6 +156,7 @@ 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@ @@ -164,6 +165,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -217,6 +219,7 @@ 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@ diff --git a/contrib/ntp/sntp/include/version.def b/contrib/ntp/sntp/include/version.def index b007651..9f1ca6b 100644 --- a/contrib/ntp/sntp/include/version.def +++ b/contrib/ntp/sntp/include/version.def @@ -1 +1 @@ -version = '4.2.8p3'; +version = '4.2.8p4'; diff --git a/contrib/ntp/sntp/include/version.texi b/contrib/ntp/sntp/include/version.texi index 4a13b8f..64f037b 100644 --- a/contrib/ntp/sntp/include/version.texi +++ b/contrib/ntp/sntp/include/version.texi @@ -1,3 +1,3 @@ -@set UPDATED 29 June 2015 -@set EDITION 4.2.8p3 -@set VERSION 4.2.8p3 +@set UPDATED 21 October 2015 +@set EDITION 4.2.8p4 +@set VERSION 4.2.8p4 diff --git a/contrib/ntp/sntp/invoke-sntp.texi b/contrib/ntp/sntp/invoke-sntp.texi index 708a370..9a726fa 100644 --- a/contrib/ntp/sntp/invoke-sntp.texi +++ b/contrib/ntp/sntp/invoke-sntp.texi @@ -6,7 +6,7 @@ # # EDIT THIS FILE WITH CAUTION (invoke-sntp.texi) # -# It has been AutoGen-ed June 29, 2015 at 04:23:30 PM by AutoGen 5.18.5 +# It has been AutoGen-ed October 21, 2015 at 12:30:56 PM by AutoGen 5.18.5 # From the definitions sntp-opts.def # and the template file agtexi-cmd.tpl @end ignore @@ -101,7 +101,7 @@ with a status code of 0. @exampleindent 0 @example -sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p3 +sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4 Usage: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \ [ hostname-or-IP ...] Flg Arg Option-Name Description diff --git a/contrib/ntp/sntp/libevent/Makefile.am b/contrib/ntp/sntp/libevent/Makefile.am index 3053cc0..1300e8f 100644 --- a/contrib/ntp/sntp/libevent/Makefile.am +++ b/contrib/ntp/sntp/libevent/Makefile.am @@ -140,7 +140,7 @@ CLEANFILES= DISTCLEANFILES= BUILT_SOURCES = include include/include.am -include sample/include.am +#include sample/include.am include test/include.am if BUILD_WIN32 diff --git a/contrib/ntp/sntp/libevent/Makefile.in b/contrib/ntp/sntp/libevent/Makefile.in index 61d96f5..81e121c 100644 --- a/contrib/ntp/sntp/libevent/Makefile.in +++ b/contrib/ntp/sntp/libevent/Makefile.in @@ -26,12 +26,6 @@ # # See LICENSE for copying information. -# sample/include.am for libevent -# Copyright 2000-2007 Niels Provos -# Copyright 2007-2012 Niels Provos and Nick Mathewson -# -# See LICENSE for copying information. - # test/Makefile.am for libevent # Copyright 2000-2007 Niels Provos # Copyright 2007-2012 Niels Provos and Nick Mathewson @@ -120,32 +114,26 @@ host_triplet = @host@ @PTHREADS_TRUE@am__append_2 = libevent_pthreads.pc @OPENSSL_TRUE@am__append_3 = libevent_openssl.la @OPENSSL_TRUE@am__append_4 = libevent_openssl.pc -noinst_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_6) +noinst_PROGRAMS = $(am__EXEEXT_3) EXTRA_PROGRAMS = $(am__EXEEXT_1) @INSTALL_LIBEVENT_FALSE@am__append_5 = $(EVENT2_EXPORT) -@OPENSSL_TRUE@am__append_6 = sample/le-proxy sample/https-client -@OPENSSL_TRUE@am__append_7 = \ -@OPENSSL_TRUE@ sample/hostcheck.h \ -@OPENSSL_TRUE@ sample/openssl_hostname_validation.h - -@BUILD_SAMPLES_TRUE@am__append_8 = $(SAMPLES) -@BUILD_REGRESS_TRUE@am__append_9 = $(TESTPROGRAMS) -@BUILD_REGRESS_TRUE@am__append_10 = test/regress -@BUILD_REGRESS_TRUE@am__append_11 = test/regress.gen.c test/regress.gen.h -@PTHREADS_TRUE@am__append_12 = libevent_pthreads.la -@BUILD_WIN32_TRUE@am__append_13 = test/regress_iocp.c -@OPENSSL_TRUE@am__append_14 = test/regress_ssl.c -@OPENSSL_TRUE@am__append_15 = $(OPENSSL_INCS) -@OPENSSL_TRUE@am__append_16 = libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD} -@STRLCPY_IMPL_TRUE@am__append_17 = strlcpy.c -@SELECT_BACKEND_TRUE@am__append_18 = select.c -@POLL_BACKEND_TRUE@am__append_19 = poll.c -@DEVPOLL_BACKEND_TRUE@am__append_20 = devpoll.c -@KQUEUE_BACKEND_TRUE@am__append_21 = kqueue.c -@EPOLL_BACKEND_TRUE@am__append_22 = epoll.c -@EVPORT_BACKEND_TRUE@am__append_23 = evport.c -@SIGNAL_SUPPORT_TRUE@am__append_24 = signal.c -@INSTALL_LIBEVENT_FALSE@am__append_25 = $(EVENT1_HDRS) +@BUILD_REGRESS_TRUE@am__append_6 = $(TESTPROGRAMS) +@BUILD_REGRESS_TRUE@am__append_7 = test/regress +@BUILD_REGRESS_TRUE@am__append_8 = test/regress.gen.c test/regress.gen.h +@PTHREADS_TRUE@am__append_9 = libevent_pthreads.la +@BUILD_WIN32_TRUE@am__append_10 = test/regress_iocp.c +@OPENSSL_TRUE@am__append_11 = test/regress_ssl.c +@OPENSSL_TRUE@am__append_12 = $(OPENSSL_INCS) +@OPENSSL_TRUE@am__append_13 = libevent_openssl.la $(OPENSSL_LIBS) ${OPENSSL_LIBADD} +@STRLCPY_IMPL_TRUE@am__append_14 = strlcpy.c +@SELECT_BACKEND_TRUE@am__append_15 = select.c +@POLL_BACKEND_TRUE@am__append_16 = poll.c +@DEVPOLL_BACKEND_TRUE@am__append_17 = devpoll.c +@KQUEUE_BACKEND_TRUE@am__append_18 = kqueue.c +@EPOLL_BACKEND_TRUE@am__append_19 = epoll.c +@EVPORT_BACKEND_TRUE@am__append_20 = evport.c +@SIGNAL_SUPPORT_TRUE@am__append_21 = signal.c +@INSTALL_LIBEVENT_FALSE@am__append_22 = $(EVENT1_HDRS) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/ac_backport_259_ssizet.m4 \ @@ -297,58 +285,16 @@ libevent_pthreads_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ @INSTALL_LIBEVENT_TRUE@@PTHREADS_TRUE@am_libevent_pthreads_la_rpath = \ @INSTALL_LIBEVENT_TRUE@@PTHREADS_TRUE@ -rpath $(libdir) @BUILD_REGRESS_TRUE@am__EXEEXT_1 = test/regress$(EXEEXT) -@OPENSSL_TRUE@am__EXEEXT_2 = sample/le-proxy$(EXEEXT) \ -@OPENSSL_TRUE@ sample/https-client$(EXEEXT) -am__EXEEXT_3 = sample/dns-example$(EXEEXT) \ - sample/event-read-fifo$(EXEEXT) sample/hello-world$(EXEEXT) \ - sample/http-server$(EXEEXT) sample/signal-test$(EXEEXT) \ - sample/time-test$(EXEEXT) $(am__EXEEXT_2) -@BUILD_SAMPLES_TRUE@am__EXEEXT_4 = $(am__EXEEXT_3) -am__EXEEXT_5 = test/bench$(EXEEXT) test/bench_cascade$(EXEEXT) \ +am__EXEEXT_2 = test/bench$(EXEEXT) test/bench_cascade$(EXEEXT) \ test/bench_http$(EXEEXT) test/bench_httpclient$(EXEEXT) \ test/test-changelist$(EXEEXT) test/test-dumpevents$(EXEEXT) \ test/test-eof$(EXEEXT) test/test-closed$(EXEEXT) \ test/test-fdleak$(EXEEXT) test/test-init$(EXEEXT) \ test/test-ratelim$(EXEEXT) test/test-time$(EXEEXT) \ test/test-weof$(EXEEXT) test/regress$(EXEEXT) -@BUILD_REGRESS_TRUE@am__EXEEXT_6 = $(am__EXEEXT_5) +@BUILD_REGRESS_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) PROGRAMS = $(noinst_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp -am_sample_dns_example_OBJECTS = sample/dns-example.$(OBJEXT) -sample_dns_example_OBJECTS = $(am_sample_dns_example_OBJECTS) -sample_dns_example_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la -am_sample_event_read_fifo_OBJECTS = sample/event-read-fifo.$(OBJEXT) -sample_event_read_fifo_OBJECTS = $(am_sample_event_read_fifo_OBJECTS) -sample_event_read_fifo_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - libevent.la -am_sample_hello_world_OBJECTS = sample/hello-world.$(OBJEXT) -sample_hello_world_OBJECTS = $(am_sample_hello_world_OBJECTS) -sample_hello_world_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la -am_sample_http_server_OBJECTS = sample/http-server.$(OBJEXT) -sample_http_server_OBJECTS = $(am_sample_http_server_OBJECTS) -sample_http_server_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la -am__sample_https_client_SOURCES_DIST = sample/https-client.c \ - sample/hostcheck.c sample/openssl_hostname_validation.c -@OPENSSL_TRUE@am_sample_https_client_OBJECTS = \ -@OPENSSL_TRUE@ sample/https-client.$(OBJEXT) \ -@OPENSSL_TRUE@ sample/hostcheck.$(OBJEXT) \ -@OPENSSL_TRUE@ sample/openssl_hostname_validation.$(OBJEXT) -sample_https_client_OBJECTS = $(am_sample_https_client_OBJECTS) -@OPENSSL_TRUE@sample_https_client_DEPENDENCIES = libevent.la \ -@OPENSSL_TRUE@ libevent_openssl.la $(am__DEPENDENCIES_1) \ -@OPENSSL_TRUE@ $(am__DEPENDENCIES_1) -am__sample_le_proxy_SOURCES_DIST = sample/le-proxy.c -@OPENSSL_TRUE@am_sample_le_proxy_OBJECTS = sample/le-proxy.$(OBJEXT) -sample_le_proxy_OBJECTS = $(am_sample_le_proxy_OBJECTS) -@OPENSSL_TRUE@sample_le_proxy_DEPENDENCIES = libevent.la \ -@OPENSSL_TRUE@ libevent_openssl.la $(am__DEPENDENCIES_1) \ -@OPENSSL_TRUE@ $(am__DEPENDENCIES_1) -am_sample_signal_test_OBJECTS = sample/signal-test.$(OBJEXT) -sample_signal_test_OBJECTS = $(am_sample_signal_test_OBJECTS) -sample_signal_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la -am_sample_time_test_OBJECTS = sample/time-test.$(OBJEXT) -sample_time_test_OBJECTS = $(am_sample_time_test_OBJECTS) -sample_time_test_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la am_test_bench_OBJECTS = test/bench.$(OBJEXT) test_bench_OBJECTS = $(am_test_bench_OBJECTS) test_bench_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la @@ -397,7 +343,7 @@ am_test_regress_OBJECTS = test/test_regress-regress.$(OBJEXT) \ test/test_regress-tinytest.$(OBJEXT) $(am__objects_12) \ $(am__objects_13) $(am__objects_14) $(am__objects_15) test_regress_OBJECTS = $(am_test_regress_OBJECTS) -am__DEPENDENCIES_3 = $(am__append_12) +am__DEPENDENCIES_3 = $(am__append_9) @OPENSSL_TRUE@am__DEPENDENCIES_4 = libevent_openssl.la \ @OPENSSL_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) test_regress_DEPENDENCIES = $(am__DEPENDENCIES_1) libevent.la \ @@ -471,31 +417,21 @@ am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libevent_la_SOURCES) $(libevent_core_la_SOURCES) \ $(libevent_extra_la_SOURCES) $(libevent_openssl_la_SOURCES) \ - $(libevent_pthreads_la_SOURCES) $(sample_dns_example_SOURCES) \ - $(sample_event_read_fifo_SOURCES) \ - $(sample_hello_world_SOURCES) $(sample_http_server_SOURCES) \ - $(sample_https_client_SOURCES) $(sample_le_proxy_SOURCES) \ - $(sample_signal_test_SOURCES) $(sample_time_test_SOURCES) \ - $(test_bench_SOURCES) $(test_bench_cascade_SOURCES) \ - $(test_bench_http_SOURCES) $(test_bench_httpclient_SOURCES) \ - $(test_regress_SOURCES) $(test_test_changelist_SOURCES) \ - $(test_test_closed_SOURCES) $(test_test_dumpevents_SOURCES) \ - $(test_test_eof_SOURCES) $(test_test_fdleak_SOURCES) \ - $(test_test_init_SOURCES) $(test_test_ratelim_SOURCES) \ - $(test_test_time_SOURCES) $(test_test_weof_SOURCES) + $(libevent_pthreads_la_SOURCES) $(test_bench_SOURCES) \ + $(test_bench_cascade_SOURCES) $(test_bench_http_SOURCES) \ + $(test_bench_httpclient_SOURCES) $(test_regress_SOURCES) \ + $(test_test_changelist_SOURCES) $(test_test_closed_SOURCES) \ + $(test_test_dumpevents_SOURCES) $(test_test_eof_SOURCES) \ + $(test_test_fdleak_SOURCES) $(test_test_init_SOURCES) \ + $(test_test_ratelim_SOURCES) $(test_test_time_SOURCES) \ + $(test_test_weof_SOURCES) DIST_SOURCES = $(am__libevent_la_SOURCES_DIST) \ $(am__libevent_core_la_SOURCES_DIST) \ $(libevent_extra_la_SOURCES) \ $(am__libevent_openssl_la_SOURCES_DIST) \ - $(am__libevent_pthreads_la_SOURCES_DIST) \ - $(sample_dns_example_SOURCES) \ - $(sample_event_read_fifo_SOURCES) \ - $(sample_hello_world_SOURCES) $(sample_http_server_SOURCES) \ - $(am__sample_https_client_SOURCES_DIST) \ - $(am__sample_le_proxy_SOURCES_DIST) \ - $(sample_signal_test_SOURCES) $(sample_time_test_SOURCES) \ - $(test_bench_SOURCES) $(test_bench_cascade_SOURCES) \ - $(test_bench_http_SOURCES) $(test_bench_httpclient_SOURCES) \ + $(am__libevent_pthreads_la_SOURCES_DIST) $(test_bench_SOURCES) \ + $(test_bench_cascade_SOURCES) $(test_bench_http_SOURCES) \ + $(test_bench_httpclient_SOURCES) \ $(am__test_regress_SOURCES_DIST) \ $(test_test_changelist_SOURCES) $(test_test_closed_SOURCES) \ $(test_test_dumpevents_SOURCES) $(test_test_eof_SOURCES) \ @@ -538,7 +474,6 @@ am__noinst_HEADERS_DIST = include/event2/buffer.h \ include/event2/rpc_struct.h include/event2/tag.h \ include/event2/tag_compat.h include/event2/thread.h \ include/event2/util.h include/event2/visibility.h \ - sample/hostcheck.h sample/openssl_hostname_validation.h \ test/regress.h test/regress_thread.h test/tinytest.h \ test/tinytest_local.h test/tinytest_macros.h \ WIN32-Code/nmake/evconfig-private.h \ @@ -757,8 +692,8 @@ TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/evconfig-private.h.in $(srcdir)/include/include.am \ $(srcdir)/libevent.pc.in $(srcdir)/libevent_openssl.pc.in \ - $(srcdir)/libevent_pthreads.pc.in $(srcdir)/sample/include.am \ - $(srcdir)/test/include.am $(top_srcdir)/build-aux/compile \ + $(srcdir)/libevent_pthreads.pc.in $(srcdir)/test/include.am \ + $(top_srcdir)/build-aux/compile \ $(top_srcdir)/build-aux/config.guess \ $(top_srcdir)/build-aux/config.sub \ $(top_srcdir)/build-aux/depcomp \ @@ -852,7 +787,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PTHREAD_CC = @PTHREAD_CC@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ -PTHREAD_LIBS = @PTHREAD_LIBS@ $(am__append_12) +PTHREAD_LIBS = @PTHREAD_LIBS@ $(am__append_9) RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -1018,9 +953,9 @@ LIBEVENT_LIBS_LA = libevent.la libevent_core.la libevent_extra.la \ @INSTALL_LIBEVENT_TRUE@pkgconfig_DATA = $(LIBEVENT_PKGCONFIG) @INSTALL_LIBEVENT_FALSE@noinst_LTLIBRARIES = $(LIBEVENT_LIBS_LA) EXTRA_SOURCE = -noinst_HEADERS = $(am__append_5) $(am__append_7) test/regress.h \ - test/regress_thread.h test/tinytest.h test/tinytest_local.h \ - test/tinytest_macros.h WIN32-Code/nmake/evconfig-private.h \ +noinst_HEADERS = $(am__append_5) test/regress.h test/regress_thread.h \ + test/tinytest.h test/tinytest_local.h test/tinytest_macros.h \ + WIN32-Code/nmake/evconfig-private.h \ WIN32-Code/nmake/event2/event-config.h WIN32-Code/tree.h \ bufferevent-internal.h changelist-internal.h \ compat/sys/queue.h defer-internal.h epolltable-internal.h \ @@ -1030,12 +965,12 @@ noinst_HEADERS = $(am__append_5) $(am__append_7) test/regress.h \ iocp-internal.h ipv6-internal.h kqueue-internal.h \ log-internal.h minheap-internal.h mm-internal.h \ ratelim-internal.h ratelim-internal.h strlcpy-internal.h \ - time-internal.h util-internal.h $(am__append_25) + time-internal.h util-internal.h $(am__append_22) CLEANFILES = test/rpcgen-attempted DISTCLEANFILES = test/test-script.sh test/regress.gen.c \ test/regress.gen.h *~ libevent.pc \ ./include/event2/event-config.h -BUILT_SOURCES = $(am__append_11) include/event2/event-config.h +BUILT_SOURCES = $(am__append_8) include/event2/event-config.h include_event2dir = $(includedir)/event2 EVENT2_EXPORT = \ include/event2/buffer.h \ @@ -1067,31 +1002,6 @@ EVENT2_EXPORT = \ @INSTALL_LIBEVENT_TRUE@include_event2_HEADERS = $(EVENT2_EXPORT) @INSTALL_LIBEVENT_TRUE@nodist_include_event2_HEADERS = include/event2/event-config.h @INSTALL_LIBEVENT_FALSE@nodist_noinst_HEADERS = include/event2/event-config.h -SAMPLES = sample/dns-example sample/event-read-fifo sample/hello-world \ - sample/http-server sample/signal-test sample/time-test \ - $(am__append_6) -@OPENSSL_TRUE@sample_le_proxy_SOURCES = sample/le-proxy.c -@OPENSSL_TRUE@sample_le_proxy_LDADD = libevent.la libevent_openssl.la ${OPENSSL_LIBS} ${OPENSSL_LIBADD} -@OPENSSL_TRUE@sample_le_proxy_INCLUDES = $(OPENSSL_INCS) -@OPENSSL_TRUE@sample_https_client_SOURCES = \ -@OPENSSL_TRUE@ sample/https-client.c \ -@OPENSSL_TRUE@ sample/hostcheck.c \ -@OPENSSL_TRUE@ sample/openssl_hostname_validation.c - -@OPENSSL_TRUE@sample_https_client_LDADD = libevent.la libevent_openssl.la ${OPENSSL_LIBS} ${OPENSSL_LIBADD} -@OPENSSL_TRUE@sample_https_client_INCLUDES = $(OPENSSL_INCS) -sample_event_read_fifo_SOURCES = sample/event-read-fifo.c -sample_event_read_fifo_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_time_test_SOURCES = sample/time-test.c -sample_time_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_signal_test_SOURCES = sample/signal-test.c -sample_signal_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_dns_example_SOURCES = sample/dns-example.c -sample_dns_example_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_hello_world_SOURCES = sample/hello-world.c -sample_hello_world_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_http_server_SOURCES = sample/http-server.c -sample_http_server_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la regress_CPPFLAGS = -DTINYTEST_LOCAL TESTPROGRAMS = \ test/bench \ @@ -1139,14 +1049,14 @@ test_regress_SOURCES = test/regress.c test/regress.gen.c \ test/regress_minheap.c test/regress_rpc.c \ test/regress_testutils.c test/regress_testutils.h \ test/regress_util.c test/tinytest.c $(regress_thread_SOURCES) \ - $(regress_zlib_SOURCES) $(am__append_13) $(am__append_14) + $(regress_zlib_SOURCES) $(am__append_10) $(am__append_11) @BUILD_WIN32_TRUE@regress_thread_SOURCES = test/regress_thread.c @PTHREADS_TRUE@regress_thread_SOURCES = test/regress_thread.c @ZLIB_REGRESS_TRUE@regress_zlib_SOURCES = test/regress_zlib.c test_regress_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la \ - $(PTHREAD_LIBS) $(ZLIB_LIBS) $(am__append_16) + $(PTHREAD_LIBS) $(ZLIB_LIBS) $(am__append_13) test_regress_CPPFLAGS = $(AM_CPPFLAGS) $(PTHREAD_CFLAGS) \ - $(ZLIB_CFLAGS) -Itest $(am__append_15) + $(ZLIB_CFLAGS) -Itest $(am__append_12) test_regress_LDFLAGS = $(PTHREAD_CFLAGS) test_bench_SOURCES = test/bench.c test_bench_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la @@ -1157,18 +1067,19 @@ test_bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la test_bench_httpclient_SOURCES = test/bench_httpclient.c test_bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) libevent_core.la @BUILD_WIN32_FALSE@SYS_LIBS = +#include sample/include.am @BUILD_WIN32_TRUE@SYS_LIBS = -lws2_32 -lshell32 -ladvapi32 -@BUILD_WIN32_FALSE@SYS_SRC = $(am__append_17) $(am__append_18) \ -@BUILD_WIN32_FALSE@ $(am__append_19) $(am__append_20) \ -@BUILD_WIN32_FALSE@ $(am__append_21) $(am__append_22) \ -@BUILD_WIN32_FALSE@ $(am__append_23) $(am__append_24) +@BUILD_WIN32_FALSE@SYS_SRC = $(am__append_14) $(am__append_15) \ +@BUILD_WIN32_FALSE@ $(am__append_16) $(am__append_17) \ +@BUILD_WIN32_FALSE@ $(am__append_18) $(am__append_19) \ +@BUILD_WIN32_FALSE@ $(am__append_20) $(am__append_21) @BUILD_WIN32_TRUE@SYS_SRC = win32select.c evthread_win32.c \ @BUILD_WIN32_TRUE@ buffer_iocp.c event_iocp.c \ -@BUILD_WIN32_TRUE@ bufferevent_async.c $(am__append_17) \ -@BUILD_WIN32_TRUE@ $(am__append_18) $(am__append_19) \ -@BUILD_WIN32_TRUE@ $(am__append_20) $(am__append_21) \ -@BUILD_WIN32_TRUE@ $(am__append_22) $(am__append_23) \ -@BUILD_WIN32_TRUE@ $(am__append_24) +@BUILD_WIN32_TRUE@ bufferevent_async.c $(am__append_14) \ +@BUILD_WIN32_TRUE@ $(am__append_15) $(am__append_16) \ +@BUILD_WIN32_TRUE@ $(am__append_17) $(am__append_18) \ +@BUILD_WIN32_TRUE@ $(am__append_19) $(am__append_20) \ +@BUILD_WIN32_TRUE@ $(am__append_21) @BUILD_WIN32_FALSE@SYS_INCLUDES = @BUILD_WIN32_TRUE@SYS_INCLUDES = -IWIN32-Code -IWIN32-Code/nmake CORE_SRC = \ @@ -1231,7 +1142,7 @@ all: $(BUILT_SOURCES) config.h evconfig-private.h .SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs am--refresh: Makefile @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/include/include.am $(srcdir)/sample/include.am $(srcdir)/test/include.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/include/include.am $(srcdir)/test/include.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -1253,7 +1164,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; -$(srcdir)/include/include.am $(srcdir)/sample/include.am $(srcdir)/test/include.am $(am__empty): +$(srcdir)/include/include.am $(srcdir)/test/include.am $(am__empty): $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck @@ -1362,64 +1273,6 @@ clean-noinstPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -sample/$(am__dirstamp): - @$(MKDIR_P) sample - @: > sample/$(am__dirstamp) -sample/$(DEPDIR)/$(am__dirstamp): - @$(MKDIR_P) sample/$(DEPDIR) - @: > sample/$(DEPDIR)/$(am__dirstamp) -sample/dns-example.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/dns-example$(EXEEXT): $(sample_dns_example_OBJECTS) $(sample_dns_example_DEPENDENCIES) $(EXTRA_sample_dns_example_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/dns-example$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_dns_example_OBJECTS) $(sample_dns_example_LDADD) $(LIBS) -sample/event-read-fifo.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/event-read-fifo$(EXEEXT): $(sample_event_read_fifo_OBJECTS) $(sample_event_read_fifo_DEPENDENCIES) $(EXTRA_sample_event_read_fifo_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/event-read-fifo$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_event_read_fifo_OBJECTS) $(sample_event_read_fifo_LDADD) $(LIBS) -sample/hello-world.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/hello-world$(EXEEXT): $(sample_hello_world_OBJECTS) $(sample_hello_world_DEPENDENCIES) $(EXTRA_sample_hello_world_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/hello-world$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_hello_world_OBJECTS) $(sample_hello_world_LDADD) $(LIBS) -sample/http-server.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/http-server$(EXEEXT): $(sample_http_server_OBJECTS) $(sample_http_server_DEPENDENCIES) $(EXTRA_sample_http_server_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/http-server$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_http_server_OBJECTS) $(sample_http_server_LDADD) $(LIBS) -sample/https-client.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) -sample/hostcheck.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) -sample/openssl_hostname_validation.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/https-client$(EXEEXT): $(sample_https_client_OBJECTS) $(sample_https_client_DEPENDENCIES) $(EXTRA_sample_https_client_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/https-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_https_client_OBJECTS) $(sample_https_client_LDADD) $(LIBS) -sample/le-proxy.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/le-proxy$(EXEEXT): $(sample_le_proxy_OBJECTS) $(sample_le_proxy_DEPENDENCIES) $(EXTRA_sample_le_proxy_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/le-proxy$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_le_proxy_OBJECTS) $(sample_le_proxy_LDADD) $(LIBS) -sample/signal-test.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/signal-test$(EXEEXT): $(sample_signal_test_OBJECTS) $(sample_signal_test_DEPENDENCIES) $(EXTRA_sample_signal_test_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/signal-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_signal_test_OBJECTS) $(sample_signal_test_LDADD) $(LIBS) -sample/time-test.$(OBJEXT): sample/$(am__dirstamp) \ - sample/$(DEPDIR)/$(am__dirstamp) - -sample/time-test$(EXEEXT): $(sample_time_test_OBJECTS) $(sample_time_test_DEPENDENCIES) $(EXTRA_sample_time_test_DEPENDENCIES) sample/$(am__dirstamp) - @rm -f sample/time-test$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sample_time_test_OBJECTS) $(sample_time_test_LDADD) $(LIBS) test/$(am__dirstamp): @$(MKDIR_P) test @: > test/$(am__dirstamp) @@ -1584,7 +1437,6 @@ uninstall-dist_binSCRIPTS: mostlyclean-compile: -rm -f *.$(OBJEXT) - -rm -f sample/*.$(OBJEXT) -rm -f test/*.$(OBJEXT) distclean-compile: @@ -1624,16 +1476,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strlcpy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/win32select.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/dns-example.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/event-read-fifo.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/hello-world.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/hostcheck.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/http-server.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/https-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/le-proxy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/openssl_hostname_validation.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/signal-test.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@sample/$(DEPDIR)/time-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/bench.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/bench_cascade.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/bench_http.Po@am__quote@ @@ -1969,7 +1811,6 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs - -rm -rf sample/.libs sample/_libs -rm -rf test/.libs test/_libs distclean-libtool: @@ -2485,8 +2326,6 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -rm -f sample/$(DEPDIR)/$(am__dirstamp) - -rm -f sample/$(am__dirstamp) -rm -f test/$(DEPDIR)/$(am__dirstamp) -rm -f test/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) @@ -2502,7 +2341,7 @@ clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(DEPDIR) ./$(DEPDIR) sample/$(DEPDIR) test/$(DEPDIR) + -rm -rf $(DEPDIR) ./$(DEPDIR) test/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-libtool distclean-tags @@ -2551,7 +2390,7 @@ installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf $(DEPDIR) ./$(DEPDIR) sample/$(DEPDIR) test/$(DEPDIR) + -rm -rf $(DEPDIR) ./$(DEPDIR) test/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -2601,8 +2440,6 @@ uninstall-am: uninstall-dist_binSCRIPTS uninstall-includeHEADERS \ .PRECIOUS: Makefile -$(SAMPLES) : libevent.la - test/test-script.sh: test/test.sh cp $(top_srcdir)/test/test.sh $@ diff --git a/contrib/ntp/sntp/libevent/sample/dns-example.c b/contrib/ntp/sntp/libevent/sample/dns-example.c deleted file mode 100644 index 15e48ce..0000000 --- a/contrib/ntp/sntp/libevent/sample/dns-example.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - This example code shows how to use the high-level, low-level, and - server-level interfaces of evdns. - - XXX It's pretty ugly and should probably be cleaned up. - */ - -#include <event2/event-config.h> - -/* Compatibility for possible missing IPv6 declarations */ -#include "../ipv6-internal.h" - -#include <sys/types.h> - -#ifdef _WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> -#else -#include <sys/socket.h> -#include <netinet/in.h> -#include <arpa/inet.h> -#endif - -#include <event2/event.h> -#include <event2/dns.h> -#include <event2/dns_struct.h> -#include <event2/util.h> - -#ifdef EVENT__HAVE_NETINET_IN6_H -#include <netinet/in6.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#define u32 ev_uint32_t -#define u8 ev_uint8_t - -static const char * -debug_ntoa(u32 address) -{ - static char buf[32]; - u32 a = ntohl(address); - evutil_snprintf(buf, sizeof(buf), "%d.%d.%d.%d", - (int)(u8)((a>>24)&0xff), - (int)(u8)((a>>16)&0xff), - (int)(u8)((a>>8 )&0xff), - (int)(u8)((a )&0xff)); - return buf; -} - -static void -main_callback(int result, char type, int count, int ttl, - void *addrs, void *orig) { - char *n = (char*)orig; - int i; - for (i = 0; i < count; ++i) { - if (type == DNS_IPv4_A) { - printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i])); - } else if (type == DNS_PTR) { - printf("%s: %s\n", n, ((char**)addrs)[i]); - } - } - if (!count) { - printf("%s: No answer (%d)\n", n, result); - } - fflush(stdout); -} - -static void -gai_callback(int err, struct evutil_addrinfo *ai, void *arg) -{ - const char *name = arg; - int i; - if (err) { - printf("%s: %s\n", name, evutil_gai_strerror(err)); - } - if (ai && ai->ai_canonname) - printf(" %s ==> %s\n", name, ai->ai_canonname); - for (i=0; ai; ai = ai->ai_next, ++i) { - char buf[128]; - if (ai->ai_family == PF_INET) { - struct sockaddr_in *sin = - (struct sockaddr_in*)ai->ai_addr; - evutil_inet_ntop(AF_INET, &sin->sin_addr, buf, - sizeof(buf)); - printf("[%d] %s: %s\n",i,name,buf); - } else { - struct sockaddr_in6 *sin6 = - (struct sockaddr_in6*)ai->ai_addr; - evutil_inet_ntop(AF_INET6, &sin6->sin6_addr, buf, - sizeof(buf)); - printf("[%d] %s: %s\n",i,name,buf); - } - } -} - -static void -evdns_server_callback(struct evdns_server_request *req, void *data) -{ - int i, r; - (void)data; - /* dummy; give 192.168.11.11 as an answer for all A questions, - * give foo.bar.example.com as an answer for all PTR questions. */ - for (i = 0; i < req->nquestions; ++i) { - u32 ans = htonl(0xc0a80b0bUL); - if (req->questions[i]->type == EVDNS_TYPE_A && - req->questions[i]->dns_question_class == EVDNS_CLASS_INET) { - printf(" -- replying for %s (A)\n", req->questions[i]->name); - r = evdns_server_request_add_a_reply(req, req->questions[i]->name, - 1, &ans, 10); - if (r<0) - printf("eeep, didn't work.\n"); - } else if (req->questions[i]->type == EVDNS_TYPE_PTR && - req->questions[i]->dns_question_class == EVDNS_CLASS_INET) { - printf(" -- replying for %s (PTR)\n", req->questions[i]->name); - r = evdns_server_request_add_ptr_reply(req, NULL, req->questions[i]->name, - "foo.bar.example.com", 10); - if (r<0) - printf("ugh, no luck"); - } else { - printf(" -- skipping %s [%d %d]\n", req->questions[i]->name, - req->questions[i]->type, req->questions[i]->dns_question_class); - } - } - - r = evdns_server_request_respond(req, 0); - if (r<0) - printf("eeek, couldn't send reply.\n"); -} - -static int verbose = 0; - -static void -logfn(int is_warn, const char *msg) { - if (!is_warn && !verbose) - return; - fprintf(stderr, "%s: %s\n", is_warn?"WARN":"INFO", msg); -} - -int -main(int c, char **v) { - int idx; - int reverse = 0, servertest = 0, use_getaddrinfo = 0; - struct event_base *event_base = NULL; - struct evdns_base *evdns_base = NULL; - const char *resolv_conf = NULL; - if (c<2) { - fprintf(stderr, "syntax: %s [-x] [-v] [-c resolv.conf] hostname\n", v[0]); - fprintf(stderr, "syntax: %s [-servertest]\n", v[0]); - return 1; - } - idx = 1; - while (idx < c && v[idx][0] == '-') { - if (!strcmp(v[idx], "-x")) - reverse = 1; - else if (!strcmp(v[idx], "-v")) - verbose = 1; - else if (!strcmp(v[idx], "-g")) - use_getaddrinfo = 1; - else if (!strcmp(v[idx], "-servertest")) - servertest = 1; - else if (!strcmp(v[idx], "-c")) { - if (idx + 1 < c) - resolv_conf = v[++idx]; - else - fprintf(stderr, "-c needs an argument\n"); - } else - fprintf(stderr, "Unknown option %s\n", v[idx]); - ++idx; - } - -#ifdef _WIN32 - { - WSADATA WSAData; - WSAStartup(0x101, &WSAData); - } -#endif - - event_base = event_base_new(); - evdns_base = evdns_base_new(event_base, EVDNS_BASE_DISABLE_WHEN_INACTIVE); - evdns_set_log_fn(logfn); - - if (servertest) { - evutil_socket_t sock; - struct sockaddr_in my_addr; - sock = socket(PF_INET, SOCK_DGRAM, 0); - if (sock == -1) { - perror("socket"); - exit(1); - } - evutil_make_socket_nonblocking(sock); - my_addr.sin_family = AF_INET; - my_addr.sin_port = htons(10053); - my_addr.sin_addr.s_addr = INADDR_ANY; - if (bind(sock, (struct sockaddr*)&my_addr, sizeof(my_addr))<0) { - perror("bind"); - exit(1); - } - evdns_add_server_port_with_base(event_base, sock, 0, evdns_server_callback, NULL); - } - if (idx < c) { - int res; -#ifdef _WIN32 - if (resolv_conf == NULL) - res = evdns_base_config_windows_nameservers(evdns_base); - else -#endif - res = evdns_base_resolv_conf_parse(evdns_base, - DNS_OPTION_NAMESERVERS, - resolv_conf ? resolv_conf : "/etc/resolv.conf"); - - if (res < 0) { - fprintf(stderr, "Couldn't configure nameservers"); - return 1; - } - } - - printf("EVUTIL_AI_CANONNAME in example = %d\n", EVUTIL_AI_CANONNAME); - for (; idx < c; ++idx) { - if (reverse) { - struct in_addr addr; - if (evutil_inet_pton(AF_INET, v[idx], &addr)!=1) { - fprintf(stderr, "Skipping non-IP %s\n", v[idx]); - continue; - } - fprintf(stderr, "resolving %s...\n",v[idx]); - evdns_base_resolve_reverse(evdns_base, &addr, 0, main_callback, v[idx]); - } else if (use_getaddrinfo) { - struct evutil_addrinfo hints; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_protocol = IPPROTO_TCP; - hints.ai_flags = EVUTIL_AI_CANONNAME; - fprintf(stderr, "resolving (fwd) %s...\n",v[idx]); - evdns_getaddrinfo(evdns_base, v[idx], NULL, &hints, - gai_callback, v[idx]); - } else { - fprintf(stderr, "resolving (fwd) %s...\n",v[idx]); - evdns_base_resolve_ipv4(evdns_base, v[idx], 0, main_callback, v[idx]); - } - } - fflush(stdout); - event_base_dispatch(event_base); - return 0; -} - diff --git a/contrib/ntp/sntp/libevent/sample/event-read-fifo.c b/contrib/ntp/sntp/libevent/sample/event-read-fifo.c deleted file mode 100644 index 27b0b53..0000000 --- a/contrib/ntp/sntp/libevent/sample/event-read-fifo.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This sample code shows how to use Libevent to read from a named pipe. - * XXX This code could make better use of the Libevent interfaces. - * - * XXX This does not work on Windows; ignore everything inside the _WIN32 block. - * - * On UNIX, compile with: - * cc -I/usr/local/include -o event-read-fifo event-read-fifo.c \ - * -L/usr/local/lib -levent - */ - -#include <event2/event-config.h> - -#include <sys/types.h> -#include <sys/stat.h> -#ifndef _WIN32 -#include <sys/queue.h> -#include <unistd.h> -#include <sys/time.h> -#include <signal.h> -#else -#include <winsock2.h> -#include <windows.h> -#endif -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#include <event2/event.h> - -static void -fifo_read(evutil_socket_t fd, short event, void *arg) -{ - char buf[255]; - int len; - struct event *ev = arg; -#ifdef _WIN32 - DWORD dwBytesRead; -#endif - - fprintf(stderr, "fifo_read called with fd: %d, event: %d, arg: %p\n", - (int)fd, event, arg); -#ifdef _WIN32 - len = ReadFile((HANDLE)fd, buf, sizeof(buf) - 1, &dwBytesRead, NULL); - - /* Check for end of file. */ - if (len && dwBytesRead == 0) { - fprintf(stderr, "End Of File"); - event_del(ev); - return; - } - - buf[dwBytesRead] = '\0'; -#else - len = read(fd, buf, sizeof(buf) - 1); - - if (len <= 0) { - if (len == -1) - perror("read"); - else if (len == 0) - fprintf(stderr, "Connection closed\n"); - event_del(ev); - event_base_loopbreak(event_get_base(ev)); - return; - } - - buf[len] = '\0'; -#endif - fprintf(stdout, "Read: %s\n", buf); -} - -/* On Unix, cleanup event.fifo if SIGINT is received. */ -#ifndef _WIN32 -static void -signal_cb(evutil_socket_t fd, short event, void *arg) -{ - struct event_base *base = arg; - event_base_loopbreak(base); -} -#endif - -int -main(int argc, char **argv) -{ - struct event *evfifo; - struct event_base* base; -#ifdef _WIN32 - HANDLE socket; - /* Open a file. */ - socket = CreateFileA("test.txt", /* open File */ - GENERIC_READ, /* open for reading */ - 0, /* do not share */ - NULL, /* no security */ - OPEN_EXISTING, /* existing file only */ - FILE_ATTRIBUTE_NORMAL, /* normal file */ - NULL); /* no attr. template */ - - if (socket == INVALID_HANDLE_VALUE) - return 1; - -#else - struct event *signal_int; - struct stat st; - const char *fifo = "event.fifo"; - int socket; - - if (lstat(fifo, &st) == 0) { - if ((st.st_mode & S_IFMT) == S_IFREG) { - errno = EEXIST; - perror("lstat"); - exit(1); - } - } - - unlink(fifo); - if (mkfifo(fifo, 0600) == -1) { - perror("mkfifo"); - exit(1); - } - - socket = open(fifo, O_RDONLY | O_NONBLOCK, 0); - - if (socket == -1) { - perror("open"); - exit(1); - } - - fprintf(stderr, "Write data to %s\n", fifo); -#endif - /* Initalize the event library */ - base = event_base_new(); - - /* Initalize one event */ -#ifdef _WIN32 - evfifo = event_new(base, (evutil_socket_t)socket, EV_READ|EV_PERSIST, fifo_read, - event_self_cbarg()); -#else - /* catch SIGINT so that event.fifo can be cleaned up */ - signal_int = evsignal_new(base, SIGINT, signal_cb, base); - event_add(signal_int, NULL); - - evfifo = event_new(base, socket, EV_READ|EV_PERSIST, fifo_read, - event_self_cbarg()); -#endif - - /* Add it to the active events, without a timeout */ - event_add(evfifo, NULL); - - event_base_dispatch(base); - event_base_free(base); -#ifdef _WIN32 - CloseHandle(socket); -#else - close(socket); - unlink(fifo); -#endif - libevent_global_shutdown(); - return (0); -} - diff --git a/contrib/ntp/sntp/libevent/sample/hello-world.c b/contrib/ntp/sntp/libevent/sample/hello-world.c deleted file mode 100644 index d3cf058..0000000 --- a/contrib/ntp/sntp/libevent/sample/hello-world.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - This exmple program provides a trivial server program that listens for TCP - connections on port 9995. When they arrive, it writes a short message to - each client connection, and closes each connection once it is flushed. - - Where possible, it exits cleanly in response to a SIGINT (ctrl-c). -*/ - - -#include <string.h> -#include <errno.h> -#include <stdio.h> -#include <signal.h> -#ifndef _WIN32 -#include <netinet/in.h> -# ifdef _XOPEN_SOURCE_EXTENDED -# include <arpa/inet.h> -# endif -#include <sys/socket.h> -#endif - -#include <event2/bufferevent.h> -#include <event2/buffer.h> -#include <event2/listener.h> -#include <event2/util.h> -#include <event2/event.h> - -static const char MESSAGE[] = "Hello, World!\n"; - -static const int PORT = 9995; - -static void listener_cb(struct evconnlistener *, evutil_socket_t, - struct sockaddr *, int socklen, void *); -static void conn_writecb(struct bufferevent *, void *); -static void conn_eventcb(struct bufferevent *, short, void *); -static void signal_cb(evutil_socket_t, short, void *); - -int -main(int argc, char **argv) -{ - struct event_base *base; - struct evconnlistener *listener; - struct event *signal_event; - - struct sockaddr_in sin; -#ifdef _WIN32 - WSADATA wsa_data; - WSAStartup(0x0201, &wsa_data); -#endif - - base = event_base_new(); - if (!base) { - fprintf(stderr, "Could not initialize libevent!\n"); - return 1; - } - - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons(PORT); - - listener = evconnlistener_new_bind(base, listener_cb, (void *)base, - LEV_OPT_REUSEABLE|LEV_OPT_CLOSE_ON_FREE, -1, - (struct sockaddr*)&sin, - sizeof(sin)); - - if (!listener) { - fprintf(stderr, "Could not create a listener!\n"); - return 1; - } - - signal_event = evsignal_new(base, SIGINT, signal_cb, (void *)base); - - if (!signal_event || event_add(signal_event, NULL)<0) { - fprintf(stderr, "Could not create/add a signal event!\n"); - return 1; - } - - event_base_dispatch(base); - - evconnlistener_free(listener); - event_free(signal_event); - event_base_free(base); - - printf("done\n"); - return 0; -} - -static void -listener_cb(struct evconnlistener *listener, evutil_socket_t fd, - struct sockaddr *sa, int socklen, void *user_data) -{ - struct event_base *base = user_data; - struct bufferevent *bev; - - bev = bufferevent_socket_new(base, fd, BEV_OPT_CLOSE_ON_FREE); - if (!bev) { - fprintf(stderr, "Error constructing bufferevent!"); - event_base_loopbreak(base); - return; - } - bufferevent_setcb(bev, NULL, conn_writecb, conn_eventcb, NULL); - bufferevent_enable(bev, EV_WRITE); - bufferevent_disable(bev, EV_READ); - - bufferevent_write(bev, MESSAGE, strlen(MESSAGE)); -} - -static void -conn_writecb(struct bufferevent *bev, void *user_data) -{ - struct evbuffer *output = bufferevent_get_output(bev); - if (evbuffer_get_length(output) == 0) { - printf("flushed answer\n"); - bufferevent_free(bev); - } -} - -static void -conn_eventcb(struct bufferevent *bev, short events, void *user_data) -{ - if (events & BEV_EVENT_EOF) { - printf("Connection closed.\n"); - } else if (events & BEV_EVENT_ERROR) { - printf("Got an error on the connection: %s\n", - strerror(errno));/*XXX win32*/ - } - /* None of the other events can happen here, since we haven't enabled - * timeouts */ - bufferevent_free(bev); -} - -static void -signal_cb(evutil_socket_t sig, short events, void *user_data) -{ - struct event_base *base = user_data; - struct timeval delay = { 2, 0 }; - - printf("Caught an interrupt signal; exiting cleanly in two seconds.\n"); - - event_base_loopexit(base, &delay); -} diff --git a/contrib/ntp/sntp/libevent/sample/hostcheck.c b/contrib/ntp/sntp/libevent/sample/hostcheck.c deleted file mode 100644 index 5070936..0000000 --- a/contrib/ntp/sntp/libevent/sample/hostcheck.c +++ /dev/null @@ -1,217 +0,0 @@ -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -/* This file is an amalgamation of hostcheck.c and most of rawstr.c - from cURL. The contents of the COPYING file mentioned above are: - -COPYRIGHT AND PERMISSION NOTICE - -Copyright (c) 1996 - 2013, Daniel Stenberg, <daniel@haxx.se>. - -All rights reserved. - -Permission to use, copy, modify, and distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright -notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE -OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall not -be used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization of the copyright holder. -*/ - -#include "hostcheck.h" -#include <string.h> - -/* Portable, consistent toupper (remember EBCDIC). Do not use toupper() because - its behavior is altered by the current locale. */ -static char Curl_raw_toupper(char in) -{ - switch (in) { - case 'a': - return 'A'; - case 'b': - return 'B'; - case 'c': - return 'C'; - case 'd': - return 'D'; - case 'e': - return 'E'; - case 'f': - return 'F'; - case 'g': - return 'G'; - case 'h': - return 'H'; - case 'i': - return 'I'; - case 'j': - return 'J'; - case 'k': - return 'K'; - case 'l': - return 'L'; - case 'm': - return 'M'; - case 'n': - return 'N'; - case 'o': - return 'O'; - case 'p': - return 'P'; - case 'q': - return 'Q'; - case 'r': - return 'R'; - case 's': - return 'S'; - case 't': - return 'T'; - case 'u': - return 'U'; - case 'v': - return 'V'; - case 'w': - return 'W'; - case 'x': - return 'X'; - case 'y': - return 'Y'; - case 'z': - return 'Z'; - } - return in; -} - -/* - * Curl_raw_equal() is for doing "raw" case insensitive strings. This is meant - * to be locale independent and only compare strings we know are safe for - * this. See http://daniel.haxx.se/blog/2008/10/15/strcasecmp-in-turkish/ for - * some further explanation to why this function is necessary. - * - * The function is capable of comparing a-z case insensitively even for - * non-ascii. - */ - -static int Curl_raw_equal(const char *first, const char *second) -{ - while(*first && *second) { - if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) - /* get out of the loop as soon as they don't match */ - break; - first++; - second++; - } - /* we do the comparison here (possibly again), just to make sure that if the - loop above is skipped because one of the strings reached zero, we must not - return this as a successful match */ - return (Curl_raw_toupper(*first) == Curl_raw_toupper(*second)); -} - -static int Curl_raw_nequal(const char *first, const char *second, size_t max) -{ - while(*first && *second && max) { - if(Curl_raw_toupper(*first) != Curl_raw_toupper(*second)) { - break; - } - max--; - first++; - second++; - } - if(0 == max) - return 1; /* they are equal this far */ - - return Curl_raw_toupper(*first) == Curl_raw_toupper(*second); -} - -/* - * Match a hostname against a wildcard pattern. - * E.g. - * "foo.host.com" matches "*.host.com". - * - * We use the matching rule described in RFC6125, section 6.4.3. - * http://tools.ietf.org/html/rfc6125#section-6.4.3 - */ - -static int hostmatch(const char *hostname, const char *pattern) -{ - const char *pattern_label_end, *pattern_wildcard, *hostname_label_end; - int wildcard_enabled; - size_t prefixlen, suffixlen; - pattern_wildcard = strchr(pattern, '*'); - if(pattern_wildcard == NULL) - return Curl_raw_equal(pattern, hostname) ? - CURL_HOST_MATCH : CURL_HOST_NOMATCH; - - /* We require at least 2 dots in pattern to avoid too wide wildcard - match. */ - wildcard_enabled = 1; - pattern_label_end = strchr(pattern, '.'); - if(pattern_label_end == NULL || strchr(pattern_label_end+1, '.') == NULL || - pattern_wildcard > pattern_label_end || - Curl_raw_nequal(pattern, "xn--", 4)) { - wildcard_enabled = 0; - } - if(!wildcard_enabled) - return Curl_raw_equal(pattern, hostname) ? - CURL_HOST_MATCH : CURL_HOST_NOMATCH; - - hostname_label_end = strchr(hostname, '.'); - if(hostname_label_end == NULL || - !Curl_raw_equal(pattern_label_end, hostname_label_end)) - return CURL_HOST_NOMATCH; - - /* The wildcard must match at least one character, so the left-most - label of the hostname is at least as large as the left-most label - of the pattern. */ - if(hostname_label_end - hostname < pattern_label_end - pattern) - return CURL_HOST_NOMATCH; - - prefixlen = pattern_wildcard - pattern; - suffixlen = pattern_label_end - (pattern_wildcard+1); - return Curl_raw_nequal(pattern, hostname, prefixlen) && - Curl_raw_nequal(pattern_wildcard+1, hostname_label_end - suffixlen, - suffixlen) ? - CURL_HOST_MATCH : CURL_HOST_NOMATCH; -} - -int Curl_cert_hostcheck(const char *match_pattern, const char *hostname) -{ - if(!match_pattern || !*match_pattern || - !hostname || !*hostname) /* sanity check */ - return 0; - - if(Curl_raw_equal(hostname, match_pattern)) /* trivial case */ - return 1; - - if(hostmatch(hostname,match_pattern) == CURL_HOST_MATCH) - return 1; - return 0; -} diff --git a/contrib/ntp/sntp/libevent/sample/hostcheck.h b/contrib/ntp/sntp/libevent/sample/hostcheck.h deleted file mode 100644 index f40bc43..0000000 --- a/contrib/ntp/sntp/libevent/sample/hostcheck.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef HEADER_CURL_HOSTCHECK_H -#define HEADER_CURL_HOSTCHECK_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ***************************************************************************/ - -#define CURL_HOST_NOMATCH 0 -#define CURL_HOST_MATCH 1 -int Curl_cert_hostcheck(const char *match_pattern, const char *hostname); - -#endif /* HEADER_CURL_HOSTCHECK_H */ - diff --git a/contrib/ntp/sntp/libevent/sample/http-server.c b/contrib/ntp/sntp/libevent/sample/http-server.c deleted file mode 100644 index cbb9c91..0000000 --- a/contrib/ntp/sntp/libevent/sample/http-server.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - A trivial static http webserver using Libevent's evhttp. - - This is not the best code in the world, and it does some fairly stupid stuff - that you would never want to do in a production webserver. Caveat hackor! - - */ - -/* Compatibility for possible missing IPv6 declarations */ -#include "../util-internal.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include <sys/types.h> -#include <sys/stat.h> - -#ifdef _WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> -#include <windows.h> -#include <io.h> -#include <fcntl.h> -#ifndef S_ISDIR -#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) -#endif -#else -#include <sys/stat.h> -#include <sys/socket.h> -#include <signal.h> -#include <fcntl.h> -#include <unistd.h> -#include <dirent.h> -#endif - -#include <event2/event.h> -#include <event2/http.h> -#include <event2/buffer.h> -#include <event2/util.h> -#include <event2/keyvalq_struct.h> - -#ifdef EVENT__HAVE_NETINET_IN_H -#include <netinet/in.h> -# ifdef _XOPEN_SOURCE_EXTENDED -# include <arpa/inet.h> -# endif -#endif - -#ifdef _WIN32 -#ifndef stat -#define stat _stat -#endif -#ifndef fstat -#define fstat _fstat -#endif -#ifndef open -#define open _open -#endif -#ifndef close -#define close _close -#endif -#ifndef O_RDONLY -#define O_RDONLY _O_RDONLY -#endif -#endif - -char uri_root[512]; - -static const struct table_entry { - const char *extension; - const char *content_type; -} content_type_table[] = { - { "txt", "text/plain" }, - { "c", "text/plain" }, - { "h", "text/plain" }, - { "html", "text/html" }, - { "htm", "text/htm" }, - { "css", "text/css" }, - { "gif", "image/gif" }, - { "jpg", "image/jpeg" }, - { "jpeg", "image/jpeg" }, - { "png", "image/png" }, - { "pdf", "application/pdf" }, - { "ps", "application/postsript" }, - { NULL, NULL }, -}; - -/* Try to guess a good content-type for 'path' */ -static const char * -guess_content_type(const char *path) -{ - const char *last_period, *extension; - const struct table_entry *ent; - last_period = strrchr(path, '.'); - if (!last_period || strchr(last_period, '/')) - goto not_found; /* no exension */ - extension = last_period + 1; - for (ent = &content_type_table[0]; ent->extension; ++ent) { - if (!evutil_ascii_strcasecmp(ent->extension, extension)) - return ent->content_type; - } - -not_found: - return "application/misc"; -} - -/* Callback used for the /dump URI, and for every non-GET request: - * dumps all information to stdout and gives back a trivial 200 ok */ -static void -dump_request_cb(struct evhttp_request *req, void *arg) -{ - const char *cmdtype; - struct evkeyvalq *headers; - struct evkeyval *header; - struct evbuffer *buf; - - switch (evhttp_request_get_command(req)) { - case EVHTTP_REQ_GET: cmdtype = "GET"; break; - case EVHTTP_REQ_POST: cmdtype = "POST"; break; - case EVHTTP_REQ_HEAD: cmdtype = "HEAD"; break; - case EVHTTP_REQ_PUT: cmdtype = "PUT"; break; - case EVHTTP_REQ_DELETE: cmdtype = "DELETE"; break; - case EVHTTP_REQ_OPTIONS: cmdtype = "OPTIONS"; break; - case EVHTTP_REQ_TRACE: cmdtype = "TRACE"; break; - case EVHTTP_REQ_CONNECT: cmdtype = "CONNECT"; break; - case EVHTTP_REQ_PATCH: cmdtype = "PATCH"; break; - default: cmdtype = "unknown"; break; - } - - printf("Received a %s request for %s\nHeaders:\n", - cmdtype, evhttp_request_get_uri(req)); - - headers = evhttp_request_get_input_headers(req); - for (header = headers->tqh_first; header; - header = header->next.tqe_next) { - printf(" %s: %s\n", header->key, header->value); - } - - buf = evhttp_request_get_input_buffer(req); - puts("Input data: <<<"); - while (evbuffer_get_length(buf)) { - int n; - char cbuf[128]; - n = evbuffer_remove(buf, cbuf, sizeof(cbuf)); - if (n > 0) - (void) fwrite(cbuf, 1, n, stdout); - } - puts(">>>"); - - evhttp_send_reply(req, 200, "OK", NULL); -} - -/* This callback gets invoked when we get any http request that doesn't match - * any other callback. Like any evhttp server callback, it has a simple job: - * it must eventually call evhttp_send_error() or evhttp_send_reply(). - */ -static void -send_document_cb(struct evhttp_request *req, void *arg) -{ - struct evbuffer *evb = NULL; - const char *docroot = arg; - const char *uri = evhttp_request_get_uri(req); - struct evhttp_uri *decoded = NULL; - const char *path; - char *decoded_path; - char *whole_path = NULL; - size_t len; - int fd = -1; - struct stat st; - - if (evhttp_request_get_command(req) != EVHTTP_REQ_GET) { - dump_request_cb(req, arg); - return; - } - - printf("Got a GET request for <%s>\n", uri); - - /* Decode the URI */ - decoded = evhttp_uri_parse(uri); - if (!decoded) { - printf("It's not a good URI. Sending BADREQUEST\n"); - evhttp_send_error(req, HTTP_BADREQUEST, 0); - return; - } - - /* Let's see what path the user asked for. */ - path = evhttp_uri_get_path(decoded); - if (!path) path = "/"; - - /* We need to decode it, to see what path the user really wanted. */ - decoded_path = evhttp_uridecode(path, 0, NULL); - if (decoded_path == NULL) - goto err; - /* Don't allow any ".."s in the path, to avoid exposing stuff outside - * of the docroot. This test is both overzealous and underzealous: - * it forbids aceptable paths like "/this/one..here", but it doesn't - * do anything to prevent symlink following." */ - if (strstr(decoded_path, "..")) - goto err; - - len = strlen(decoded_path)+strlen(docroot)+2; - if (!(whole_path = malloc(len))) { - perror("malloc"); - goto err; - } - evutil_snprintf(whole_path, len, "%s/%s", docroot, decoded_path); - - if (stat(whole_path, &st)<0) { - goto err; - } - - /* This holds the content we're sending. */ - evb = evbuffer_new(); - - if (S_ISDIR(st.st_mode)) { - /* If it's a directory, read the comments and make a little - * index page */ -#ifdef _WIN32 - HANDLE d; - WIN32_FIND_DATAA ent; - char *pattern; - size_t dirlen; -#else - DIR *d; - struct dirent *ent; -#endif - const char *trailing_slash = ""; - - if (!strlen(path) || path[strlen(path)-1] != '/') - trailing_slash = "/"; - -#ifdef _WIN32 - dirlen = strlen(whole_path); - pattern = malloc(dirlen+3); - memcpy(pattern, whole_path, dirlen); - pattern[dirlen] = '\\'; - pattern[dirlen+1] = '*'; - pattern[dirlen+2] = '\0'; - d = FindFirstFileA(pattern, &ent); - free(pattern); - if (d == INVALID_HANDLE_VALUE) - goto err; -#else - if (!(d = opendir(whole_path))) - goto err; -#endif - - evbuffer_add_printf(evb, - "<!DOCTYPE html>\n" - "<html>\n <head>\n" - " <meta charset='utf-8'>\n" - " <title>%s</title>\n" - " <base href='%s%s'>\n" - " </head>\n" - " <body>\n" - " <h1>%s</h1>\n" - " <ul>\n", - decoded_path, /* XXX html-escape this. */ - path, /* XXX html-escape this? */ - trailing_slash, - decoded_path /* XXX html-escape this */); -#ifdef _WIN32 - do { - const char *name = ent.cFileName; -#else - while ((ent = readdir(d))) { - const char *name = ent->d_name; -#endif - evbuffer_add_printf(evb, - " <li><a href=\"%s\">%s</a>\n", - name, name);/* XXX escape this */ -#ifdef _WIN32 - } while (FindNextFileA(d, &ent)); -#else - } -#endif - evbuffer_add_printf(evb, "</ul></body></html>\n"); -#ifdef _WIN32 - FindClose(d); -#else - closedir(d); -#endif - evhttp_add_header(evhttp_request_get_output_headers(req), - "Content-Type", "text/html"); - } else { - /* Otherwise it's a file; add it to the buffer to get - * sent via sendfile */ - const char *type = guess_content_type(decoded_path); - if ((fd = open(whole_path, O_RDONLY)) < 0) { - perror("open"); - goto err; - } - - if (fstat(fd, &st)<0) { - /* Make sure the length still matches, now that we - * opened the file :/ */ - perror("fstat"); - goto err; - } - evhttp_add_header(evhttp_request_get_output_headers(req), - "Content-Type", type); - evbuffer_add_file(evb, fd, 0, st.st_size); - } - - evhttp_send_reply(req, 200, "OK", evb); - goto done; -err: - evhttp_send_error(req, 404, "Document was not found"); - if (fd>=0) - close(fd); -done: - if (decoded) - evhttp_uri_free(decoded); - if (decoded_path) - free(decoded_path); - if (whole_path) - free(whole_path); - if (evb) - evbuffer_free(evb); -} - -static void -syntax(void) -{ - fprintf(stdout, "Syntax: http-server <docroot>\n"); -} - -int -main(int argc, char **argv) -{ - struct event_base *base; - struct evhttp *http; - struct evhttp_bound_socket *handle; - - unsigned short port = 0; -#ifdef _WIN32 - WSADATA WSAData; - WSAStartup(0x101, &WSAData); -#else - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) - return (1); -#endif - if (argc < 2) { - syntax(); - return 1; - } - - base = event_base_new(); - if (!base) { - fprintf(stderr, "Couldn't create an event_base: exiting\n"); - return 1; - } - - /* Create a new evhttp object to handle requests. */ - http = evhttp_new(base); - if (!http) { - fprintf(stderr, "couldn't create evhttp. Exiting.\n"); - return 1; - } - - /* The /dump URI will dump all requests to stdout and say 200 ok. */ - evhttp_set_cb(http, "/dump", dump_request_cb, NULL); - - /* We want to accept arbitrary requests, so we need to set a "generic" - * cb. We can also add callbacks for specific paths. */ - evhttp_set_gencb(http, send_document_cb, argv[1]); - - /* Now we tell the evhttp what port to listen on */ - handle = evhttp_bind_socket_with_handle(http, "0.0.0.0", port); - if (!handle) { - fprintf(stderr, "couldn't bind to port %d. Exiting.\n", - (int)port); - return 1; - } - - { - /* Extract and display the address we're listening on. */ - struct sockaddr_storage ss; - evutil_socket_t fd; - ev_socklen_t socklen = sizeof(ss); - char addrbuf[128]; - void *inaddr; - const char *addr; - int got_port = -1; - fd = evhttp_bound_socket_get_fd(handle); - memset(&ss, 0, sizeof(ss)); - if (getsockname(fd, (struct sockaddr *)&ss, &socklen)) { - perror("getsockname() failed"); - return 1; - } - if (ss.ss_family == AF_INET) { - got_port = ntohs(((struct sockaddr_in*)&ss)->sin_port); - inaddr = &((struct sockaddr_in*)&ss)->sin_addr; - } else if (ss.ss_family == AF_INET6) { - got_port = ntohs(((struct sockaddr_in6*)&ss)->sin6_port); - inaddr = &((struct sockaddr_in6*)&ss)->sin6_addr; - } else { - fprintf(stderr, "Weird address family %d\n", - ss.ss_family); - return 1; - } - addr = evutil_inet_ntop(ss.ss_family, inaddr, addrbuf, - sizeof(addrbuf)); - if (addr) { - printf("Listening on %s:%d\n", addr, got_port); - evutil_snprintf(uri_root, sizeof(uri_root), - "http://%s:%d",addr,got_port); - } else { - fprintf(stderr, "evutil_inet_ntop failed\n"); - return 1; - } - } - - event_base_dispatch(base); - - return 0; -} diff --git a/contrib/ntp/sntp/libevent/sample/https-client.c b/contrib/ntp/sntp/libevent/sample/https-client.c deleted file mode 100644 index fbd5de8..0000000 --- a/contrib/ntp/sntp/libevent/sample/https-client.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - This is an example of how to hook up evhttp with bufferevent_ssl - - It just GETs an https URL given on the command-line and prints the response - body to stdout. - - Actually, it also accepts plain http URLs to make it easy to compare http vs - https code paths. - - Loosely based on le-proxy.c. - */ - -// Get rid of OSX 10.7 and greater deprecation warnings. -#if defined(__APPLE__) && defined(__clang__) -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif - -#include <stdio.h> -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#ifdef _WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> - -#define snprintf _snprintf -#define strcasecmp _stricmp -#else -#include <sys/socket.h> -#include <netinet/in.h> -#endif - -#include <event2/bufferevent_ssl.h> -#include <event2/bufferevent.h> -#include <event2/buffer.h> -#include <event2/listener.h> -#include <event2/util.h> -#include <event2/http.h> - -#include <openssl/ssl.h> -#include <openssl/err.h> -#include <openssl/rand.h> - -#include "openssl_hostname_validation.h" - -static struct event_base *base; -static int ignore_cert = 0; - -static void -http_request_done(struct evhttp_request *req, void *ctx) -{ - char buffer[256]; - int nread; - - if (req == NULL) { - /* If req is NULL, it means an error occurred, but - * sadly we are mostly left guessing what the error - * might have been. We'll do our best... */ - struct bufferevent *bev = (struct bufferevent *) ctx; - unsigned long oslerr; - int printed_err = 0; - int errcode = EVUTIL_SOCKET_ERROR(); - fprintf(stderr, "some request failed - no idea which one though!\n"); - /* Print out the OpenSSL error queue that libevent - * squirreled away for us, if any. */ - while ((oslerr = bufferevent_get_openssl_error(bev))) { - ERR_error_string_n(oslerr, buffer, sizeof(buffer)); - fprintf(stderr, "%s\n", buffer); - printed_err = 1; - } - /* If the OpenSSL error queue was empty, maybe it was a - * socket error; let's try printing that. */ - if (! printed_err) - fprintf(stderr, "socket error = %s (%d)\n", - evutil_socket_error_to_string(errcode), - errcode); - return; - } - - fprintf(stderr, "Response line: %d %s\n", - evhttp_request_get_response_code(req), - evhttp_request_get_response_code_line(req)); - - while ((nread = evbuffer_remove(evhttp_request_get_input_buffer(req), - buffer, sizeof(buffer))) - > 0) { - /* These are just arbitrary chunks of 256 bytes. - * They are not lines, so we can't treat them as such. */ - fwrite(buffer, nread, 1, stdout); - } -} - -static void -syntax(void) -{ - fputs("Syntax:\n", stderr); - fputs(" https-client -url <https-url> [-data data-file.bin] [-ignore-cert] [-retries num]\n", stderr); - fputs("Example:\n", stderr); - fputs(" https-client -url https://ip.appspot.com/\n", stderr); - - exit(1); -} - -static void -die(const char *msg) -{ - fputs(msg, stderr); - exit(1); -} - -static void -die_openssl(const char *func) -{ - fprintf (stderr, "%s failed:\n", func); - - /* This is the OpenSSL function that prints the contents of the - * error stack to the specified file handle. */ - ERR_print_errors_fp (stderr); - - exit(1); -} - -/* See http://archives.seul.org/libevent/users/Jan-2013/msg00039.html */ -static int cert_verify_callback(X509_STORE_CTX *x509_ctx, void *arg) -{ - char cert_str[256]; - const char *host = (const char *) arg; - const char *res_str = "X509_verify_cert failed"; - HostnameValidationResult res = Error; - - /* This is the function that OpenSSL would call if we hadn't called - * SSL_CTX_set_cert_verify_callback(). Therefore, we are "wrapping" - * the default functionality, rather than replacing it. */ - int ok_so_far = 0; - - X509 *server_cert = NULL; - - if (ignore_cert) { - return 1; - } - - ok_so_far = X509_verify_cert(x509_ctx); - - server_cert = X509_STORE_CTX_get_current_cert(x509_ctx); - - if (ok_so_far) { - res = validate_hostname(host, server_cert); - - switch (res) { - case MatchFound: - res_str = "MatchFound"; - break; - case MatchNotFound: - res_str = "MatchNotFound"; - break; - case NoSANPresent: - res_str = "NoSANPresent"; - break; - case MalformedCertificate: - res_str = "MalformedCertificate"; - break; - case Error: - res_str = "Error"; - break; - default: - res_str = "WTF!"; - break; - } - } - - X509_NAME_oneline(X509_get_subject_name (server_cert), - cert_str, sizeof (cert_str)); - - if (res == MatchFound) { - printf("https server '%s' has this certificate, " - "which looks good to me:\n%s\n", - host, cert_str); - return 1; - } else { - printf("Got '%s' for hostname '%s' and certificate:\n%s\n", - res_str, host, cert_str); - return 0; - } -} - -int -main(int argc, char **argv) -{ - int r; - - struct evhttp_uri *http_uri; - const char *url = NULL, *data_file = NULL; - const char *scheme, *host, *path, *query; - char uri[256]; - int port; - int retries = 0; - - SSL_CTX *ssl_ctx; - SSL *ssl; - struct bufferevent *bev; - struct evhttp_connection *evcon; - struct evhttp_request *req; - struct evkeyvalq *output_headers; - struct evbuffer * output_buffer; - - int i; - - for (i = 1; i < argc; i++) { - if (!strcmp("-url", argv[i])) { - if (i < argc - 1) { - url = argv[i + 1]; - } else { - syntax(); - } - } else if (!strcmp("-ignore-cert", argv[i])) { - ignore_cert = 1; - } else if (!strcmp("-data", argv[i])) { - if (i < argc - 1) { - data_file = argv[i + 1]; - } else { - syntax(); - } - } else if (!strcmp("-retries", argv[i])) { - if (i < argc - 1) { - retries = atoi(argv[i + 1]); - } else { - syntax(); - } - } else if (!strcmp("-help", argv[i])) { - syntax(); - } - } - - if (!url) { - syntax(); - } - -#ifdef _WIN32 - { - WORD wVersionRequested; - WSADATA wsaData; - int err; - - wVersionRequested = MAKEWORD(2, 2); - - err = WSAStartup(wVersionRequested, &wsaData); - if (err != 0) { - printf("WSAStartup failed with error: %d\n", err); - return 1; - } - } -#endif // _WIN32 - - http_uri = evhttp_uri_parse(url); - if (http_uri == NULL) { - die("malformed url"); - } - - scheme = evhttp_uri_get_scheme(http_uri); - if (scheme == NULL || (strcasecmp(scheme, "https") != 0 && - strcasecmp(scheme, "http") != 0)) { - die("url must be http or https"); - } - - host = evhttp_uri_get_host(http_uri); - if (host == NULL) { - die("url must have a host"); - } - - port = evhttp_uri_get_port(http_uri); - if (port == -1) { - port = (strcasecmp(scheme, "http") == 0) ? 80 : 443; - } - - path = evhttp_uri_get_path(http_uri); - if (path == NULL) { - path = "/"; - } - - query = evhttp_uri_get_query(http_uri); - if (query == NULL) { - snprintf(uri, sizeof(uri) - 1, "%s", path); - } else { - snprintf(uri, sizeof(uri) - 1, "%s?%s", path, query); - } - uri[sizeof(uri) - 1] = '\0'; - - // Initialize OpenSSL - SSL_library_init(); - ERR_load_crypto_strings(); - SSL_load_error_strings(); - OpenSSL_add_all_algorithms(); - - /* This isn't strictly necessary... OpenSSL performs RAND_poll - * automatically on first use of random number generator. */ - r = RAND_poll(); - if (r == 0) { - die_openssl("RAND_poll"); - } - - /* Create a new OpenSSL context */ - ssl_ctx = SSL_CTX_new(SSLv23_method()); - if (!ssl_ctx) - die_openssl("SSL_CTX_new"); - - #ifndef _WIN32 - /* TODO: Add certificate loading on Windows as well */ - - /* Attempt to use the system's trusted root certificates. - * (This path is only valid for Debian-based systems.) */ - if (1 != SSL_CTX_load_verify_locations(ssl_ctx, - "/etc/ssl/certs/ca-certificates.crt", - NULL)) - die_openssl("SSL_CTX_load_verify_locations"); - /* Ask OpenSSL to verify the server certificate. Note that this - * does NOT include verifying that the hostname is correct. - * So, by itself, this means anyone with any legitimate - * CA-issued certificate for any website, can impersonate any - * other website in the world. This is not good. See "The - * Most Dangerous Code in the World" article at - * https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html - */ - SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_PEER, NULL); - /* This is how we solve the problem mentioned in the previous - * comment. We "wrap" OpenSSL's validation routine in our - * own routine, which also validates the hostname by calling - * the code provided by iSECPartners. Note that even though - * the "Everything You've Always Wanted to Know About - * Certificate Validation With OpenSSL (But Were Afraid to - * Ask)" paper from iSECPartners says very explicitly not to - * call SSL_CTX_set_cert_verify_callback (at the bottom of - * page 2), what we're doing here is safe because our - * cert_verify_callback() calls X509_verify_cert(), which is - * OpenSSL's built-in routine which would have been called if - * we hadn't set the callback. Therefore, we're just - * "wrapping" OpenSSL's routine, not replacing it. */ - SSL_CTX_set_cert_verify_callback (ssl_ctx, cert_verify_callback, - (void *) host); - #endif // not _WIN32 - - // Create event base - base = event_base_new(); - if (!base) { - perror("event_base_new()"); - return 1; - } - - // Create OpenSSL bufferevent and stack evhttp on top of it - ssl = SSL_new(ssl_ctx); - if (ssl == NULL) { - die_openssl("SSL_new()"); - } - - #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME - // Set hostname for SNI extension - SSL_set_tlsext_host_name(ssl, host); - #endif - - if (strcasecmp(scheme, "http") == 0) { - bev = bufferevent_socket_new(base, -1, BEV_OPT_CLOSE_ON_FREE); - } else { - bev = bufferevent_openssl_socket_new(base, -1, ssl, - BUFFEREVENT_SSL_CONNECTING, - BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS); - } - - if (bev == NULL) { - fprintf(stderr, "bufferevent_openssl_socket_new() failed\n"); - return 1; - } - - bufferevent_openssl_set_allow_dirty_shutdown(bev, 1); - - // For simplicity, we let DNS resolution block. Everything else should be - // asynchronous though. - evcon = evhttp_connection_base_bufferevent_new(base, NULL, bev, - host, port); - if (evcon == NULL) { - fprintf(stderr, "evhttp_connection_base_bufferevent_new() failed\n"); - return 1; - } - - if (retries > 0) { - evhttp_connection_set_retries(evcon, retries); - } - - // Fire off the request - req = evhttp_request_new(http_request_done, bev); - if (req == NULL) { - fprintf(stderr, "evhttp_request_new() failed\n"); - return 1; - } - - output_headers = evhttp_request_get_output_headers(req); - evhttp_add_header(output_headers, "Host", host); - evhttp_add_header(output_headers, "Connection", "close"); - - if (data_file) { - /* NOTE: In production code, you'd probably want to use - * evbuffer_add_file() or evbuffer_add_file_segment(), to - * avoid needless copying. */ - FILE * f = fopen(data_file, "rb"); - char buf[1024]; - size_t s; - size_t bytes = 0; - - if (!f) { - syntax(); - } - - output_buffer = evhttp_request_get_output_buffer(req); - while ((s = fread(buf, 1, sizeof(buf), f)) > 0) { - evbuffer_add(output_buffer, buf, s); - bytes += s; - } - evutil_snprintf(buf, sizeof(buf)-1, "%lu", (unsigned long)bytes); - evhttp_add_header(output_headers, "Content-Length", buf); - fclose(f); - } - - r = evhttp_make_request(evcon, req, data_file ? EVHTTP_REQ_POST : EVHTTP_REQ_GET, uri); - if (r != 0) { - fprintf(stderr, "evhttp_make_request() failed\n"); - return 1; - } - - event_base_dispatch(base); - - evhttp_connection_free(evcon); - event_base_free(base); - -#ifdef _WIN32 - WSACleanup(); -#endif - - return 0; -} diff --git a/contrib/ntp/sntp/libevent/sample/include.am b/contrib/ntp/sntp/libevent/sample/include.am deleted file mode 100644 index 75f87c7..0000000 --- a/contrib/ntp/sntp/libevent/sample/include.am +++ /dev/null @@ -1,53 +0,0 @@ -# sample/include.am for libevent -# Copyright 2000-2007 Niels Provos -# Copyright 2007-2012 Niels Provos and Nick Mathewson -# -# See LICENSE for copying information. - -SAMPLES = \ - sample/dns-example \ - sample/event-read-fifo \ - sample/hello-world \ - sample/http-server \ - sample/signal-test \ - sample/time-test - -if OPENSSL -SAMPLES += sample/le-proxy -sample_le_proxy_SOURCES = sample/le-proxy.c -sample_le_proxy_LDADD = libevent.la libevent_openssl.la ${OPENSSL_LIBS} ${OPENSSL_LIBADD} -sample_le_proxy_INCLUDES = $(OPENSSL_INCS) - -SAMPLES += sample/https-client -sample_https_client_SOURCES = \ - sample/https-client.c \ - sample/hostcheck.c \ - sample/openssl_hostname_validation.c -sample_https_client_LDADD = libevent.la libevent_openssl.la ${OPENSSL_LIBS} ${OPENSSL_LIBADD} -sample_https_client_INCLUDES = $(OPENSSL_INCS) -noinst_HEADERS += \ - sample/hostcheck.h \ - sample/openssl_hostname_validation.h -endif - -if BUILD_SAMPLES -noinst_PROGRAMS += $(SAMPLES) -endif - -$(SAMPLES) : libevent.la - -sample_event_read_fifo_SOURCES = sample/event-read-fifo.c -sample_event_read_fifo_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_time_test_SOURCES = sample/time-test.c -sample_time_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_signal_test_SOURCES = sample/signal-test.c -sample_signal_test_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_dns_example_SOURCES = sample/dns-example.c -sample_dns_example_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_hello_world_SOURCES = sample/hello-world.c -sample_hello_world_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la -sample_http_server_SOURCES = sample/http-server.c -sample_http_server_LDADD = $(LIBEVENT_GC_SECTIONS) libevent.la - - - diff --git a/contrib/ntp/sntp/libevent/sample/le-proxy.c b/contrib/ntp/sntp/libevent/sample/le-proxy.c deleted file mode 100644 index 30e0a5f..0000000 --- a/contrib/ntp/sntp/libevent/sample/le-proxy.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - This example code shows how to write an (optionally encrypting) SSL proxy - with Libevent's bufferevent layer. - - XXX It's a little ugly and should probably be cleaned up. - */ - -// Get rid of OSX 10.7 and greater deprecation warnings. -#if defined(__APPLE__) && defined(__clang__) -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif - -#include <stdio.h> -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#ifdef _WIN32 -#include <winsock2.h> -#include <ws2tcpip.h> -#else -#include <sys/socket.h> -#include <netinet/in.h> -#endif - -#include <event2/bufferevent_ssl.h> -#include <event2/bufferevent.h> -#include <event2/buffer.h> -#include <event2/listener.h> -#include <event2/util.h> - -#include <openssl/ssl.h> -#include <openssl/err.h> -#include <openssl/rand.h> - -static struct event_base *base; -static struct sockaddr_storage listen_on_addr; -static struct sockaddr_storage connect_to_addr; -static int connect_to_addrlen; -static int use_wrapper = 1; - -static SSL_CTX *ssl_ctx = NULL; - -#define MAX_OUTPUT (512*1024) - -static void drained_writecb(struct bufferevent *bev, void *ctx); -static void eventcb(struct bufferevent *bev, short what, void *ctx); - -static void -readcb(struct bufferevent *bev, void *ctx) -{ - struct bufferevent *partner = ctx; - struct evbuffer *src, *dst; - size_t len; - src = bufferevent_get_input(bev); - len = evbuffer_get_length(src); - if (!partner) { - evbuffer_drain(src, len); - return; - } - dst = bufferevent_get_output(partner); - evbuffer_add_buffer(dst, src); - - if (evbuffer_get_length(dst) >= MAX_OUTPUT) { - /* We're giving the other side data faster than it can - * pass it on. Stop reading here until we have drained the - * other side to MAX_OUTPUT/2 bytes. */ - bufferevent_setcb(partner, readcb, drained_writecb, - eventcb, bev); - bufferevent_setwatermark(partner, EV_WRITE, MAX_OUTPUT/2, - MAX_OUTPUT); - bufferevent_disable(bev, EV_READ); - } -} - -static void -drained_writecb(struct bufferevent *bev, void *ctx) -{ - struct bufferevent *partner = ctx; - - /* We were choking the other side until we drained our outbuf a bit. - * Now it seems drained. */ - bufferevent_setcb(bev, readcb, NULL, eventcb, partner); - bufferevent_setwatermark(bev, EV_WRITE, 0, 0); - if (partner) - bufferevent_enable(partner, EV_READ); -} - -static void -close_on_finished_writecb(struct bufferevent *bev, void *ctx) -{ - struct evbuffer *b = bufferevent_get_output(bev); - - if (evbuffer_get_length(b) == 0) { - bufferevent_free(bev); - } -} - -static void -eventcb(struct bufferevent *bev, short what, void *ctx) -{ - struct bufferevent *partner = ctx; - - if (what & (BEV_EVENT_EOF|BEV_EVENT_ERROR)) { - if (what & BEV_EVENT_ERROR) { - unsigned long err; - while ((err = (bufferevent_get_openssl_error(bev)))) { - const char *msg = (const char*) - ERR_reason_error_string(err); - const char *lib = (const char*) - ERR_lib_error_string(err); - const char *func = (const char*) - ERR_func_error_string(err); - fprintf(stderr, - "%s in %s %s\n", msg, lib, func); - } - if (errno) - perror("connection error"); - } - - if (partner) { - /* Flush all pending data */ - readcb(bev, ctx); - - if (evbuffer_get_length( - bufferevent_get_output(partner))) { - /* We still have to flush data from the other - * side, but when that's done, close the other - * side. */ - bufferevent_setcb(partner, - NULL, close_on_finished_writecb, - eventcb, NULL); - bufferevent_disable(partner, EV_READ); - } else { - /* We have nothing left to say to the other - * side; close it. */ - bufferevent_free(partner); - } - } - bufferevent_free(bev); - } -} - -static void -syntax(void) -{ - fputs("Syntax:\n", stderr); - fputs(" le-proxy [-s] [-W] <listen-on-addr> <connect-to-addr>\n", stderr); - fputs("Example:\n", stderr); - fputs(" le-proxy 127.0.0.1:8888 1.2.3.4:80\n", stderr); - - exit(1); -} - -static void -accept_cb(struct evconnlistener *listener, evutil_socket_t fd, - struct sockaddr *a, int slen, void *p) -{ - struct bufferevent *b_out, *b_in; - /* Create two linked bufferevent objects: one to connect, one for the - * new connection */ - b_in = bufferevent_socket_new(base, fd, - BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS); - - if (!ssl_ctx || use_wrapper) - b_out = bufferevent_socket_new(base, -1, - BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS); - else { - SSL *ssl = SSL_new(ssl_ctx); - b_out = bufferevent_openssl_socket_new(base, -1, ssl, - BUFFEREVENT_SSL_CONNECTING, - BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS); - } - - assert(b_in && b_out); - - if (bufferevent_socket_connect(b_out, - (struct sockaddr*)&connect_to_addr, connect_to_addrlen)<0) { - perror("bufferevent_socket_connect"); - bufferevent_free(b_out); - bufferevent_free(b_in); - return; - } - - if (ssl_ctx && use_wrapper) { - struct bufferevent *b_ssl; - SSL *ssl = SSL_new(ssl_ctx); - b_ssl = bufferevent_openssl_filter_new(base, - b_out, ssl, BUFFEREVENT_SSL_CONNECTING, - BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS); - if (!b_ssl) { - perror("Bufferevent_openssl_new"); - bufferevent_free(b_out); - bufferevent_free(b_in); - } - b_out = b_ssl; - } - - bufferevent_setcb(b_in, readcb, NULL, eventcb, b_out); - bufferevent_setcb(b_out, readcb, NULL, eventcb, b_in); - - bufferevent_enable(b_in, EV_READ|EV_WRITE); - bufferevent_enable(b_out, EV_READ|EV_WRITE); -} - -int -main(int argc, char **argv) -{ - int i; - int socklen; - - int use_ssl = 0; - struct evconnlistener *listener; - - if (argc < 3) - syntax(); - - for (i=1; i < argc; ++i) { - if (!strcmp(argv[i], "-s")) { - use_ssl = 1; - } else if (!strcmp(argv[i], "-W")) { - use_wrapper = 0; - } else if (argv[i][0] == '-') { - syntax(); - } else - break; - } - - if (i+2 != argc) - syntax(); - - memset(&listen_on_addr, 0, sizeof(listen_on_addr)); - socklen = sizeof(listen_on_addr); - if (evutil_parse_sockaddr_port(argv[i], - (struct sockaddr*)&listen_on_addr, &socklen)<0) { - int p = atoi(argv[i]); - struct sockaddr_in *sin = (struct sockaddr_in*)&listen_on_addr; - if (p < 1 || p > 65535) - syntax(); - sin->sin_port = htons(p); - sin->sin_addr.s_addr = htonl(0x7f000001); - sin->sin_family = AF_INET; - socklen = sizeof(struct sockaddr_in); - } - - memset(&connect_to_addr, 0, sizeof(connect_to_addr)); - connect_to_addrlen = sizeof(connect_to_addr); - if (evutil_parse_sockaddr_port(argv[i+1], - (struct sockaddr*)&connect_to_addr, &connect_to_addrlen)<0) - syntax(); - - base = event_base_new(); - if (!base) { - perror("event_base_new()"); - return 1; - } - - if (use_ssl) { - int r; - SSL_library_init(); - ERR_load_crypto_strings(); - SSL_load_error_strings(); - OpenSSL_add_all_algorithms(); - r = RAND_poll(); - if (r == 0) { - fprintf(stderr, "RAND_poll() failed.\n"); - return 1; - } - ssl_ctx = SSL_CTX_new(SSLv23_method()); - } - - listener = evconnlistener_new_bind(base, accept_cb, NULL, - LEV_OPT_CLOSE_ON_FREE|LEV_OPT_CLOSE_ON_EXEC|LEV_OPT_REUSEABLE, - -1, (struct sockaddr*)&listen_on_addr, socklen); - - if (! listener) { - fprintf(stderr, "Couldn't open listener.\n"); - event_base_free(base); - return 1; - } - event_base_dispatch(base); - - evconnlistener_free(listener); - event_base_free(base); - - return 0; -} diff --git a/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.c b/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.c deleted file mode 100644 index b5adc67..0000000 --- a/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.c +++ /dev/null @@ -1,172 +0,0 @@ -/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */ - -/* -Copyright (C) 2012, iSEC Partners. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - */ - -/* - * Helper functions to perform basic hostname validation using OpenSSL. - * - * Please read "everything-you-wanted-to-know-about-openssl.pdf" before - * attempting to use this code. This whitepaper describes how the code works, - * how it should be used, and what its limitations are. - * - * Author: Alban Diquet - * License: See LICENSE - * - */ - -// Get rid of OSX 10.7 and greater deprecation warnings. -#if defined(__APPLE__) && defined(__clang__) -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif - -#include <openssl/x509v3.h> -#include <openssl/ssl.h> - -#include "openssl_hostname_validation.h" -#include "hostcheck.h" - -#define HOSTNAME_MAX_SIZE 255 - -/** -* Tries to find a match for hostname in the certificate's Common Name field. -* -* Returns MatchFound if a match was found. -* Returns MatchNotFound if no matches were found. -* Returns MalformedCertificate if the Common Name had a NUL character embedded in it. -* Returns Error if the Common Name could not be extracted. -*/ -static HostnameValidationResult matches_common_name(const char *hostname, const X509 *server_cert) { - int common_name_loc = -1; - X509_NAME_ENTRY *common_name_entry = NULL; - ASN1_STRING *common_name_asn1 = NULL; - char *common_name_str = NULL; - - // Find the position of the CN field in the Subject field of the certificate - common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name((X509 *) server_cert), NID_commonName, -1); - if (common_name_loc < 0) { - return Error; - } - - // Extract the CN field - common_name_entry = X509_NAME_get_entry(X509_get_subject_name((X509 *) server_cert), common_name_loc); - if (common_name_entry == NULL) { - return Error; - } - - // Convert the CN field to a C string - common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry); - if (common_name_asn1 == NULL) { - return Error; - } - common_name_str = (char *) ASN1_STRING_data(common_name_asn1); - - // Make sure there isn't an embedded NUL character in the CN - if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) { - return MalformedCertificate; - } - - // Compare expected hostname with the CN - if (Curl_cert_hostcheck(common_name_str, hostname) == CURL_HOST_MATCH) { - return MatchFound; - } - else { - return MatchNotFound; - } -} - - -/** -* Tries to find a match for hostname in the certificate's Subject Alternative Name extension. -* -* Returns MatchFound if a match was found. -* Returns MatchNotFound if no matches were found. -* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it. -* Returns NoSANPresent if the SAN extension was not present in the certificate. -*/ -static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) { - HostnameValidationResult result = MatchNotFound; - int i; - int san_names_nb = -1; - STACK_OF(GENERAL_NAME) *san_names = NULL; - - // Try to extract the names within the SAN extension from the certificate - san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL); - if (san_names == NULL) { - return NoSANPresent; - } - san_names_nb = sk_GENERAL_NAME_num(san_names); - - // Check each name within the extension - for (i=0; i<san_names_nb; i++) { - const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san_names, i); - - if (current_name->type == GEN_DNS) { - // Current name is a DNS name, let's check it - char *dns_name = (char *) ASN1_STRING_data(current_name->d.dNSName); - - // Make sure there isn't an embedded NUL character in the DNS name - if ((size_t)ASN1_STRING_length(current_name->d.dNSName) != strlen(dns_name)) { - result = MalformedCertificate; - break; - } - else { // Compare expected hostname with the DNS name - if (Curl_cert_hostcheck(dns_name, hostname) - == CURL_HOST_MATCH) { - result = MatchFound; - break; - } - } - } - } - sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free); - - return result; -} - - -/** -* Validates the server's identity by looking for the expected hostname in the -* server's certificate. As described in RFC 6125, it first tries to find a match -* in the Subject Alternative Name extension. If the extension is not present in -* the certificate, it checks the Common Name instead. -* -* Returns MatchFound if a match was found. -* Returns MatchNotFound if no matches were found. -* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it. -* Returns Error if there was an error. -*/ -HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) { - HostnameValidationResult result; - - if((hostname == NULL) || (server_cert == NULL)) - return Error; - - // First try the Subject Alternative Names extension - result = matches_subject_alternative_name(hostname, server_cert); - if (result == NoSANPresent) { - // Extension was not found: try the Common Name - result = matches_common_name(hostname, server_cert); - } - - return result; -} diff --git a/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.h b/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.h deleted file mode 100644 index 54aa1c4..0000000 --- a/contrib/ntp/sntp/libevent/sample/openssl_hostname_validation.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */ - -/* -Copyright (C) 2012, iSEC Partners. - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - */ - -/* - * Helper functions to perform basic hostname validation using OpenSSL. - * - * Please read "everything-you-wanted-to-know-about-openssl.pdf" before - * attempting to use this code. This whitepaper describes how the code works, - * how it should be used, and what its limitations are. - * - * Author: Alban Diquet - * License: See LICENSE - * - */ - -typedef enum { - MatchFound, - MatchNotFound, - NoSANPresent, - MalformedCertificate, - Error -} HostnameValidationResult; - -/** -* Validates the server's identity by looking for the expected hostname in the -* server's certificate. As described in RFC 6125, it first tries to find a match -* in the Subject Alternative Name extension. If the extension is not present in -* the certificate, it checks the Common Name instead. -* -* Returns MatchFound if a match was found. -* Returns MatchNotFound if no matches were found. -* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it. -* Returns Error if there was an error. -*/ -HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert); diff --git a/contrib/ntp/sntp/libevent/sample/signal-test.c b/contrib/ntp/sntp/libevent/sample/signal-test.c deleted file mode 100644 index a61642f..0000000 --- a/contrib/ntp/sntp/libevent/sample/signal-test.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Compile with: - * cc -I/usr/local/include -o signal-test \ - * signal-test.c -L/usr/local/lib -levent - */ - -#include <sys/types.h> - -#include <event2/event-config.h> - -#include <sys/stat.h> -#ifndef _WIN32 -#include <sys/queue.h> -#include <unistd.h> -#include <sys/time.h> -#else -#include <winsock2.h> -#include <windows.h> -#endif -#include <signal.h> -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#include <event2/event.h> - -#ifdef EVENT____func__ -#define __func__ EVENT____func__ -#endif - -int called = 0; - -static void -signal_cb(evutil_socket_t fd, short event, void *arg) -{ - struct event *signal = arg; - - printf("%s: got signal %d\n", __func__, event_get_signal(signal)); - - if (called >= 2) - event_del(signal); - - called++; -} - -int -main(int argc, char **argv) -{ - struct event *signal_int; - struct event_base* base; -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 2); - - (void) WSAStartup(wVersionRequested, &wsaData); -#endif - - /* Initalize the event library */ - base = event_base_new(); - - /* Initalize one event */ - signal_int = evsignal_new(base, SIGINT, signal_cb, event_self_cbarg()); - - event_add(signal_int, NULL); - - event_base_dispatch(base); - event_base_free(base); - - return (0); -} - diff --git a/contrib/ntp/sntp/libevent/sample/time-test.c b/contrib/ntp/sntp/libevent/sample/time-test.c deleted file mode 100644 index c94c18a..0000000 --- a/contrib/ntp/sntp/libevent/sample/time-test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * XXX This sample code was once meant to show how to use the basic Libevent - * interfaces, but it never worked on non-Unix platforms, and some of the - * interfaces have changed since it was first written. It should probably - * be removed or replaced with something better. - * - * Compile with: - * cc -I/usr/local/include -o time-test time-test.c -L/usr/local/lib -levent - */ - -#include <sys/types.h> - -#include <event2/event-config.h> - -#include <sys/stat.h> -#ifndef _WIN32 -#include <sys/queue.h> -#include <unistd.h> -#endif -#include <time.h> -#ifdef EVENT__HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <fcntl.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> -#include <errno.h> - -#include <event2/event.h> -#include <event2/event_struct.h> -#include <event2/util.h> - -#ifdef _WIN32 -#include <winsock2.h> -#endif - -struct timeval lasttime; - -int event_is_persistent; - -static void -timeout_cb(evutil_socket_t fd, short event, void *arg) -{ - struct timeval newtime, difference; - struct event *timeout = arg; - double elapsed; - - evutil_gettimeofday(&newtime, NULL); - evutil_timersub(&newtime, &lasttime, &difference); - elapsed = difference.tv_sec + - (difference.tv_usec / 1.0e6); - - printf("timeout_cb called at %d: %.3f seconds elapsed.\n", - (int)newtime.tv_sec, elapsed); - lasttime = newtime; - - if (! event_is_persistent) { - struct timeval tv; - evutil_timerclear(&tv); - tv.tv_sec = 2; - event_add(timeout, &tv); - } -} - -int -main(int argc, char **argv) -{ - struct event timeout; - struct timeval tv; - struct event_base *base; - int flags; - -#ifdef _WIN32 - WORD wVersionRequested; - WSADATA wsaData; - - wVersionRequested = MAKEWORD(2, 2); - - (void)WSAStartup(wVersionRequested, &wsaData); -#endif - - if (argc == 2 && !strcmp(argv[1], "-p")) { - event_is_persistent = 1; - flags = EV_PERSIST; - } else { - event_is_persistent = 0; - flags = 0; - } - - /* Initalize the event library */ - base = event_base_new(); - - /* Initalize one event */ - event_assign(&timeout, base, -1, flags, timeout_cb, (void*) &timeout); - - evutil_timerclear(&tv); - tv.tv_sec = 2; - event_add(&timeout, &tv); - - evutil_gettimeofday(&lasttime, NULL); - - event_base_dispatch(base); - - return (0); -} - diff --git a/contrib/ntp/sntp/libevent/test/bench_httpclient.c b/contrib/ntp/sntp/libevent/test/bench_httpclient.c index 22f174d..1573e36 100644 --- a/contrib/ntp/sntp/libevent/test/bench_httpclient.c +++ b/contrib/ntp/sntp/libevent/test/bench_httpclient.c @@ -159,6 +159,10 @@ launch_request(void) } ri = malloc(sizeof(*ri)); + if (ri == NULL) { + printf("Unable to allocate memory in launch_request()\n"); + return -1; + } ri->n_read = 0; evutil_gettimeofday(&ri->started, NULL); diff --git a/contrib/ntp/sntp/libevent/test/regress.c b/contrib/ntp/sntp/libevent/test/regress.c index 399ba2f..2d887f0 100644 --- a/contrib/ntp/sntp/libevent/test/regress.c +++ b/contrib/ntp/sntp/libevent/test/regress.c @@ -2823,6 +2823,10 @@ static void * dummy_malloc(size_t len) { char *mem = malloc(len+16); + if (mem == NULL) { + fprintf(stderr, "Unable to allocate memory in dummy_malloc()\n"); + return NULL; + } memcpy(mem, "{[<guardedram>]}", 16); return mem+16; } diff --git a/contrib/ntp/sntp/libevent/test/regress_dns.c b/contrib/ntp/sntp/libevent/test/regress_dns.c index 6d6b484..3181140 100644 --- a/contrib/ntp/sntp/libevent/test/regress_dns.c +++ b/contrib/ntp/sntp/libevent/test/regress_dns.c @@ -1322,7 +1322,7 @@ test_getaddrinfo_async(void *arg) int n_dns_questions = 0; struct evdns_base *dns_base; - memset(a_out, 0, sizeof(a_out)); + memset(&a_out, 0, sizeof(a_out)); memset(&local_outcome, 0, sizeof(local_outcome)); dns_base = evdns_base_new(data->base, 0); @@ -1746,7 +1746,8 @@ end: static void gaic_launch(struct event_base *base, struct evdns_base *dns_base) { - struct gaic_request_status *status = calloc(1,sizeof(*status)); + struct gaic_request_status *status = calloc(1, sizeof(*status)); + tt_assert(status); struct timeval tv = { 0, 10000 }; status->magic = GAIC_MAGIC; status->base = base; diff --git a/contrib/ntp/sntp/libevent/test/regress_http.c b/contrib/ntp/sntp/libevent/test/regress_http.c index 35f6dd7..147f6ff 100644 --- a/contrib/ntp/sntp/libevent/test/regress_http.c +++ b/contrib/ntp/sntp/libevent/test/regress_http.c @@ -367,6 +367,10 @@ http_chunked_cb(struct evhttp_request *req, void *arg) struct timeval when = { 0, 0 }; struct chunk_req_state *state = malloc(sizeof(struct chunk_req_state)); event_debug(("%s: called\n", __func__)); + if (state == NULL) { + fprintf(stderr, "Unable to allocate memory in http_chunked_cb()\n"); + exit(1); + } memset(state, 0, sizeof(struct chunk_req_state)); state->req = req; diff --git a/contrib/ntp/sntp/libevent/test/regress_minheap.c b/contrib/ntp/sntp/libevent/test/regress_minheap.c index 05db32e..24ff293 100644 --- a/contrib/ntp/sntp/libevent/test/regress_minheap.c +++ b/contrib/ntp/sntp/libevent/test/regress_minheap.c @@ -63,6 +63,7 @@ test_heap_randomized(void *ptr) for (i = 0; i < 1024; ++i) { inserted[i] = malloc(sizeof(struct event)); + assert(inserted[i] != NULL); set_random_timeout(inserted[i]); min_heap_push_(&heap, inserted[i]); } diff --git a/contrib/ntp/sntp/libevent/test/test-ratelim.c b/contrib/ntp/sntp/libevent/test/test-ratelim.c index 17babfd..40a1b95 100644 --- a/contrib/ntp/sntp/libevent/test/test-ratelim.c +++ b/contrib/ntp/sntp/libevent/test/test-ratelim.c @@ -340,6 +340,10 @@ test_ratelimiting(void) bevs = calloc(cfg_n_connections, sizeof(struct bufferevent *)); states = calloc(cfg_n_connections, sizeof(struct client_state)); + if (bevs == NULL || states == NULL) { + printf("Unable to allocate memory...\n"); + return 1; + } for (i = 0; i < cfg_n_connections; ++i) { bevs[i] = bufferevent_socket_new(base, -1, diff --git a/contrib/ntp/sntp/libevent/test/test-time.c b/contrib/ntp/sntp/libevent/test/test-time.c index bcc7086..e7dff7d 100644 --- a/contrib/ntp/sntp/libevent/test/test-time.c +++ b/contrib/ntp/sntp/libevent/test/test-time.c @@ -99,6 +99,7 @@ main(int argc, char **argv) for (i = 0; i < NEVENT; i++) { ev[i] = malloc(sizeof(struct event)); + assert(ev[i] != NULL); /* Initalize one event */ evtimer_set(ev[i], time_cb, ev[i]); diff --git a/contrib/ntp/sntp/libopts/Makefile.in b/contrib/ntp/sntp/libopts/Makefile.in index 4ca06b7..1f138a2 100644 --- a/contrib/ntp/sntp/libopts/Makefile.in +++ b/contrib/ntp/sntp/libopts/Makefile.in @@ -236,6 +236,7 @@ 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@ @@ -244,6 +245,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -297,6 +299,7 @@ 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@ diff --git a/contrib/ntp/sntp/libopts/compat/pathfind.c b/contrib/ntp/sntp/libopts/compat/pathfind.c index 5c477ca..d343dcc 100644 --- a/contrib/ntp/sntp/libopts/compat/pathfind.c +++ b/contrib/ntp/sntp/libopts/compat/pathfind.c @@ -115,9 +115,15 @@ make_absolute( char const * string, char const * dot_path ) if (!dot_path || *string == '/') { result = strdup( string ); + if (result == NULL) { + return NULL; /* couldn't allocate memory */ + } } else { if (dot_path && dot_path[0]) { result = malloc( 2 + strlen( dot_path ) + strlen( string ) ); + if (result == NULL) { + return NULL; /* couldn't allocate memory */ + } strcpy( result, dot_path ); result_len = (int)strlen(result); if (result[result_len - 1] != '/') { @@ -126,6 +132,9 @@ make_absolute( char const * string, char const * dot_path ) } } else { result = malloc( 3 + strlen( string ) ); + if (result == NULL) { + return NULL; /* couldn't allocate memory */ + } result[0] = '.'; result[1] = '/'; result[2] = '\0'; result_len = 2; } @@ -155,7 +164,9 @@ canonicalize_pathname( char *path ) /* The result cannot be larger than the input PATH. */ result = strdup( path ); - + if (result == NULL) { + return NULL; /* couldn't allocate memory */ + } stub_char = (*path == '/') ? '/' : '.'; /* Walk along RESULT looking for things to compact. */ diff --git a/contrib/ntp/sntp/log.c b/contrib/ntp/sntp/log.c index d703495..db6614d 100644 --- a/contrib/ntp/sntp/log.c +++ b/contrib/ntp/sntp/log.c @@ -2,7 +2,9 @@ #include "log.h" -char *progname; /* for msyslog use too */ +const char *progname; /* for msyslog use too */ + +static int counter = 0; static void cleanup_log(void); @@ -11,6 +13,7 @@ sntp_init_logging( const char *prog ) { + msyslog_term = TRUE; init_logging(prog, 0, FALSE); msyslog_term_pid = FALSE; @@ -24,15 +27,21 @@ open_logfile( ) { change_logfile(logfile, FALSE); + counter = 1; //counter++; atexit(cleanup_log); } - +//not sure about this. Are the atexit() functions called by FIFO or LIFO order? The end result is PROBABLY the same static void cleanup_log(void) { - syslogit = TRUE; - fflush(syslog_file); - fclose(syslog_file); - syslog_file = NULL; + //counter--; + //if(counter <= 0){ + if(counter == 1){ + syslogit = TRUE; + fflush(syslog_file); + fclose(syslog_file); + syslog_file = NULL; + counter = 0; + } } diff --git a/contrib/ntp/sntp/log.h b/contrib/ntp/sntp/log.h index fdb2ba2..2d047ba 100644 --- a/contrib/ntp/sntp/log.h +++ b/contrib/ntp/sntp/log.h @@ -22,6 +22,6 @@ void sntp_init_logging(const char *program); void open_logfile(const char *logfile); -extern char *progname; /* for msyslog use too */ +extern char const *progname; /* for msyslog use too */ #endif diff --git a/contrib/ntp/sntp/m4/ntp_libevent.m4 b/contrib/ntp/sntp/m4/ntp_libevent.m4 index 54174f0..895360e 100644 --- a/contrib/ntp/sntp/m4/ntp_libevent.m4 +++ b/contrib/ntp/sntp/m4/ntp_libevent.m4 @@ -64,6 +64,7 @@ AC_REQUIRE([NTP_ENABLE_LOCAL_LIBEVENT])dnl ntp_libevent_min_version=m4_default([$1], [2.0.9]) ntp_libevent_tearoff=m4_default([$2], [libevent]) +AC_SUBST([CFLAGS_LIBEVENT]) AC_SUBST([CPPFLAGS_LIBEVENT]) AC_SUBST([LDADD_LIBEVENT]) @@ -78,6 +79,7 @@ case "$ntp_use_local_libevent" in then ntp_use_local_libevent=no AC_MSG_NOTICE([Using the installed libevent]) + CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads` CPPFLAGS_LIBEVENT=`$PKG_CONFIG --cflags-only-I libevent` # HMS: I hope the following is accurate. # We don't need -levent, we only need -levent_core. @@ -106,6 +108,9 @@ case "$ntp_use_local_libevent" in AC_MSG_RESULT([yes]) else ntp_use_local_libevent=yes + # HMS: do we only need to do this if LIBISC_PTHREADS_NOTHREADS + # is "pthreads"? + CFLAGS_LIBEVENT=`$PKG_CONFIG --cflags libevent_pthreads` AC_MSG_RESULT([no]) fi ;; @@ -129,6 +134,22 @@ case "$ntp_use_local_libevent" in esac esac +dnl AC_ARG_ENABLE( +dnl [cflags-libevent], +dnl [AC_HELP_STRING( +dnl [--enable-cflags-libevent=-pthread], +dnl [CFLAGS value to build with pthreads] +dnl )], +dnl [CFLAGS_LIBEVENT=$enableval], +dnl [# See above about LIBISC_PTHREADS_NOTHREADS +dnl case "$CFLAGS_LIBEVENT" in +dnl '') CFLAGS_LIBEVENT="-pthread" ;; +dnl *) ;; +dnl esac] +dnl ) +dnl AC_MSG_NOTICE([LIBISC_PTHREADS_NOTHREADS is <$LIBISC_PTHREADS_NOTHREADS>]) +dnl AC_MSG_NOTICE([CFLAGS_LIBEVENT is <$CFLAGS_LIBEVENT>]) + AM_CONDITIONAL([BUILD_LIBEVENT], [test "x$ntp_use_local_libevent" = "xyes"]) ]) dnl NTP_LIBEVENT_CHECK_NOBUILD diff --git a/contrib/ntp/sntp/m4/ntp_libntp.m4 b/contrib/ntp/sntp/m4/ntp_libntp.m4 index 89b94b6..01d82fc 100644 --- a/contrib/ntp/sntp/m4/ntp_libntp.m4 +++ b/contrib/ntp/sntp/m4/ntp_libntp.m4 @@ -328,7 +328,8 @@ AC_ARG_ENABLE( ) have_pthreads=no case "$enable_thread_support" in - yes) + no) ;; + *) ol_found_pthreads=no OL_THREAD_CHECK([ol_found_pthreads=yes]) case "$ol_found_pthreads" in @@ -346,18 +347,6 @@ case "$enable_thread_support" in yes) PTHREAD_LIBS="$LTHREAD_LIBS" have_pthreads=yes - # Bug 2332: With GCC we need to force a reference to libgcc_s - # (if libgcc_s exists) or the combination of - # threads + setuid + mlockall does not work on linux because - # thread cancellation fails to load libgcc_s with dlopen(). - # We have to pass this all as linker options to avoid argument - # reordering by libtool. - case "$GCC$with_gnu_ld" in - yesyes) - AC_CHECK_LIB([gcc_s], [exit], - [PTHREAD_LIBS="$LTHREAD_LIBS -Wl,--no-as-needed,-lgcc_s,--as-needed"]) - ;; - esac esac esac esac diff --git a/contrib/ntp/sntp/m4/ntp_problemtests.m4 b/contrib/ntp/sntp/m4/ntp_problemtests.m4 new file mode 100644 index 0000000..4596e85 --- /dev/null +++ b/contrib/ntp/sntp/m4/ntp_problemtests.m4 @@ -0,0 +1,56 @@ +dnl ###################################################################### +dnl NTP_PROBLEM_TESTS +dnl +dnl Some platforms have problems building or running certain tests. +dnl While we're in the initial phase of the deployment of the test +dnl framework, sometimes we may need to disable these tests. +dnl +dnl This is where we do that. +dnl +AC_DEFUN([NTP_PROBLEM_TESTS], [ +case "$build" in + $host) cross=0 ;; + *) cross=1 ;; +esac + +AC_MSG_CHECKING([if we want to enable tests with undiagnosed problems]) +AC_ARG_ENABLE( + [problem-tests], + [AS_HELP_STRING( + [--enable-problem-tests], + [+ enable tests with undiagnosed problems] + )], + [ntp_ept=$enableval], + [ntp_ept=yes] +) +AC_MSG_RESULT([$ntp_ept]) + +AC_MSG_CHECKING([if we can run test-ntp_restrict]) +ntp_test_ntp_restrict="no" +case "$ntp_ept:$cross:$host" in + no:0:*-*-solaris*) ;; + no:0:*-*-hpux-11.23*) ;; + *) ntp_test_ntp_restrict="yes" ;; +esac +AC_MSG_RESULT([$ntp_test_ntp_restrict]) +AM_CONDITIONAL([BUILD_TEST_NTP_RESTRICT], [test x$ntp_test_ntp_restrict = xyes]) + +AC_MSG_CHECKING([if we can run test-ntp_scanner]) +ntp_test_ntp_scanner="no" +case "$ntp_ept:$cross:$host" in + no:0:*-*-solaris*) ;; + *) ntp_test_ntp_scanner="yes" ;; +esac +AC_MSG_RESULT([$ntp_test_ntp_scanner]) +AM_CONDITIONAL([BUILD_TEST_NTP_SCANNER], [test x$ntp_test_ntp_scanner = xyes]) + +AC_MSG_CHECKING([if we can run test-ntp_signd]) +ntp_test_ntp_signd="no" +case "$ntp_ept:$cross:$host" in + no:0:*-*-solaris*) ;; + *) ntp_test_ntp_signd="yes" ;; +esac +AC_MSG_RESULT([$ntp_test_ntp_signd]) +AM_CONDITIONAL([BUILD_TEST_NTP_SIGND], [test x$ntp_test_ntp_signd = xyes]) +]) +dnl ====================================================================== diff --git a/contrib/ntp/sntp/m4/ntp_rlimit.m4 b/contrib/ntp/sntp/m4/ntp_rlimit.m4 index c1267b7..b87d567 100644 --- a/contrib/ntp/sntp/m4/ntp_rlimit.m4 +++ b/contrib/ntp/sntp/m4/ntp_rlimit.m4 @@ -26,10 +26,15 @@ AC_CACHE_CHECK( [ntp_cv_rlimit_memlock=no] )] ) +case "$host" in + *-*-*linux*) + ntp_dflt_rlimit_memlock="-1" ;; + *) ntp_dflt_rlimit_memlock="32" ;; +esac case "$ntp_cv_rlimit_memlock" in yes) AC_SUBST([HAVE_RLIMIT_MEMLOCK]) - HAVE_RLIMIT_MEMLOCK=" memlock 32" + HAVE_RLIMIT_MEMLOCK=" memlock $ntp_dflt_rlimit_memlock" ;; esac AC_CACHE_CHECK( @@ -62,5 +67,59 @@ case "$ntp_cv_rlimit_stack" in HAVE_RLIMIT_STACK=" stacksize 50" esac +# HMS: Only if we are doing the MLOCKALL stuff... +AC_MSG_CHECKING([for the default number of 4k stack pages]) +AC_ARG_WITH( + [stack-limit], + [AS_HELP_STRING( + [--with-stack-limit], + [? =50 (200 for openbsd) 4k pages] + )], + [ans=$withval], + [ans=yes] +) +case "$ans" in + yes | no) + case "$host" in + *-*-openbsd*) + ans=200 + ;; + *) ans=50 + ;; + esac + ;; + [[1-9]][[0-9]]*) + ;; + *) AC_MSG_ERROR(["--with-stack-limit requires an integer argument."]) + ;; +esac +AC_MSG_RESULT([$ans]) +AC_DEFINE_UNQUOTED([DFLT_RLIMIT_STACK], [$ans], + [Default number of 4k pages for RLIMIT_STACK]) + +# HMS: only if we have RLIMIT_MEMLOCK +AC_MSG_CHECKING([for the default number of megabytes to MEMLOCK]) +AC_ARG_WITH( + [memlock], + [AS_HELP_STRING( + [--with-memlock], + [? =32 (-1 on linux) megabytes] + )], + [ans=$withval], + [ans=yes] +) +case "$ans" in + yes | no) + ans=$ntp_dflt_rlimit_memlock + ;; + [[1-9]][[0-9]]*) ;; + *) AC_MSG_ERROR(["--with-memlock requires an integer argument."]) + ;; +esac +AC_MSG_RESULT([$ans]) +AC_DEFINE_UNQUOTED([DFLT_RLIMIT_MEMLOCK], [$ans], + [Default number of megabytes for RLIMIT_MEMLOCK]) + ])dnl + dnl ====================================================================== diff --git a/contrib/ntp/sntp/m4/openldap-thread-check.m4 b/contrib/ntp/sntp/m4/openldap-thread-check.m4 index 33f9199..7768a5c 100644 --- a/contrib/ntp/sntp/m4/openldap-thread-check.m4 +++ b/contrib/ntp/sntp/m4/openldap-thread-check.m4 @@ -15,6 +15,9 @@ dnl <http://www.OpenLDAP.org/license.html>. dnl dnl -------------------------------------------------------------------- +dnl This file is a fragment of OpenLDAP's build/openldap.m4 and some +dnl fragments of OpenLDAP's configure.ac . + # OL_THREAD_CHECK([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) AC_DEFUN([OL_THREAD_CHECK], [ @@ -202,6 +205,8 @@ dnl [ol_cv_pthread_lpthread_lexc]) OL_PTHREAD_TRY([-lpthreads],[ol_cv_pthread_lib_lpthreads]) +AC_MSG_NOTICE([ol_link_threads: <$ol_link_threads> ol_link_pthreads <$ol_link_pthreads>]) + if test $ol_link_threads != no ; then LTHREAD_LIBS="$LTHREAD_LIBS $ol_link_pthreads" @@ -680,4 +685,8 @@ case "$ol_with_threads" in esac AC_LANG_RESTORE + +AC_SUBST(BUILD_THREAD) +AC_SUBST(LTHREAD_LIBS) + ]) diff --git a/contrib/ntp/sntp/m4/os_cflags.m4 b/contrib/ntp/sntp/m4/os_cflags.m4 index a2161e6..4ff2ac0 100644 --- a/contrib/ntp/sntp/m4/os_cflags.m4 +++ b/contrib/ntp/sntp/m4/os_cflags.m4 @@ -2,7 +2,7 @@ dnl ###################################################################### dnl Specify additional compile options based on the OS and the compiler AC_DEFUN([NTP_OS_CFLAGS], [ AC_MSG_CHECKING([additional compiler flags]) - # allow ntp_os_flags to be preset to skip this stuff + # allow ntp_os_cflags to be preset to skip this stuff case "${ntp_os_cflags+set}" in set) ;; @@ -90,7 +90,7 @@ AC_DEFUN([NTP_OS_CFLAGS], [ ;; esac esac - case "$ntp_os_flags" in + case "$ntp_os_cflags" in '') ntp_os_cflags_msg="none needed" ;; @@ -100,5 +100,35 @@ AC_DEFUN([NTP_OS_CFLAGS], [ CFLAGS_NTP="$CFLAGS_NTP $ntp_os_cflags" AC_MSG_RESULT([$ntp_os_cflags_msg]) AS_UNSET([ntp_os_cflags_msg]) + ### + AC_MSG_CHECKING([additional linker flags]) + # HMS: The following might still need tweaking + # allow ntp_os_ldflags to be preset to skip this stuff + case "${ntp_os_ldflags+set}" in + set) + ;; + *) + ntp_os_ldflags= + case "$host_os" in + hpux*) + case "$GCC" in + yes) + ntp_os_ldflags="-Wl,+allowdups" + ;; + esac + ;; + esac + ;; + esac + case "$ntp_os_ldflags" in + '') + ntp_os_ldflags_msg="none needed" + ;; + *) + ntp_os_ldflags_msg="$ntp_os_ldflags" + esac + LDFLAGS_NTP="$LDFLAGS_NTP $ntp_os_ldflags" + AC_MSG_RESULT([$ntp_os_ldflags_msg]) + AS_UNSET([ntp_os_ldflags_msg]) ]) dnl ====================================================================== diff --git a/contrib/ntp/sntp/m4/version.m4 b/contrib/ntp/sntp/m4/version.m4 index b83123f..7d51426 100644 --- a/contrib/ntp/sntp/m4/version.m4 +++ b/contrib/ntp/sntp/m4/version.m4 @@ -1 +1 @@ -m4_define([VERSION_NUMBER],[4.2.8p3]) +m4_define([VERSION_NUMBER],[4.2.8p4]) diff --git a/contrib/ntp/sntp/networking.c b/contrib/ntp/sntp/networking.c index bef7352..ddd45ef 100644 --- a/contrib/ntp/sntp/networking.c +++ b/contrib/ntp/sntp/networking.c @@ -113,7 +113,7 @@ process_pkt ( l_fp sent_xmt; l_fp resp_org; - key_id = 0; + // key_id = 0; pkt_key = NULL; is_authentic = (HAVE_OPT(AUTHENTICATION)) ? 0 : -1; diff --git a/contrib/ntp/sntp/scripts/Makefile.in b/contrib/ntp/sntp/scripts/Makefile.in index 0eda41d..0494fc3 100644 --- a/contrib/ntp/sntp/scripts/Makefile.in +++ b/contrib/ntp/sntp/scripts/Makefile.in @@ -153,6 +153,7 @@ 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@ @@ -161,6 +162,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -214,6 +216,7 @@ 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@ diff --git a/contrib/ntp/sntp/sntp-opts.c b/contrib/ntp/sntp/sntp-opts.c index be05bb6..e46a80c 100644 --- a/contrib/ntp/sntp/sntp-opts.c +++ b/contrib/ntp/sntp/sntp-opts.c @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.c) * - * It has been AutoGen-ed June 29, 2015 at 04:23:20 PM by AutoGen 5.18.5 + * It has been AutoGen-ed October 21, 2015 at 12:30:23 PM by AutoGen 5.18.5 * From the definitions sntp-opts.def * and the template file options * @@ -70,7 +70,7 @@ extern FILE * option_usage_fp; * static const strings for sntp options */ static char const sntp_opt_strs[2549] = -/* 0 */ "sntp 4.2.8p3\n" +/* 0 */ "sntp 4.2.8p4\n" "Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the NTP License, copies of which\n" @@ -155,7 +155,7 @@ static char const sntp_opt_strs[2549] = /* 2298 */ "LOAD_OPTS\0" /* 2308 */ "no-load-opts\0" /* 2321 */ "SNTP\0" -/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p3\n" +/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n" "Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n" "\t\t[ hostname-or-IP ...]\n\0" /* 2485 */ "$HOME\0" @@ -163,7 +163,7 @@ static char const sntp_opt_strs[2549] = /* 2493 */ ".ntprc\0" /* 2500 */ "http://bugs.ntp.org, bugs@ntp.org\0" /* 2534 */ "\n\0" -/* 2536 */ "sntp 4.2.8p3"; +/* 2536 */ "sntp 4.2.8p4"; /** * ipv4 option description with @@ -1173,7 +1173,7 @@ static void bogus_function(void) { translate option names. */ /* referenced via sntpOptions.pzCopyright */ - puts(_("sntp 4.2.8p3\n\ + puts(_("sntp 4.2.8p4\n\ Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\ This is free software. It is licensed for use, modification and\n\ redistribution under the terms of the NTP License, copies of which\n\ @@ -1263,7 +1263,7 @@ implied warranty.\n")); puts(_("load options from a config file")); /* referenced via sntpOptions.pzUsageTitle */ - puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p3\n\ + puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n\ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\ \t\t[ hostname-or-IP ...]\n")); @@ -1271,7 +1271,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\ puts(_("\n")); /* referenced via sntpOptions.pzFullVersion */ - puts(_("sntp 4.2.8p3")); + puts(_("sntp 4.2.8p4")); /* referenced via sntpOptions.pzFullUsage */ puts(_("<<<NOT-FOUND>>>")); diff --git a/contrib/ntp/sntp/sntp-opts.h b/contrib/ntp/sntp/sntp-opts.h index 06fa376..895421e 100644 --- a/contrib/ntp/sntp/sntp-opts.h +++ b/contrib/ntp/sntp/sntp-opts.h @@ -1,7 +1,7 @@ /* * EDIT THIS FILE WITH CAUTION (sntp-opts.h) * - * It has been AutoGen-ed June 29, 2015 at 04:23:19 PM by AutoGen 5.18.5 + * It has been AutoGen-ed October 21, 2015 at 12:30:22 PM by AutoGen 5.18.5 * From the definitions sntp-opts.def * and the template file options * @@ -91,9 +91,9 @@ typedef enum { /** count of all options for sntp */ #define OPTION_CT 23 /** sntp version */ -#define SNTP_VERSION "4.2.8p3" +#define SNTP_VERSION "4.2.8p4" /** Full sntp version text */ -#define SNTP_FULL_VERSION "sntp 4.2.8p3" +#define SNTP_FULL_VERSION "sntp 4.2.8p4" /** * Interface defines for all options. Replace "n" with the UPPER_CASED diff --git a/contrib/ntp/sntp/sntp.1sntpman b/contrib/ntp/sntp/sntp.1sntpman index 9033a81..89facc6 100644 --- a/contrib/ntp/sntp/sntp.1sntpman +++ b/contrib/ntp/sntp/sntp.1sntpman @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH sntp 1sntpman "29 Jun 2015" "4.2.8p3" "User Commands" +.TH sntp 1sntpman "21 Oct 2015" "4.2.8p4" "User Commands" .\" -.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-JTaaO5/ag-VTa4M5) +.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag) .\" -.\" It has been AutoGen-ed June 29, 2015 at 04:23:26 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/sntp/sntp.1sntpmdoc b/contrib/ntp/sntp/sntp.1sntpmdoc index 52bc5ad..b1b3940 100644 --- a/contrib/ntp/sntp/sntp.1sntpmdoc +++ b/contrib/ntp/sntp/sntp.1sntpmdoc @@ -1,9 +1,9 @@ -.Dd June 29 2015 +.Dd October 21 2015 .Dt SNTP 1sntpmdoc User Commands .Os .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) .\" -.\" It has been AutoGen-ed June 29, 2015 at 04:23:32 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/sntp/sntp.html b/contrib/ntp/sntp/sntp.html index c5f11b6..5ea532e 100644 --- a/contrib/ntp/sntp/sntp.html +++ b/contrib/ntp/sntp/sntp.html @@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server clock. Run as root, it can correct the system clock to this offset as well. It can be run as an interactive command or from a cron job. - <p>This document applies to version 4.2.8p3 of <code>sntp</code>. + <p>This document applies to version 4.2.8p4 of <code>sntp</code>. <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 IETF specification. @@ -176,7 +176,7 @@ the usage text by passing it through a pager program. used to select the program, defaulting to <span class="file">more</span>. Both will exit with a status code of 0. -<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p3 +<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4 Usage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ [ hostname-or-IP ...] Flg Arg Option-Name Description diff --git a/contrib/ntp/sntp/sntp.man.in b/contrib/ntp/sntp/sntp.man.in index f4607eb..84afa7e 100644 --- a/contrib/ntp/sntp/sntp.man.in +++ b/contrib/ntp/sntp/sntp.man.in @@ -10,11 +10,11 @@ .ds B-Font B .ds I-Font I .ds R-Font R -.TH sntp @SNTP_MS@ "29 Jun 2015" "4.2.8p3" "User Commands" +.TH sntp @SNTP_MS@ "21 Oct 2015" "4.2.8p4" "User Commands" .\" -.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-JTaaO5/ag-VTa4M5) +.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag) .\" -.\" It has been AutoGen-ed June 29, 2015 at 04:23:26 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agman-cmd.tpl .SH NAME diff --git a/contrib/ntp/sntp/sntp.mdoc.in b/contrib/ntp/sntp/sntp.mdoc.in index f302ab9..0313e5e 100644 --- a/contrib/ntp/sntp/sntp.mdoc.in +++ b/contrib/ntp/sntp/sntp.mdoc.in @@ -1,9 +1,9 @@ -.Dd June 29 2015 +.Dd October 21 2015 .Dt SNTP @SNTP_MS@ User Commands .Os .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) .\" -.\" It has been AutoGen-ed June 29, 2015 at 04:23:32 PM by AutoGen 5.18.5 +.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5 .\" From the definitions sntp-opts.def .\" and the template file agmdoc-cmd.tpl .Sh NAME diff --git a/contrib/ntp/sntp/tests/Makefile.am b/contrib/ntp/sntp/tests/Makefile.am index 2228aa0..c5338c7 100644 --- a/contrib/ntp/sntp/tests/Makefile.am +++ b/contrib/ntp/sntp/tests/Makefile.am @@ -1,10 +1,31 @@ NULL = BUILT_SOURCES = -CLEANFILES = kod-output-blank kod-output-single kod-output-multiple debug-output-lfp-dec debug-output-lfp-bin debug-output-pkt -DISTCLEANFILES = kod-output-blank kod-output-single kod-output-multiple EXTRA_PROGRAMS = -run_unity = cd $(srcdir) && ruby ../../sntp/unity/auto/generate_test_runner.rb +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 @@ -15,50 +36,15 @@ check_PROGRAMS = \ test-keyFile \ test-kodDatabase \ test-kodFile \ + test-log \ test-networking \ test-packetHandling \ test-packetProcessing \ test-utilities \ $(NULL) -if GTEST_AVAILABLE -check_PROGRAMS += tests -else -EXTRA_PROGRAMS += tests -endif - -#if BUILD_SNTP -#check_PROGRAMS += tests -#endif - -base_SOURCES = \ - ../tests_main.cpp \ - $(NULL) - -tests_SOURCES = \ - $(base_SOURCES) \ - g_networking.cpp \ - g_packetHandling.cpp \ - g_packetProcessing.cpp \ - $(NULL) - -# HMS: this test was for the 4.2.6 sntp code. -# g_nameresolution.cpp - -# HMS: Somebody needs to audit the following files to -# make sure all of these tests are now handled by Unity -# -# g_utilities.cpp -# g_kodDatabase.cpp -# g_keyFile.cpp -# g_crypto.cpp -# g_kodFile.cpp - noinst_HEADERS = \ - fileHandlingTest.h \ sntptest.h \ - g_fileHandlingTest.h \ - g_sntptest.h \ $(NULL) dist_check_SCRIPTS = tests-runner @@ -89,33 +75,32 @@ CLEANFILES += \ $(NULL) #split into LDADD and tests_LDADD? -LDADD = \ +base_LDADD = \ ../libsntp.a \ $(LIBOPTS_LDADD) \ $(LDADD_LIBEVENT) \ $(top_builddir)/../libntp/libntp.a \ $(LDADD_LIBNTP) \ $(LDADD_NTP) \ - $(GTEST_LDFLAGS) \ - $(GTEST_LIBS) \ $(NULL) -unity_tests_LDADD = \ - $(LDADD) \ +LDADD = \ + $(base_LDADD) \ $(top_builddir)/unity/libunity.a \ $(LIBM) \ $(NULL) -AM_CFLAGS = $(CFLAGS_NTP) -AM_CXXFLAGS = $(GTEST_CXXFLAGS) +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 += $(GTEST_CPPFLAGS) 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) @@ -125,73 +110,9 @@ BUILT_SOURCES += \ $(srcdir)/run-kodDatabase.c \ $(srcdir)/run-kodFile.c \ $(srcdir)/run-networking.c \ + $(srcdir)/run-packetHandling.c \ $(srcdir)/run-packetProcessing.c \ $(srcdir)/run-utilities.c \ - $(srcdir)/run-packetHandling.c \ - $(NULL) - -test_keyFile_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_keyFile_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_kodDatabase_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_kodDatabase_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_kodFile_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_kodFile_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_networking_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_networking_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_utilities_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_utilities_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_crypto_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_crypto_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_packetProcessing_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_packetProcessing_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_packetHandling_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_packetHandling_LDADD = \ - $(unity_tests_LDADD) \ $(NULL) test_networking_SOURCES = \ @@ -213,34 +134,48 @@ test_kodDatabase_SOURCES = \ $(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) -# ../version.c 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 @@ -266,6 +201,10 @@ $(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list) $(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 @@ -301,10 +240,10 @@ check-libntp: ../../libntp/libntp.a ../../libntp/libntp.a: cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a -check-libunity: ../sntp/unity/libunity.a +check-libunity: ../unity/libunity.a @echo stamp > $@ -../sntp/unity/libunity.a: +../unity/libunity.a: cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a include $(top_srcdir)/depsver.mf diff --git a/contrib/ntp/sntp/tests/Makefile.in b/contrib/ntp/sntp/tests/Makefile.in index 8cc0ba5..9803fa8 100644 --- a/contrib/ntp/sntp/tests/Makefile.in +++ b/contrib/ntp/sntp/tests/Makefile.in @@ -88,15 +88,13 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -EXTRA_PROGRAMS = $(am__EXEEXT_1) +EXTRA_PROGRAMS = check_PROGRAMS = test-crypto$(EXEEXT) test-keyFile$(EXEEXT) \ test-kodDatabase$(EXEEXT) test-kodFile$(EXEEXT) \ - test-networking$(EXEEXT) test-packetHandling$(EXEEXT) \ - test-packetProcessing$(EXEEXT) test-utilities$(EXEEXT) \ - $(am__EXEEXT_2) $(am__EXEEXT_3) -@GTEST_AVAILABLE_TRUE@am__append_1 = tests -@GTEST_AVAILABLE_FALSE@am__append_2 = tests -@NTP_CROSSCOMPILE_FALSE@am__append_3 = $(check_PROGRAMS) + test-log$(EXEEXT) test-networking$(EXEEXT) \ + test-packetHandling$(EXEEXT) test-packetProcessing$(EXEEXT) \ + test-utilities$(EXEEXT) $(am__EXEEXT_1) +@NTP_CROSSCOMPILE_FALSE@am__append_1 = $(check_PROGRAMS) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/libopts/m4/libopts.m4 \ @@ -133,24 +131,21 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = fileHandlingTest.h CONFIG_CLEAN_VPATH_FILES = -@GTEST_AVAILABLE_FALSE@am__EXEEXT_1 = tests$(EXEEXT) -am__EXEEXT_2 = -@GTEST_AVAILABLE_TRUE@am__EXEEXT_3 = tests$(EXEEXT) +am__EXEEXT_1 = 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) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) \ +test_crypto_DEPENDENCIES = $(am__DEPENDENCIES_2) \ $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_crypto_DEPENDENCIES = $(am__DEPENDENCIES_3) $(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 @@ -158,85 +153,63 @@ 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 = test_keyFile-keyFile.$(OBJEXT) \ - test_keyFile-run-keyFile.$(OBJEXT) \ - test_keyFile-version.$(OBJEXT) $(am__objects_1) +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_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_keyFile_LDADD = $(LDADD) +test_keyFile_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_keyFile_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_keyFile_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_test_kodDatabase_OBJECTS = test_kodDatabase-kodDatabase.$(OBJEXT) \ - test_kodDatabase-run-kodDatabase.$(OBJEXT) \ - test_kodDatabase-version.$(OBJEXT) $(am__objects_1) +am_test_kodDatabase_OBJECTS = kodDatabase.$(OBJEXT) \ + run-kodDatabase.$(OBJEXT) version.$(OBJEXT) $(am__objects_1) test_kodDatabase_OBJECTS = $(am_test_kodDatabase_OBJECTS) -test_kodDatabase_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_kodDatabase_LDADD = $(LDADD) +test_kodDatabase_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_kodDatabase_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(test_kodDatabase_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -am_test_kodFile_OBJECTS = test_kodFile-kodFile.$(OBJEXT) \ - test_kodFile-run-kodFile.$(OBJEXT) \ - test_kodFile-version.$(OBJEXT) $(am__objects_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_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_kodFile_LDADD = $(LDADD) +test_kodFile_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_kodFile_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_kodFile_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_test_networking_OBJECTS = test_networking-networking.$(OBJEXT) \ - test_networking-run-networking.$(OBJEXT) \ - test_networking-version.$(OBJEXT) $(am__objects_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_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_networking_LDADD = $(LDADD) +test_networking_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_networking_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(test_networking_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ - -o $@ -am_test_packetHandling_OBJECTS = \ - test_packetHandling-packetHandling.$(OBJEXT) \ - test_packetHandling-run-packetHandling.$(OBJEXT) \ - test_packetHandling-version.$(OBJEXT) $(am__objects_1) +am_test_packetHandling_OBJECTS = packetHandling.$(OBJEXT) \ + run-packetHandling.$(OBJEXT) version.$(OBJEXT) \ + $(am__objects_1) test_packetHandling_OBJECTS = $(am_test_packetHandling_OBJECTS) -test_packetHandling_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_packetHandling_LDADD = $(LDADD) +test_packetHandling_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_packetHandling_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(test_packetHandling_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_test_packetProcessing_OBJECTS = \ - test_packetProcessing-packetProcessing.$(OBJEXT) \ - test_packetProcessing-run-packetProcessing.$(OBJEXT) \ +am_test_packetProcessing_OBJECTS = packetProcessing.$(OBJEXT) \ + run-packetProcessing.$(OBJEXT) sntptest.$(OBJEXT) \ $(am__objects_1) test_packetProcessing_OBJECTS = $(am_test_packetProcessing_OBJECTS) -test_packetProcessing_DEPENDENCIES = $(am__DEPENDENCIES_3) \ +test_packetProcessing_LDADD = $(LDADD) +test_packetProcessing_DEPENDENCIES = $(am__DEPENDENCIES_2) \ + $(top_builddir)/unity/libunity.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) -test_packetProcessing_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(test_packetProcessing_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_test_utilities_OBJECTS = test_utilities-utilities.$(OBJEXT) \ - test_utilities-run-utilities.$(OBJEXT) $(am__objects_1) +am_test_utilities_OBJECTS = fileHandlingTest.$(OBJEXT) \ + utilities.$(OBJEXT) run-utilities.$(OBJEXT) $(am__objects_1) test_utilities_OBJECTS = $(am_test_utilities_OBJECTS) -test_utilities_DEPENDENCIES = $(am__DEPENDENCIES_3) \ - $(am__DEPENDENCIES_1) -test_utilities_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(test_utilities_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ - $@ -am__objects_2 = tests_main.$(OBJEXT) $(am__objects_1) -am_tests_OBJECTS = $(am__objects_2) g_networking.$(OBJEXT) \ - g_packetHandling.$(OBJEXT) g_packetProcessing.$(OBJEXT) \ - $(am__objects_1) -tests_OBJECTS = $(am_tests_OBJECTS) -tests_LDADD = $(LDADD) -tests_DEPENDENCIES = ../libsntp.a $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(top_builddir)/../libntp/libntp.a \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ +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@) @@ -272,34 +245,16 @@ 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 = -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = SOURCES = $(test_crypto_SOURCES) $(test_keyFile_SOURCES) \ $(test_kodDatabase_SOURCES) $(test_kodFile_SOURCES) \ - $(test_networking_SOURCES) $(test_packetHandling_SOURCES) \ - $(test_packetProcessing_SOURCES) $(test_utilities_SOURCES) \ - $(tests_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_networking_SOURCES) $(test_packetHandling_SOURCES) \ - $(test_packetProcessing_SOURCES) $(test_utilities_SOURCES) \ - $(tests_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;; \ @@ -545,6 +500,7 @@ 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@ @@ -553,6 +509,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -606,6 +563,7 @@ 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@ @@ -774,49 +732,31 @@ NULL = #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-packetProcessing.c \ - $(srcdir)/run-utilities.c $(srcdir)/run-packetHandling.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 = kod-output-blank kod-output-single kod-output-multiple \ - debug-output-lfp-dec debug-output-lfp-bin debug-output-pkt \ +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 -run_unity = cd $(srcdir) && ruby ../../sntp/unity/auto/generate_test_runner.rb - -#if BUILD_SNTP -#check_PROGRAMS += tests -#endif -base_SOURCES = \ - ../tests_main.cpp \ +DISTCLEANFILES = \ + kod-output-blank \ + kod-output-single \ + kod-output-multiple \ + testLogfile.log \ + testLogfile2.log \ $(NULL) -tests_SOURCES = \ - $(base_SOURCES) \ - g_networking.cpp \ - g_packetHandling.cpp \ - g_packetProcessing.cpp \ +std_unity_list = \ + $(srcdir)/../unity/auto/generate_test_runner.rb \ $(NULL) - -# HMS: this test was for the 4.2.6 sntp code. -# g_nameresolution.cpp - -# HMS: Somebody needs to audit the following files to -# make sure all of these tests are now handled by Unity -# -# g_utilities.cpp -# g_kodDatabase.cpp -# g_keyFile.cpp -# g_crypto.cpp -# g_kodFile.cpp +run_unity = cd $(srcdir) && ruby ../unity/auto/generate_test_runner.rb noinst_HEADERS = \ - fileHandlingTest.h \ sntptest.h \ - g_fileHandlingTest.h \ - g_sntptest.h \ $(NULL) dist_check_SCRIPTS = tests-runner @@ -838,93 +778,27 @@ EXTRA_DIST = \ #split into LDADD and tests_LDADD? -LDADD = \ +base_LDADD = \ ../libsntp.a \ $(LIBOPTS_LDADD) \ $(LDADD_LIBEVENT) \ $(top_builddir)/../libntp/libntp.a \ $(LDADD_LIBNTP) \ $(LDADD_NTP) \ - $(GTEST_LDFLAGS) \ - $(GTEST_LIBS) \ $(NULL) -unity_tests_LDADD = \ - $(LDADD) \ +LDADD = \ + $(base_LDADD) \ $(top_builddir)/unity/libunity.a \ $(LIBM) \ $(NULL) AM_CFLAGS = $(CFLAGS_NTP) -AM_CXXFLAGS = $(GTEST_CXXFLAGS) +#AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity AM_CPPFLAGS = $(SNTP_INCS) -I$(srcdir)/.. -I$(top_srcdir)/../tests \ - $(LIBOPTS_CFLAGS) $(CPPFLAGS_LIBEVENT) $(GTEST_CPPFLAGS) \ - $(CPPFLAGS_NTP) + $(LIBOPTS_CFLAGS) $(CPPFLAGS_LIBEVENT) $(CPPFLAGS_NTP) \ + -DUNITY_INCLUDE_CONFIG_H -I$(top_srcdir)/unity AM_LDFLAGS = $(LDFLAGS_NTP) -test_keyFile_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_keyFile_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_kodDatabase_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_kodDatabase_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_kodFile_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_kodFile_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_networking_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_networking_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_utilities_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_utilities_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_crypto_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_crypto_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_packetProcessing_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_packetProcessing_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - -test_packetHandling_CFLAGS = \ - -I$(top_srcdir)/unity \ - $(NULL) - -test_packetHandling_LDADD = \ - $(unity_tests_LDADD) \ - $(NULL) - test_networking_SOURCES = \ networking.c \ run-networking.c \ @@ -944,38 +818,52 @@ test_kodDatabase_SOURCES = \ $(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) -# ../version.c 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) +TESTS = $(am__append_1) SNTP_INCS = -I$(top_srcdir)/../include \ -I$(top_srcdir)/../lib/isc/include \ -I$(top_srcdir)/../lib/isc/$(LIBISC_PTHREADS_NOTHREADS)/include \ @@ -984,7 +872,7 @@ all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs +.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 \ @@ -1033,35 +921,35 @@ test-crypto$(EXEEXT): $(test_crypto_OBJECTS) $(test_crypto_DEPENDENCIES) $(EXTRA test-keyFile$(EXEEXT): $(test_keyFile_OBJECTS) $(test_keyFile_DEPENDENCIES) $(EXTRA_test_keyFile_DEPENDENCIES) @rm -f test-keyFile$(EXEEXT) - $(AM_V_CCLD)$(test_keyFile_LINK) $(test_keyFile_OBJECTS) $(test_keyFile_LDADD) $(LIBS) + $(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)$(test_kodDatabase_LINK) $(test_kodDatabase_OBJECTS) $(test_kodDatabase_LDADD) $(LIBS) + $(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)$(test_kodFile_LINK) $(test_kodFile_OBJECTS) $(test_kodFile_LDADD) $(LIBS) + $(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)$(test_networking_LINK) $(test_networking_OBJECTS) $(test_networking_LDADD) $(LIBS) + $(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)$(test_packetHandling_LINK) $(test_packetHandling_OBJECTS) $(test_packetHandling_LDADD) $(LIBS) + $(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)$(test_packetProcessing_LINK) $(test_packetProcessing_OBJECTS) $(test_packetProcessing_LDADD) $(LIBS) + $(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)$(test_utilities_LINK) $(test_utilities_OBJECTS) $(test_utilities_LDADD) $(LIBS) - -tests$(EXEEXT): $(tests_OBJECTS) $(tests_DEPENDENCIES) $(EXTRA_tests_DEPENDENCIES) - @rm -f tests$(EXEEXT) - $(AM_V_CXXLD)$(CXXLINK) $(tests_OBJECTS) $(tests_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(test_utilities_OBJECTS) $(test_utilities_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -1069,32 +957,28 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_networking.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_packetHandling.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/g_packetProcessing.Po@am__quote@ +@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)/test_keyFile-keyFile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyFile-run-keyFile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_keyFile-version.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodDatabase-kodDatabase.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodDatabase-run-kodDatabase.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodDatabase-version.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodFile-kodFile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodFile-run-kodFile.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_kodFile-version.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_networking-networking.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_networking-run-networking.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_networking-version.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packetHandling-packetHandling.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packetHandling-run-packetHandling.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packetHandling-version.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packetProcessing-packetProcessing.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_packetProcessing-run-packetProcessing.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utilities-run-utilities.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_utilities-utilities.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tests_main.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 $@ $< @@ -1159,306 +1043,19 @@ test_crypto-version.obj: $(top_builddir)/version.c @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` -test_keyFile-keyFile.o: keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-keyFile.o -MD -MP -MF $(DEPDIR)/test_keyFile-keyFile.Tpo -c -o test_keyFile-keyFile.o `test -f 'keyFile.c' || echo '$(srcdir)/'`keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyFile-keyFile.Tpo $(DEPDIR)/test_keyFile-keyFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='keyFile.c' object='test_keyFile-keyFile.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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-keyFile.o `test -f 'keyFile.c' || echo '$(srcdir)/'`keyFile.c - -test_keyFile-keyFile.obj: keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-keyFile.obj -MD -MP -MF $(DEPDIR)/test_keyFile-keyFile.Tpo -c -o test_keyFile-keyFile.obj `if test -f 'keyFile.c'; then $(CYGPATH_W) 'keyFile.c'; else $(CYGPATH_W) '$(srcdir)/keyFile.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyFile-keyFile.Tpo $(DEPDIR)/test_keyFile-keyFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='keyFile.c' object='test_keyFile-keyFile.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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-keyFile.obj `if test -f 'keyFile.c'; then $(CYGPATH_W) 'keyFile.c'; else $(CYGPATH_W) '$(srcdir)/keyFile.c'; fi` - -test_keyFile-run-keyFile.o: run-keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-run-keyFile.o -MD -MP -MF $(DEPDIR)/test_keyFile-run-keyFile.Tpo -c -o test_keyFile-run-keyFile.o `test -f 'run-keyFile.c' || echo '$(srcdir)/'`run-keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyFile-run-keyFile.Tpo $(DEPDIR)/test_keyFile-run-keyFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-keyFile.c' object='test_keyFile-run-keyFile.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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-run-keyFile.o `test -f 'run-keyFile.c' || echo '$(srcdir)/'`run-keyFile.c - -test_keyFile-run-keyFile.obj: run-keyFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-run-keyFile.obj -MD -MP -MF $(DEPDIR)/test_keyFile-run-keyFile.Tpo -c -o test_keyFile-run-keyFile.obj `if test -f 'run-keyFile.c'; then $(CYGPATH_W) 'run-keyFile.c'; else $(CYGPATH_W) '$(srcdir)/run-keyFile.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyFile-run-keyFile.Tpo $(DEPDIR)/test_keyFile-run-keyFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-keyFile.c' object='test_keyFile-run-keyFile.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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-run-keyFile.obj `if test -f 'run-keyFile.c'; then $(CYGPATH_W) 'run-keyFile.c'; else $(CYGPATH_W) '$(srcdir)/run-keyFile.c'; fi` - -test_keyFile-version.o: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-version.o -MD -MP -MF $(DEPDIR)/test_keyFile-version.Tpo -c -o test_keyFile-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_keyFile-version.Tpo $(DEPDIR)/test_keyFile-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_keyFile-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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c - -test_keyFile-version.obj: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_keyFile_CFLAGS) $(CFLAGS) -MT test_keyFile-version.obj -MD -MP -MF $(DEPDIR)/test_keyFile-version.Tpo -c -o test_keyFile-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_keyFile-version.Tpo $(DEPDIR)/test_keyFile-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_keyFile-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_keyFile_CFLAGS) $(CFLAGS) -c -o test_keyFile-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` - -test_kodDatabase-kodDatabase.o: kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-kodDatabase.o -MD -MP -MF $(DEPDIR)/test_kodDatabase-kodDatabase.Tpo -c -o test_kodDatabase-kodDatabase.o `test -f 'kodDatabase.c' || echo '$(srcdir)/'`kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodDatabase-kodDatabase.Tpo $(DEPDIR)/test_kodDatabase-kodDatabase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kodDatabase.c' object='test_kodDatabase-kodDatabase.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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-kodDatabase.o `test -f 'kodDatabase.c' || echo '$(srcdir)/'`kodDatabase.c - -test_kodDatabase-kodDatabase.obj: kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-kodDatabase.obj -MD -MP -MF $(DEPDIR)/test_kodDatabase-kodDatabase.Tpo -c -o test_kodDatabase-kodDatabase.obj `if test -f 'kodDatabase.c'; then $(CYGPATH_W) 'kodDatabase.c'; else $(CYGPATH_W) '$(srcdir)/kodDatabase.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodDatabase-kodDatabase.Tpo $(DEPDIR)/test_kodDatabase-kodDatabase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kodDatabase.c' object='test_kodDatabase-kodDatabase.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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-kodDatabase.obj `if test -f 'kodDatabase.c'; then $(CYGPATH_W) 'kodDatabase.c'; else $(CYGPATH_W) '$(srcdir)/kodDatabase.c'; fi` - -test_kodDatabase-run-kodDatabase.o: run-kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-run-kodDatabase.o -MD -MP -MF $(DEPDIR)/test_kodDatabase-run-kodDatabase.Tpo -c -o test_kodDatabase-run-kodDatabase.o `test -f 'run-kodDatabase.c' || echo '$(srcdir)/'`run-kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodDatabase-run-kodDatabase.Tpo $(DEPDIR)/test_kodDatabase-run-kodDatabase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-kodDatabase.c' object='test_kodDatabase-run-kodDatabase.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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-run-kodDatabase.o `test -f 'run-kodDatabase.c' || echo '$(srcdir)/'`run-kodDatabase.c - -test_kodDatabase-run-kodDatabase.obj: run-kodDatabase.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-run-kodDatabase.obj -MD -MP -MF $(DEPDIR)/test_kodDatabase-run-kodDatabase.Tpo -c -o test_kodDatabase-run-kodDatabase.obj `if test -f 'run-kodDatabase.c'; then $(CYGPATH_W) 'run-kodDatabase.c'; else $(CYGPATH_W) '$(srcdir)/run-kodDatabase.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodDatabase-run-kodDatabase.Tpo $(DEPDIR)/test_kodDatabase-run-kodDatabase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-kodDatabase.c' object='test_kodDatabase-run-kodDatabase.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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-run-kodDatabase.obj `if test -f 'run-kodDatabase.c'; then $(CYGPATH_W) 'run-kodDatabase.c'; else $(CYGPATH_W) '$(srcdir)/run-kodDatabase.c'; fi` - -test_kodDatabase-version.o: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-version.o -MD -MP -MF $(DEPDIR)/test_kodDatabase-version.Tpo -c -o test_kodDatabase-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodDatabase-version.Tpo $(DEPDIR)/test_kodDatabase-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_kodDatabase-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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c - -test_kodDatabase-version.obj: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodDatabase_CFLAGS) $(CFLAGS) -MT test_kodDatabase-version.obj -MD -MP -MF $(DEPDIR)/test_kodDatabase-version.Tpo -c -o test_kodDatabase-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_kodDatabase-version.Tpo $(DEPDIR)/test_kodDatabase-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_kodDatabase-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_kodDatabase_CFLAGS) $(CFLAGS) -c -o test_kodDatabase-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` - -test_kodFile-kodFile.o: kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-kodFile.o -MD -MP -MF $(DEPDIR)/test_kodFile-kodFile.Tpo -c -o test_kodFile-kodFile.o `test -f 'kodFile.c' || echo '$(srcdir)/'`kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodFile-kodFile.Tpo $(DEPDIR)/test_kodFile-kodFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kodFile.c' object='test_kodFile-kodFile.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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-kodFile.o `test -f 'kodFile.c' || echo '$(srcdir)/'`kodFile.c - -test_kodFile-kodFile.obj: kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-kodFile.obj -MD -MP -MF $(DEPDIR)/test_kodFile-kodFile.Tpo -c -o test_kodFile-kodFile.obj `if test -f 'kodFile.c'; then $(CYGPATH_W) 'kodFile.c'; else $(CYGPATH_W) '$(srcdir)/kodFile.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodFile-kodFile.Tpo $(DEPDIR)/test_kodFile-kodFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='kodFile.c' object='test_kodFile-kodFile.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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-kodFile.obj `if test -f 'kodFile.c'; then $(CYGPATH_W) 'kodFile.c'; else $(CYGPATH_W) '$(srcdir)/kodFile.c'; fi` - -test_kodFile-run-kodFile.o: run-kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-run-kodFile.o -MD -MP -MF $(DEPDIR)/test_kodFile-run-kodFile.Tpo -c -o test_kodFile-run-kodFile.o `test -f 'run-kodFile.c' || echo '$(srcdir)/'`run-kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodFile-run-kodFile.Tpo $(DEPDIR)/test_kodFile-run-kodFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-kodFile.c' object='test_kodFile-run-kodFile.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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-run-kodFile.o `test -f 'run-kodFile.c' || echo '$(srcdir)/'`run-kodFile.c - -test_kodFile-run-kodFile.obj: run-kodFile.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-run-kodFile.obj -MD -MP -MF $(DEPDIR)/test_kodFile-run-kodFile.Tpo -c -o test_kodFile-run-kodFile.obj `if test -f 'run-kodFile.c'; then $(CYGPATH_W) 'run-kodFile.c'; else $(CYGPATH_W) '$(srcdir)/run-kodFile.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodFile-run-kodFile.Tpo $(DEPDIR)/test_kodFile-run-kodFile.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-kodFile.c' object='test_kodFile-run-kodFile.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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-run-kodFile.obj `if test -f 'run-kodFile.c'; then $(CYGPATH_W) 'run-kodFile.c'; else $(CYGPATH_W) '$(srcdir)/run-kodFile.c'; fi` - -test_kodFile-version.o: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-version.o -MD -MP -MF $(DEPDIR)/test_kodFile-version.Tpo -c -o test_kodFile-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_kodFile-version.Tpo $(DEPDIR)/test_kodFile-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_kodFile-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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c - -test_kodFile-version.obj: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_kodFile_CFLAGS) $(CFLAGS) -MT test_kodFile-version.obj -MD -MP -MF $(DEPDIR)/test_kodFile-version.Tpo -c -o test_kodFile-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_kodFile-version.Tpo $(DEPDIR)/test_kodFile-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_kodFile-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_kodFile_CFLAGS) $(CFLAGS) -c -o test_kodFile-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` - -test_networking-networking.o: networking.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-networking.o -MD -MP -MF $(DEPDIR)/test_networking-networking.Tpo -c -o test_networking-networking.o `test -f 'networking.c' || echo '$(srcdir)/'`networking.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_networking-networking.Tpo $(DEPDIR)/test_networking-networking.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='networking.c' object='test_networking-networking.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_networking_CFLAGS) $(CFLAGS) -c -o test_networking-networking.o `test -f 'networking.c' || echo '$(srcdir)/'`networking.c - -test_networking-networking.obj: networking.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-networking.obj -MD -MP -MF $(DEPDIR)/test_networking-networking.Tpo -c -o test_networking-networking.obj `if test -f 'networking.c'; then $(CYGPATH_W) 'networking.c'; else $(CYGPATH_W) '$(srcdir)/networking.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_networking-networking.Tpo $(DEPDIR)/test_networking-networking.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='networking.c' object='test_networking-networking.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_networking_CFLAGS) $(CFLAGS) -c -o test_networking-networking.obj `if test -f 'networking.c'; then $(CYGPATH_W) 'networking.c'; else $(CYGPATH_W) '$(srcdir)/networking.c'; fi` - -test_networking-run-networking.o: run-networking.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-run-networking.o -MD -MP -MF $(DEPDIR)/test_networking-run-networking.Tpo -c -o test_networking-run-networking.o `test -f 'run-networking.c' || echo '$(srcdir)/'`run-networking.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_networking-run-networking.Tpo $(DEPDIR)/test_networking-run-networking.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-networking.c' object='test_networking-run-networking.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_networking_CFLAGS) $(CFLAGS) -c -o test_networking-run-networking.o `test -f 'run-networking.c' || echo '$(srcdir)/'`run-networking.c - -test_networking-run-networking.obj: run-networking.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-run-networking.obj -MD -MP -MF $(DEPDIR)/test_networking-run-networking.Tpo -c -o test_networking-run-networking.obj `if test -f 'run-networking.c'; then $(CYGPATH_W) 'run-networking.c'; else $(CYGPATH_W) '$(srcdir)/run-networking.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_networking-run-networking.Tpo $(DEPDIR)/test_networking-run-networking.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-networking.c' object='test_networking-run-networking.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_networking_CFLAGS) $(CFLAGS) -c -o test_networking-run-networking.obj `if test -f 'run-networking.c'; then $(CYGPATH_W) 'run-networking.c'; else $(CYGPATH_W) '$(srcdir)/run-networking.c'; fi` - -test_networking-version.o: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-version.o -MD -MP -MF $(DEPDIR)/test_networking-version.Tpo -c -o test_networking-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_networking-version.Tpo $(DEPDIR)/test_networking-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_networking-version.o' libtool=no @AMDEPBACKSLASH@ +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) $(test_networking_CFLAGS) $(CFLAGS) -c -o test_networking-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c +@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 -test_networking-version.obj: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_networking_CFLAGS) $(CFLAGS) -MT test_networking-version.obj -MD -MP -MF $(DEPDIR)/test_networking-version.Tpo -c -o test_networking-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_networking-version.Tpo $(DEPDIR)/test_networking-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_networking-version.obj' libtool=no @AMDEPBACKSLASH@ +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) $(test_networking_CFLAGS) $(CFLAGS) -c -o test_networking-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` - -test_packetHandling-packetHandling.o: packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-packetHandling.o -MD -MP -MF $(DEPDIR)/test_packetHandling-packetHandling.Tpo -c -o test_packetHandling-packetHandling.o `test -f 'packetHandling.c' || echo '$(srcdir)/'`packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetHandling-packetHandling.Tpo $(DEPDIR)/test_packetHandling-packetHandling.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packetHandling.c' object='test_packetHandling-packetHandling.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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-packetHandling.o `test -f 'packetHandling.c' || echo '$(srcdir)/'`packetHandling.c - -test_packetHandling-packetHandling.obj: packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-packetHandling.obj -MD -MP -MF $(DEPDIR)/test_packetHandling-packetHandling.Tpo -c -o test_packetHandling-packetHandling.obj `if test -f 'packetHandling.c'; then $(CYGPATH_W) 'packetHandling.c'; else $(CYGPATH_W) '$(srcdir)/packetHandling.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetHandling-packetHandling.Tpo $(DEPDIR)/test_packetHandling-packetHandling.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packetHandling.c' object='test_packetHandling-packetHandling.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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-packetHandling.obj `if test -f 'packetHandling.c'; then $(CYGPATH_W) 'packetHandling.c'; else $(CYGPATH_W) '$(srcdir)/packetHandling.c'; fi` - -test_packetHandling-run-packetHandling.o: run-packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-run-packetHandling.o -MD -MP -MF $(DEPDIR)/test_packetHandling-run-packetHandling.Tpo -c -o test_packetHandling-run-packetHandling.o `test -f 'run-packetHandling.c' || echo '$(srcdir)/'`run-packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetHandling-run-packetHandling.Tpo $(DEPDIR)/test_packetHandling-run-packetHandling.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-packetHandling.c' object='test_packetHandling-run-packetHandling.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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-run-packetHandling.o `test -f 'run-packetHandling.c' || echo '$(srcdir)/'`run-packetHandling.c - -test_packetHandling-run-packetHandling.obj: run-packetHandling.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-run-packetHandling.obj -MD -MP -MF $(DEPDIR)/test_packetHandling-run-packetHandling.Tpo -c -o test_packetHandling-run-packetHandling.obj `if test -f 'run-packetHandling.c'; then $(CYGPATH_W) 'run-packetHandling.c'; else $(CYGPATH_W) '$(srcdir)/run-packetHandling.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetHandling-run-packetHandling.Tpo $(DEPDIR)/test_packetHandling-run-packetHandling.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-packetHandling.c' object='test_packetHandling-run-packetHandling.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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-run-packetHandling.obj `if test -f 'run-packetHandling.c'; then $(CYGPATH_W) 'run-packetHandling.c'; else $(CYGPATH_W) '$(srcdir)/run-packetHandling.c'; fi` - -test_packetHandling-version.o: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-version.o -MD -MP -MF $(DEPDIR)/test_packetHandling-version.Tpo -c -o test_packetHandling-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetHandling-version.Tpo $(DEPDIR)/test_packetHandling-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_packetHandling-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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-version.o `test -f '$(top_builddir)/version.c' || echo '$(srcdir)/'`$(top_builddir)/version.c - -test_packetHandling-version.obj: $(top_builddir)/version.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetHandling_CFLAGS) $(CFLAGS) -MT test_packetHandling-version.obj -MD -MP -MF $(DEPDIR)/test_packetHandling-version.Tpo -c -o test_packetHandling-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_packetHandling-version.Tpo $(DEPDIR)/test_packetHandling-version.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/version.c' object='test_packetHandling-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_packetHandling_CFLAGS) $(CFLAGS) -c -o test_packetHandling-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` - -test_packetProcessing-packetProcessing.o: packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetProcessing_CFLAGS) $(CFLAGS) -MT test_packetProcessing-packetProcessing.o -MD -MP -MF $(DEPDIR)/test_packetProcessing-packetProcessing.Tpo -c -o test_packetProcessing-packetProcessing.o `test -f 'packetProcessing.c' || echo '$(srcdir)/'`packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetProcessing-packetProcessing.Tpo $(DEPDIR)/test_packetProcessing-packetProcessing.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packetProcessing.c' object='test_packetProcessing-packetProcessing.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_packetProcessing_CFLAGS) $(CFLAGS) -c -o test_packetProcessing-packetProcessing.o `test -f 'packetProcessing.c' || echo '$(srcdir)/'`packetProcessing.c - -test_packetProcessing-packetProcessing.obj: packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetProcessing_CFLAGS) $(CFLAGS) -MT test_packetProcessing-packetProcessing.obj -MD -MP -MF $(DEPDIR)/test_packetProcessing-packetProcessing.Tpo -c -o test_packetProcessing-packetProcessing.obj `if test -f 'packetProcessing.c'; then $(CYGPATH_W) 'packetProcessing.c'; else $(CYGPATH_W) '$(srcdir)/packetProcessing.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetProcessing-packetProcessing.Tpo $(DEPDIR)/test_packetProcessing-packetProcessing.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='packetProcessing.c' object='test_packetProcessing-packetProcessing.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_packetProcessing_CFLAGS) $(CFLAGS) -c -o test_packetProcessing-packetProcessing.obj `if test -f 'packetProcessing.c'; then $(CYGPATH_W) 'packetProcessing.c'; else $(CYGPATH_W) '$(srcdir)/packetProcessing.c'; fi` - -test_packetProcessing-run-packetProcessing.o: run-packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetProcessing_CFLAGS) $(CFLAGS) -MT test_packetProcessing-run-packetProcessing.o -MD -MP -MF $(DEPDIR)/test_packetProcessing-run-packetProcessing.Tpo -c -o test_packetProcessing-run-packetProcessing.o `test -f 'run-packetProcessing.c' || echo '$(srcdir)/'`run-packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetProcessing-run-packetProcessing.Tpo $(DEPDIR)/test_packetProcessing-run-packetProcessing.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-packetProcessing.c' object='test_packetProcessing-run-packetProcessing.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_packetProcessing_CFLAGS) $(CFLAGS) -c -o test_packetProcessing-run-packetProcessing.o `test -f 'run-packetProcessing.c' || echo '$(srcdir)/'`run-packetProcessing.c - -test_packetProcessing-run-packetProcessing.obj: run-packetProcessing.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_packetProcessing_CFLAGS) $(CFLAGS) -MT test_packetProcessing-run-packetProcessing.obj -MD -MP -MF $(DEPDIR)/test_packetProcessing-run-packetProcessing.Tpo -c -o test_packetProcessing-run-packetProcessing.obj `if test -f 'run-packetProcessing.c'; then $(CYGPATH_W) 'run-packetProcessing.c'; else $(CYGPATH_W) '$(srcdir)/run-packetProcessing.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_packetProcessing-run-packetProcessing.Tpo $(DEPDIR)/test_packetProcessing-run-packetProcessing.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-packetProcessing.c' object='test_packetProcessing-run-packetProcessing.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_packetProcessing_CFLAGS) $(CFLAGS) -c -o test_packetProcessing-run-packetProcessing.obj `if test -f 'run-packetProcessing.c'; then $(CYGPATH_W) 'run-packetProcessing.c'; else $(CYGPATH_W) '$(srcdir)/run-packetProcessing.c'; fi` - -test_utilities-utilities.o: utilities.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_utilities_CFLAGS) $(CFLAGS) -MT test_utilities-utilities.o -MD -MP -MF $(DEPDIR)/test_utilities-utilities.Tpo -c -o test_utilities-utilities.o `test -f 'utilities.c' || echo '$(srcdir)/'`utilities.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utilities-utilities.Tpo $(DEPDIR)/test_utilities-utilities.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utilities.c' object='test_utilities-utilities.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_utilities_CFLAGS) $(CFLAGS) -c -o test_utilities-utilities.o `test -f 'utilities.c' || echo '$(srcdir)/'`utilities.c - -test_utilities-utilities.obj: utilities.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_utilities_CFLAGS) $(CFLAGS) -MT test_utilities-utilities.obj -MD -MP -MF $(DEPDIR)/test_utilities-utilities.Tpo -c -o test_utilities-utilities.obj `if test -f 'utilities.c'; then $(CYGPATH_W) 'utilities.c'; else $(CYGPATH_W) '$(srcdir)/utilities.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utilities-utilities.Tpo $(DEPDIR)/test_utilities-utilities.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='utilities.c' object='test_utilities-utilities.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_utilities_CFLAGS) $(CFLAGS) -c -o test_utilities-utilities.obj `if test -f 'utilities.c'; then $(CYGPATH_W) 'utilities.c'; else $(CYGPATH_W) '$(srcdir)/utilities.c'; fi` - -test_utilities-run-utilities.o: run-utilities.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_utilities_CFLAGS) $(CFLAGS) -MT test_utilities-run-utilities.o -MD -MP -MF $(DEPDIR)/test_utilities-run-utilities.Tpo -c -o test_utilities-run-utilities.o `test -f 'run-utilities.c' || echo '$(srcdir)/'`run-utilities.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utilities-run-utilities.Tpo $(DEPDIR)/test_utilities-run-utilities.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-utilities.c' object='test_utilities-run-utilities.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_utilities_CFLAGS) $(CFLAGS) -c -o test_utilities-run-utilities.o `test -f 'run-utilities.c' || echo '$(srcdir)/'`run-utilities.c - -test_utilities-run-utilities.obj: run-utilities.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_utilities_CFLAGS) $(CFLAGS) -MT test_utilities-run-utilities.obj -MD -MP -MF $(DEPDIR)/test_utilities-run-utilities.Tpo -c -o test_utilities-run-utilities.obj `if test -f 'run-utilities.c'; then $(CYGPATH_W) 'run-utilities.c'; else $(CYGPATH_W) '$(srcdir)/run-utilities.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_utilities-run-utilities.Tpo $(DEPDIR)/test_utilities-run-utilities.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='run-utilities.c' object='test_utilities-run-utilities.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_utilities_CFLAGS) $(CFLAGS) -c -o test_utilities-run-utilities.obj `if test -f 'run-utilities.c'; then $(CYGPATH_W) 'run-utilities.c'; else $(CYGPATH_W) '$(srcdir)/run-utilities.c'; fi` - -.cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< - -.cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -tests_main.o: ../tests_main.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT tests_main.o -MD -MP -MF $(DEPDIR)/tests_main.Tpo -c -o tests_main.o `test -f '../tests_main.cpp' || echo '$(srcdir)/'`../tests_main.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tests_main.Tpo $(DEPDIR)/tests_main.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../tests_main.cpp' object='tests_main.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o tests_main.o `test -f '../tests_main.cpp' || echo '$(srcdir)/'`../tests_main.cpp - -tests_main.obj: ../tests_main.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT tests_main.obj -MD -MP -MF $(DEPDIR)/tests_main.Tpo -c -o tests_main.obj `if test -f '../tests_main.cpp'; then $(CYGPATH_W) '../tests_main.cpp'; else $(CYGPATH_W) '$(srcdir)/../tests_main.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/tests_main.Tpo $(DEPDIR)/tests_main.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='../tests_main.cpp' object='tests_main.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o tests_main.obj `if test -f '../tests_main.cpp'; then $(CYGPATH_W) '../tests_main.cpp'; else $(CYGPATH_W) '$(srcdir)/../tests_main.cpp'; fi` +@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 @@ -1687,6 +1284,13 @@ test-kodFile.log: test-kodFile$(EXEEXT) --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'; \ @@ -1715,13 +1319,6 @@ test-utilities.log: test-utilities$(EXEEXT) --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) -tests.log: tests$(EXEEXT) - @p='tests$(EXEEXT)'; \ - b='tests'; \ - $(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); \ @@ -1926,6 +1523,9 @@ $(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list) $(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 > $@ @@ -1938,10 +1538,10 @@ check-libntp: ../../libntp/libntp.a ../../libntp/libntp.a: cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a -check-libunity: ../sntp/unity/libunity.a +check-libunity: ../unity/libunity.a @echo stamp > $@ -../sntp/unity/libunity.a: +../unity/libunity.a: cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a $(DEPDIR)/deps-ver: $(top_srcdir)/deps-ver @[ -f $@ ] || \ diff --git a/contrib/ntp/sntp/tests/crypto.c b/contrib/ntp/sntp/tests/crypto.c index 254469e..82d2859 100644 --- a/contrib/ntp/sntp/tests/crypto.c +++ b/contrib/ntp/sntp/tests/crypto.c @@ -8,7 +8,17 @@ #define MD5_LENGTH 16 #define SHA1_LENGTH 20 -void test_MakeMd5Mac(void) { + +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); @@ -30,7 +40,8 @@ void test_MakeMd5Mac(void) { } -void test_MakeSHA1Mac(void) { +void +test_MakeSHA1Mac(void) { #ifdef OPENSSL const char* PKT_DATA = "abcdefgh0123"; const int PKT_LEN = strlen(PKT_DATA); @@ -49,14 +60,15 @@ void test_MakeSHA1Mac(void) { TEST_ASSERT_EQUAL(SHA1_LENGTH, make_mac((char*)PKT_DATA, PKT_LEN, SHA1_LENGTH, &sha1, actual)); - TEST_ASSERT_TRUE(memcmp(EXPECTED_DIGEST, actual, SHA1_LENGTH) == 0); + TEST_ASSERT_EQUAL_MEMORY(EXPECTED_DIGEST, actual, SHA1_LENGTH); #else TEST_IGNORE_MESSAGE("OpenSSL not found, skipping..."); #endif /* OPENSSL */ } -void test_VerifyCorrectMD5(void) { +void +test_VerifyCorrectMD5(void) { const char* PKT_DATA = "sometestdata" // Data "\0\0\0\0" // Key-ID (unused) @@ -75,7 +87,8 @@ void test_VerifyCorrectMD5(void) { } -void test_VerifySHA1(void) { +void +test_VerifySHA1(void) { #ifdef OPENSSL const char* PKT_DATA = "sometestdata" // Data @@ -97,7 +110,8 @@ void test_VerifySHA1(void) { #endif /* OPENSSL */ } -void test_VerifyFailure(void) { +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 = @@ -117,7 +131,9 @@ void test_VerifyFailure(void) { TEST_ASSERT_FALSE(auth_md5((char*)PKT_DATA, PKT_LEN, MD5_LENGTH, &md5)); } -void test_PacketSizeNotMultipleOfFourBytes(void) { + +void +test_PacketSizeNotMultipleOfFourBytes(void) { const char* PKT_DATA = "123456"; const int PKT_LEN = 6; char actual[MD5_LENGTH]; @@ -131,4 +147,3 @@ void test_PacketSizeNotMultipleOfFourBytes(void) { TEST_ASSERT_EQUAL(0, make_mac((char*)PKT_DATA, PKT_LEN, MD5_LENGTH, &md5, actual)); } - diff --git a/contrib/ntp/sntp/tests/fileHandlingTest.c b/contrib/ntp/sntp/tests/fileHandlingTest.c new file mode 100644 index 0000000..ce3f0de --- /dev/null +++ b/contrib/ntp/sntp/tests/fileHandlingTest.c @@ -0,0 +1,74 @@ + +#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> + +/* +enum DirectoryType { + INPUT_DIR = 0, + OUTPUT_DIR = 1 +}; +*/ +//extern const char srcdir[]; + +const char * +CreatePath(const char* filename, enum DirectoryType argument) { + const char srcdir[] = SRCDIR_DEF;//"@abs_srcdir@/data/"; + char * path = emalloc (sizeof (char) * (strlen(srcdir) + 256)); + + //char cwd[1024]; + + strcpy(path, srcdir); + strcat(path, filename); + + return path; +} + + +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 b/contrib/ntp/sntp/tests/fileHandlingTest.h deleted file mode 100644 index 38c3fa6..0000000 --- a/contrib/ntp/sntp/tests/fileHandlingTest.h +++ /dev/null @@ -1,100 +0,0 @@ -#ifndef FILE_HANDLING_TEST_H -#define FILE_HANDLING_TEST_H - -#include "stdlib.h" -#include "sntptest.h" - -#include <string.h> -#include <unistd.h> - - -enum DirectoryType { - INPUT_DIR = 0, - OUTPUT_DIR = 1 -}; - -const char * CreatePath(const char* filename, enum DirectoryType argument) { - - char * path = malloc (sizeof (char) * 256); - - /* - if (m_params.size() >= argument + 1) { - path = m_params[argument]; - } - - if (path[path.size()-1] != DIR_SEP && !path.empty()) { - path.append(1, DIR_SEP); - } - */ - //strcpy(path,filename); - //path.append(filename); - - //return path; - - char cwd[1024]; - if (getcwd(cwd, sizeof(cwd)) != NULL) - printf("Current working dir: %s\n", cwd); - - printf("builddir is <.>\n"); - printf("abs_srcdir is </deacon/backroom/snaps/ntp-stable/sntp/tests>\n"); - strcpy(path,"/deacon/backroom/snaps/ntp-stable/sntp/tests/data/"); - - //strcpy(path,""); - strcat(path,filename); - printf("PATH IS : %s\n",path); - return path; -} - -int GetFileSize(FILE *file) { - - fseek(file, 0L, SEEK_END); - int length = ftell(file); - fseek(file, 0L, SEEK_SET); - - //int initial = file.tellg(); - - //file.seekg(0, ios::end); - //int length = file.tellg(); - //file.seekg(initial); - - 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 ) - ) { - - //printf("%s",actualLine); - //printf("%s",expectedLine); - - if( strcmp(actualLine,expectedLine) !=0 ){ - printf("Comparision failed on line %d",currentLine); - return FALSE; - } - - //I removed this and modified the test kodFile.c, because there shouldn't be any ASSERTs in .h files! - //TEST_ASSERT_EQUAL_STRING(actualLine,expectedLine);//EXPECT_EQ(expectedLine, actualLine) << "Comparision failed on line " << currentLine; - currentLine++; - } - - return TRUE; -} - -void ClearFile(const char * filename) { - FILE * clear = fopen(filename, "w");//ios::trunc); //similar to truncate, I GUESS???! - - //I removed this because there shouldn't be any ASSERTs in .h files! - //TEST_ASSERT_TRUE(clear != NULL); - fclose(clear); -} - - -#endif // FILE_HANDLING_TEST_H diff --git a/contrib/ntp/sntp/tests/fileHandlingTest.h.in b/contrib/ntp/sntp/tests/fileHandlingTest.h.in index 8ff9d34..e7d99ee 100644 --- a/contrib/ntp/sntp/tests/fileHandlingTest.h.in +++ b/contrib/ntp/sntp/tests/fileHandlingTest.h.in @@ -1,6 +1,7 @@ #ifndef FILE_HANDLING_TEST_H #define FILE_HANDLING_TEST_H +#include "config.h" #include "stdlib.h" #include "sntptest.h" @@ -13,88 +14,22 @@ enum DirectoryType { OUTPUT_DIR = 1 }; -const char * CreatePath(const char* filename, enum DirectoryType argument) { - - char * path = malloc (sizeof (char) * 256); +#define SRCDIR_DEF "@abs_srcdir@/data/"; +//const char srcdir[] = "@abs_srcdir@/data/"; - /* - if (m_params.size() >= argument + 1) { - path = m_params[argument]; - } +const char * +CreatePath(const char* filename, enum DirectoryType argument); - if (path[path.size()-1] != DIR_SEP && !path.empty()) { - path.append(1, DIR_SEP); - } - */ - //strcpy(path,filename); - //path.append(filename); - //return path; +int +GetFileSize(FILE *file); - char cwd[1024]; - if (getcwd(cwd, sizeof(cwd)) != NULL) - printf("Current working dir: %s\n", cwd); - - printf("builddir is <@builddir@>\n"); - printf("abs_srcdir is <@abs_srcdir@>\n"); - strcpy(path,"@abs_srcdir@/data/"); - //strcpy(path,""); - strcat(path,filename); - printf("PATH IS : %s\n",path); - return path; -} +bool +CompareFileContent(FILE* expected, FILE* actual); -int GetFileSize(FILE *file) { - - fseek(file, 0L, SEEK_END); - int length = ftell(file); - fseek(file, 0L, SEEK_SET); - - //int initial = file.tellg(); - - //file.seekg(0, ios::end); - //int length = file.tellg(); - //file.seekg(initial); - - 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 ) - ) { - - //printf("%s",actualLine); - //printf("%s",expectedLine); - - if( strcmp(actualLine,expectedLine) !=0 ){ - printf("Comparision failed on line %d",currentLine); - return FALSE; - } - - //I removed this and modified the test kodFile.c, because there shouldn't be any ASSERTs in .h files! - //TEST_ASSERT_EQUAL_STRING(actualLine,expectedLine);//EXPECT_EQ(expectedLine, actualLine) << "Comparision failed on line " << currentLine; - currentLine++; - } - - return TRUE; -} - -void ClearFile(const char * filename) { - FILE * clear = fopen(filename, "w");//ios::trunc); //similar to truncate, I GUESS???! - - //I removed this because there shouldn't be any ASSERTs in .h files! - //TEST_ASSERT_TRUE(clear != NULL); - fclose(clear); -} +void +ClearFile(const char * filename) ; #endif // FILE_HANDLING_TEST_H diff --git a/contrib/ntp/sntp/tests/g_fileHandlingTest.h b/contrib/ntp/sntp/tests/g_fileHandlingTest.h deleted file mode 100644 index 7c8a78a..0000000 --- a/contrib/ntp/sntp/tests/g_fileHandlingTest.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef FILE_HANDLING_TEST_H -#define FILE_HANDLING_TEST_H - -#include "g_sntptest.h" - -#include <fstream> -#include <string> - -using std::ifstream; -using std::string; -using std::ios; - -class fileHandlingTest : public sntptest { -protected: - enum DirectoryType { - INPUT_DIR = 0, - OUTPUT_DIR = 1 - }; - - std::string CreatePath(const char* filename, DirectoryType argument) { - std::string path; - - if (m_params.size() >= argument + 1) { - path = m_params[argument]; - } - - if (path[path.size()-1] != DIR_SEP && !path.empty()) { - path.append(1, DIR_SEP); - } - path.append(filename); - - return path; - } - - int GetFileSize(ifstream& file) { - int initial = file.tellg(); - - file.seekg(0, ios::end); - int length = file.tellg(); - file.seekg(initial); - - return length; - } - - void CompareFileContent(ifstream& expected, ifstream& actual) { - int currentLine = 1; - while (actual.good() && expected.good()) { - string actualLine, expectedLine; - getline(actual, actualLine); - getline(expected, expectedLine); - - EXPECT_EQ(expectedLine, actualLine) << "Comparision failed on line " << currentLine; - currentLine++; - } - } - - void ClearFile(const std::string& filename) { - std::ofstream clear(filename.c_str(), ios::trunc); - ASSERT_TRUE(clear.good()); - clear.close(); - } -}; - -#endif // FILE_HANDLING_TEST_H diff --git a/contrib/ntp/sntp/tests/g_networking.cpp b/contrib/ntp/sntp/tests/g_networking.cpp deleted file mode 100644 index d75f4a5..0000000 --- a/contrib/ntp/sntp/tests/g_networking.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "g_sntptest.h" - -extern "C" { -#include "networking.h" -}; diff --git a/contrib/ntp/sntp/tests/g_packetHandling.cpp b/contrib/ntp/sntp/tests/g_packetHandling.cpp deleted file mode 100644 index bd5b14e..0000000 --- a/contrib/ntp/sntp/tests/g_packetHandling.cpp +++ /dev/null @@ -1,264 +0,0 @@ -#include "g_sntptest.h" - -extern "C" { -#include "kod_management.h" -#include "main.h" -#include "networking.h" -#include "ntp.h" -}; - -class mainTest : public sntptest { -protected: - ::testing::AssertionResult LfpEquality(const l_fp &expected, const l_fp &actual) { - if (L_ISEQU(&expected, &actual)) { - return ::testing::AssertionSuccess(); - } else { - return ::testing::AssertionFailure() - << " expected: " << lfptoa(&expected, FRACTION_PREC) - << " (" << expected.l_ui << "." << expected.l_uf << ")" - << " but was: " << lfptoa(&actual, FRACTION_PREC) - << " (" << actual.l_ui << "." << actual.l_uf << ")"; - } - } -}; - -TEST_F(mainTest, GenerateUnauthenticatedPacket) { - pkt testpkt; - - timeval xmt; - GETTIMEOFDAY(&xmt, NULL); - xmt.tv_sec += JAN_1970; - - EXPECT_EQ(LEN_PKT_NOMAC, - generate_pkt(&testpkt, &xmt, 0, NULL)); - - EXPECT_EQ(LEAP_NOTINSYNC, PKT_LEAP(testpkt.li_vn_mode)); - EXPECT_EQ(NTP_VERSION, PKT_VERSION(testpkt.li_vn_mode)); - EXPECT_EQ(MODE_CLIENT, PKT_MODE(testpkt.li_vn_mode)); - - EXPECT_EQ(STRATUM_UNSPEC, PKT_TO_STRATUM(testpkt.stratum)); - EXPECT_EQ(8, testpkt.ppoll); - - l_fp expected_xmt, actual_xmt; - TVTOTS(&xmt, &expected_xmt); - NTOHL_FP(&testpkt.xmt, &actual_xmt); - EXPECT_TRUE(LfpEquality(expected_xmt, actual_xmt)); -} - -TEST_F(mainTest, GenerateAuthenticatedPacket) { - key testkey; - testkey.next = NULL; - testkey.key_id = 30; - testkey.key_len = 9; - memcpy(testkey.key_seq, "123456789", testkey.key_len); - memcpy(testkey.type, "MD5", 3); - - pkt testpkt; - - timeval xmt; - GETTIMEOFDAY(&xmt, NULL); - xmt.tv_sec += JAN_1970; - - const int EXPECTED_PKTLEN = LEN_PKT_NOMAC + MAX_MD5_LEN; - - EXPECT_EQ(EXPECTED_PKTLEN, - generate_pkt(&testpkt, &xmt, testkey.key_id, &testkey)); - - EXPECT_EQ(LEAP_NOTINSYNC, PKT_LEAP(testpkt.li_vn_mode)); - EXPECT_EQ(NTP_VERSION, PKT_VERSION(testpkt.li_vn_mode)); - EXPECT_EQ(MODE_CLIENT, PKT_MODE(testpkt.li_vn_mode)); - - EXPECT_EQ(STRATUM_UNSPEC, PKT_TO_STRATUM(testpkt.stratum)); - EXPECT_EQ(8, testpkt.ppoll); - - l_fp expected_xmt, actual_xmt; - TVTOTS(&xmt, &expected_xmt); - NTOHL_FP(&testpkt.xmt, &actual_xmt); - EXPECT_TRUE(LfpEquality(expected_xmt, actual_xmt)); - - EXPECT_EQ(testkey.key_id, ntohl(testpkt.exten[0])); - - char expected_mac[MAX_MD5_LEN]; - ASSERT_EQ(MAX_MD5_LEN - 4, // Remove the key_id, only keep the mac. - make_mac((char*)&testpkt, LEN_PKT_NOMAC, MAX_MD5_LEN, &testkey, expected_mac)); - EXPECT_TRUE(memcmp(expected_mac, (char*)&testpkt.exten[1], MAX_MD5_LEN -4) == 0); -} - -TEST_F(mainTest, OffsetCalculationPositiveOffset) { - pkt rpkt; - - 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 - l_fp reftime; - get_systime(&reftime); - HTONL_FP(&reftime, &rpkt.reftime); - - l_fp tmp; - - // 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; - timeval dst; - TSTOTV(&tmp, &dst); - dst.tv_sec -= JAN_1970; - - double offset, precision, synch_distance; - offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance); - - EXPECT_DOUBLE_EQ(1.25, offset); - EXPECT_DOUBLE_EQ(1. / ULOGTOD(16), precision); - // 1.1250150000000001 ? - EXPECT_DOUBLE_EQ(1.125015, synch_distance); -} - -TEST_F(mainTest, OffsetCalculationNegativeOffset) { - pkt rpkt; - - 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 - l_fp reftime; - get_systime(&reftime); - HTONL_FP(&reftime, &rpkt.reftime); - - l_fp tmp; - - // 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; - timeval dst; - TSTOTV(&tmp, &dst); - dst.tv_sec -= JAN_1970; - - double offset, precision, synch_distance; - offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance); - - EXPECT_DOUBLE_EQ(-1, offset); - EXPECT_DOUBLE_EQ(1. / ULOGTOD(1), precision); - EXPECT_DOUBLE_EQ(1.3333483333333334, synch_distance); -} - -TEST_F(mainTest, HandleUnusableServer) { - pkt rpkt; - sockaddr_u host; - int rpktl; - - ZERO(rpkt); - ZERO(host); - rpktl = SERVER_UNUSEABLE; - EXPECT_EQ(-1, handle_pkt(rpktl, &rpkt, &host, "")); -} - -TEST_F(mainTest, HandleUnusablePacket) { - pkt rpkt; - sockaddr_u host; - int rpktl; - - ZERO(rpkt); - ZERO(host); - rpktl = PACKET_UNUSEABLE; - EXPECT_EQ(1, handle_pkt(rpktl, &rpkt, &host, "")); -} - -TEST_F(mainTest, HandleServerAuthenticationFailure) { - pkt rpkt; - sockaddr_u host; - int rpktl; - - ZERO(rpkt); - ZERO(host); - rpktl = SERVER_AUTH_FAIL; - EXPECT_EQ(1, handle_pkt(rpktl, &rpkt, &host, "")); -} - -TEST_F(mainTest, HandleKodDemobilize) { - const char * HOSTNAME = "192.0.2.1"; - const char * REASON = "DENY"; - pkt rpkt; - sockaddr_u host; - int rpktl; - 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); - - EXPECT_EQ(1, handle_pkt(rpktl, &rpkt, &host, HOSTNAME)); - - ASSERT_EQ(1, search_entry(HOSTNAME, &entry)); - EXPECT_TRUE(memcmp(REASON, entry->type, 4) == 0); -} - -TEST_F(mainTest, HandleKodRate) { - pkt rpkt; - sockaddr_u host; - int rpktl; - - ZERO(rpkt); - ZERO(host); - rpktl = KOD_RATE; - EXPECT_EQ(1, handle_pkt(rpktl, &rpkt, &host, "")); -} - -TEST_F(mainTest, HandleCorrectPacket) { - pkt rpkt; - sockaddr_u host; - int rpktl; - l_fp now; - - // We don't want our testing code to actually change the system clock. - ASSERT_FALSE(ENABLED_OPT(STEP)); - 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; - - EXPECT_EQ(0, handle_pkt(rpktl, &rpkt, &host, "")); -} - -/* packetHandling.cpp */ diff --git a/contrib/ntp/sntp/tests/g_packetProcessing.cpp b/contrib/ntp/sntp/tests/g_packetProcessing.cpp deleted file mode 100644 index 85659a4..0000000 --- a/contrib/ntp/sntp/tests/g_packetProcessing.cpp +++ /dev/null @@ -1,334 +0,0 @@ -#include "g_sntptest.h" - -extern "C" { -#include "networking.h" -#include "ntp_stdlib.h" -}; - -#include <sstream> -#include <string> - -// Hacks into the key database. -extern key* key_ptr; -extern int key_cnt; - -class packetProcessingTest : public sntptest { -protected: - pkt testpkt; - pkt testspkt; - sockaddr_u testsock; - bool restoreKeyDb; - - void PrepareAuthenticationTest(int key_id, - int key_len, - const char* type, - const void* key_seq) { - std::stringstream ss; - ss << key_id; - - ActivateOption("-a", ss.str().c_str()); - - key_cnt = 1; - key_ptr = new key; - key_ptr->next = NULL; - key_ptr->key_id = key_id; - key_ptr->key_len = key_len; - memcpy(key_ptr->type, "MD5", 3); - - ASSERT_TRUE(key_len < sizeof(key_ptr->key_seq)); - - memcpy(key_ptr->key_seq, key_seq, key_ptr->key_len); - restoreKeyDb = true; - } - - void PrepareAuthenticationTest(int key_id, - int key_len, - const void* key_seq) { - PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq); - } - - virtual void SetUp() { - restoreKeyDb = false; - - /* Initialize the test packet and socket, - * so they contain at least some valid data. */ - testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION, - MODE_SERVER); - testpkt.stratum = STRATUM_REFCLOCK; - memcpy(&testpkt.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.org); - HTONL_FP(&tmp, &testspkt.xmt); - } - - virtual void TearDown() { - if (restoreKeyDb) { - key_cnt = 0; - delete key_ptr; - key_ptr = NULL; - } - } -}; - -TEST_F(packetProcessingTest, TooShortLength) { - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC - 1, - MODE_SERVER, &testspkt, "UnitTest")); - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC - 1, - MODE_BROADCAST, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, LengthNotMultipleOfFour) { - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC + 6, - MODE_SERVER, &testspkt, "UnitTest")); - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC + 3, - MODE_BROADCAST, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, TooShortExtensionFieldLength) { - /* 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. */ - testpkt.exten[7] = 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; - - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, UnauthenticatedPacketReject) { - // Activate authentication option - ActivateOption("-a", "123"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - int pkt_len = LEN_PKT_NOMAC; - - // We demand authentication, but no MAC header is present. - EXPECT_EQ(SERVER_AUTH_FAIL, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, CryptoNAKPacketReject) { - // Activate authentication option - ActivateOption("-a", "123"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - int pkt_len = LEN_PKT_NOMAC + 4; // + 4 byte MAC = Crypto-NAK - - EXPECT_EQ(SERVER_AUTH_FAIL, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, AuthenticatedPacketInvalid) { - // Activate authentication option - PrepareAuthenticationTest(50, 9, "123456789"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - // Prepare the packet. - int pkt_len = LEN_PKT_NOMAC; - - testpkt.exten[0] = htonl(50); - int mac_len = make_mac((char*)&testpkt, pkt_len, - MAX_MD5_LEN, key_ptr, - (char*)&testpkt.exten[1]); - - pkt_len += 4 + mac_len; - - // Now, alter the MAC so it becomes invalid. - testpkt.exten[1] += 1; - - EXPECT_EQ(SERVER_AUTH_FAIL, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, AuthenticatedPacketUnknownKey) { - // Activate authentication option - PrepareAuthenticationTest(30, 9, "123456789"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - // Prepare the packet. Observe that the Key-ID expected is 30, - // but the packet has a key id of 50. - int pkt_len = LEN_PKT_NOMAC; - - testpkt.exten[0] = htonl(50); - int mac_len = make_mac((char*)&testpkt, pkt_len, - MAX_MD5_LEN, key_ptr, - (char*)&testpkt.exten[1]); - pkt_len += 4 + mac_len; - - EXPECT_EQ(SERVER_AUTH_FAIL, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, ServerVersionTooOld) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, - NTP_OLDVERSION - 1, - MODE_CLIENT); - ASSERT_LT(PKT_VERSION(testpkt.li_vn_mode), NTP_OLDVERSION); - - int pkt_len = LEN_PKT_NOMAC; - - EXPECT_EQ(SERVER_UNUSEABLE, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, ServerVersionTooNew) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, - NTP_VERSION + 1, - MODE_CLIENT); - ASSERT_GT(PKT_VERSION(testpkt.li_vn_mode), NTP_VERSION); - - int pkt_len = LEN_PKT_NOMAC; - - EXPECT_EQ(SERVER_UNUSEABLE, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, NonWantedMode) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.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 - - EXPECT_EQ(SERVER_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -/* Tests bug 1597 */ -TEST_F(packetProcessingTest, KoDRate) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.stratum = STRATUM_PKT_UNSPEC; - memcpy(&testpkt.refid, "RATE", 4); - - EXPECT_EQ(KOD_RATE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, KoDDeny) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.stratum = STRATUM_PKT_UNSPEC; - memcpy(&testpkt.refid, "DENY", 4); - - EXPECT_EQ(KOD_DEMOBILIZE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, RejectUnsyncedServer) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC, - NTP_VERSION, - MODE_SERVER); - - EXPECT_EQ(SERVER_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, RejectWrongResponseServerMode) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - l_fp tmp; - tmp.l_ui = 1000UL; - tmp.l_uf = 0UL; - HTONL_FP(&tmp, &testpkt.org); - - tmp.l_ui = 2000UL; - tmp.l_uf = 0UL; - HTONL_FP(&tmp, &testspkt.xmt); - - EXPECT_EQ(PACKET_UNUSEABLE, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, AcceptNoSentPacketBroadcastMode) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, - NTP_VERSION, - MODE_BROADCAST); - - EXPECT_EQ(LEN_PKT_NOMAC, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_BROADCAST, NULL, "UnitTest")); -} - -TEST_F(packetProcessingTest, CorrectUnauthenticatedPacket) { - ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); - - EXPECT_EQ(LEN_PKT_NOMAC, - process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC, - MODE_SERVER, &testspkt, "UnitTest")); -} - -TEST_F(packetProcessingTest, CorrectAuthenticatedPacketMD5) { - PrepareAuthenticationTest(10, 15, "123456789abcdef"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - int pkt_len = LEN_PKT_NOMAC; - - // Prepare the packet. - testpkt.exten[0] = htonl(10); - int mac_len = make_mac((char*)&testpkt, pkt_len, - MAX_MD5_LEN, key_ptr, - (char*)&testpkt.exten[1]); - - pkt_len += 4 + mac_len; - - EXPECT_EQ(pkt_len, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); - -} - -TEST_F(packetProcessingTest, CorrectAuthenticatedPacketSHA1) { - PrepareAuthenticationTest(20, 15, "SHA1", "abcdefghijklmno"); - ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); - - int pkt_len = LEN_PKT_NOMAC; - - // Prepare the packet. - testpkt.exten[0] = htonl(20); - int mac_len = make_mac((char*)&testpkt, pkt_len, - MAX_MAC_LEN, key_ptr, - (char*)&testpkt.exten[1]); - - pkt_len += 4 + mac_len; - - EXPECT_EQ(pkt_len, - process_pkt(&testpkt, &testsock, pkt_len, - MODE_SERVER, &testspkt, "UnitTest")); -} diff --git a/contrib/ntp/sntp/tests/g_sntptest.h b/contrib/ntp/sntp/tests/g_sntptest.h deleted file mode 100644 index d5add9c..0000000 --- a/contrib/ntp/sntp/tests/g_sntptest.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef SNTPTEST_H -#define SNTPTEST_H - -#include "tests_main.h" - -extern "C" { -#include "ntp_stdlib.h" -#include "sntp-opts.h" -}; - -class sntptest : public ntptest { -protected: - sntptest() { - optionSaveState(&sntpOptions); - } - - ~sntptest() { - 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); - } -}; - -#endif // SNTPTEST_H diff --git a/contrib/ntp/sntp/tests/keyFile.c b/contrib/ntp/sntp/tests/keyFile.c index 3769947..77dfee7 100644 --- a/contrib/ntp/sntp/tests/keyFile.c +++ b/contrib/ntp/sntp/tests/keyFile.c @@ -7,10 +7,17 @@ #include "unity.h" -//typedef int bool; +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) { +bool +CompareKeys(struct key expected, struct key actual) { if (expected.key_id != actual.key_id){ printf("Expected key_id: %d", expected.key_id); printf(" but was: %d\n", actual.key_id); @@ -34,7 +41,9 @@ bool CompareKeys(struct key expected, struct key actual) { return TRUE; } -bool CompareKeysAlternative(int key_id, + +bool +CompareKeysAlternative(int key_id, int key_len, const char* type, const char* key_seq, @@ -50,91 +59,99 @@ bool CompareKeysAlternative(int key_id, } -void test_ReadEmptyKeyFile() { +void +test_ReadEmptyKeyFile(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys)); - - TEST_ASSERT_TRUE(keys == NULL); + TEST_ASSERT_NULL(keys); } -void test_ReadASCIIKeys() { + +void +test_ReadASCIIKeys(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-ascii", INPUT_DIR), &keys)); - TEST_ASSERT_TRUE(keys != NULL); + TEST_ASSERT_NOT_NULL(keys); struct key* result = NULL; get_key(40, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); TEST_ASSERT_TRUE(CompareKeysAlternative(40, 11, "MD5", "asciikeyTwo", *result)); result = NULL; get_key(50, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); TEST_ASSERT_TRUE(CompareKeysAlternative(50, 11, "MD5", "asciikeyOne", *result)); } -void test_ReadHexKeys() { + +void +test_ReadHexKeys(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys)); - TEST_ASSERT_TRUE(keys != NULL); + TEST_ASSERT_NOT_NULL(keys); struct key* result = NULL; get_key(10, &result); - TEST_ASSERT_TRUE(result != NULL); + 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_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); char data1[15]; memset(data1, 0x11, 15); TEST_ASSERT_TRUE(CompareKeysAlternative(20, 15, "MD5", data1, *result)); result = NULL; get_key(30, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); char data2[13]; memset(data2, 0x01, 13); TEST_ASSERT_TRUE(CompareKeysAlternative(30, 13, "MD5", data2, *result)); } -void test_ReadKeyFileWithComments() { + +void +test_ReadKeyFileWithComments(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-comments", INPUT_DIR), &keys)); - TEST_ASSERT_TRUE(keys != NULL); + TEST_ASSERT_NOT_NULL(keys); struct key* result = NULL; get_key(10, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); char data[15]; memset(data, 0x01, 15); TEST_ASSERT_TRUE(CompareKeysAlternative(10, 15, "MD5", data, *result)); result = NULL; get_key(34, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); TEST_ASSERT_TRUE(CompareKeysAlternative(34, 3, "MD5", "xyz", *result)); } -void test_ReadKeyFileWithInvalidHex() { + +void +test_ReadKeyFileWithInvalidHex(void) { struct key* keys = NULL; TEST_ASSERT_EQUAL(1, auth_init(CreatePath("key-test-invalid-hex", INPUT_DIR), &keys)); - TEST_ASSERT_TRUE(keys != NULL); + TEST_ASSERT_NOT_NULL(keys); struct key* result = NULL; get_key(10, &result); - TEST_ASSERT_TRUE(result != NULL); + TEST_ASSERT_NOT_NULL(result); char data[15]; 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_TRUE(result == NULL); + TEST_ASSERT_NULL(result); } diff --git a/contrib/ntp/sntp/tests/kodDatabase.c b/contrib/ntp/sntp/tests/kodDatabase.c index a6b86d0..0c3615d 100644 --- a/contrib/ntp/sntp/tests/kodDatabase.c +++ b/contrib/ntp/sntp/tests/kodDatabase.c @@ -4,24 +4,29 @@ #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) -{ - kod_init_kod_db("/dev/null", TRUE); -} +void setUp(void); +void test_SingleEntryHandling(void); +void test_MultipleEntryHandling(void); +void test_NoMatchInSearch(void); +void test_AddDuplicate(void); +void test_DeleteEntry(void); -void tearDown(void) -{ + +void +setUp(void) { + kod_init_kod_db("/dev/null", TRUE); } -void test_SingleEntryHandling() { - char HOST[] = "192.0.2.5"; - char REASON[] = "DENY"; +void +test_SingleEntryHandling(void) { + const char HOST[] = "192.0.2.5"; + const char REASON[] = "DENY"; add_entry(HOST, REASON); @@ -32,15 +37,17 @@ void test_SingleEntryHandling() { TEST_ASSERT_EQUAL_STRING(REASON, result->type); } -void test_MultipleEntryHandling() { - char HOST1[] = "192.0.2.3"; - char REASON1[] = "DENY"; - char HOST2[] = "192.0.5.5"; - char REASON2[] = "RATE"; +void +test_MultipleEntryHandling(void) { + const char HOST1[] = "192.0.2.3"; + const char REASON1[] = "DENY"; - char HOST3[] = "192.0.10.1"; - char REASON3[] = "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); @@ -63,10 +70,12 @@ void test_MultipleEntryHandling() { free(result); } -void test_NoMatchInSearch() { - char HOST_ADD[] = "192.0.2.6"; - char HOST_NOTADD[] = "192.0.6.1"; - char REASON[] = "DENY"; + +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); @@ -76,10 +85,12 @@ void test_NoMatchInSearch() { TEST_ASSERT_TRUE(result == NULL); } -void test_AddDuplicate() { - char HOST[] = "192.0.2.3"; - char REASON1[] = "RATE"; - char REASON2[] = "DENY"; + +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; @@ -101,11 +112,13 @@ void test_AddDuplicate() { free(result2); } -void test_DeleteEntry() { - char HOST1[] = "192.0.2.1"; - char HOST2[] = "192.0.2.2"; - char HOST3[] = "192.0.2.3"; - char REASON[] = "DENY"; + +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); diff --git a/contrib/ntp/sntp/tests/kodFile.c b/contrib/ntp/sntp/tests/kodFile.c index 7daec21..6eb0971 100644 --- a/contrib/ntp/sntp/tests/kodFile.c +++ b/contrib/ntp/sntp/tests/kodFile.c @@ -1,10 +1,8 @@ #include "config.h" + #include "ntp_types.h" #include "ntp_stdlib.h" // For estrdup() - - #include "fileHandlingTest.h" - #include "kod_management.h" #include "unity.h" @@ -17,22 +15,32 @@ extern int kod_db_cnt; extern struct kod_entry** kod_db; extern char* kod_db_file; -void setUp() { - kod_db_cnt = 0; - kod_db = NULL; -} +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 tearDown() { +void +setUp(void) { + kod_db_cnt = 0; + kod_db = NULL; } -void test_ReadEmptyFile() { +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 +test_ReadCorrectFile(void) { kod_init_kod_db(CreatePath("kod-test-correct", INPUT_DIR), TRUE); TEST_ASSERT_EQUAL(2, kod_db_cnt); @@ -50,7 +58,9 @@ void test_ReadCorrectFile() { TEST_ASSERT_EQUAL(0xfff, res->timestamp); } -void test_ReadFileWithBlankLines() { + +void +test_ReadFileWithBlankLines(void) { kod_init_kod_db(CreatePath("kod-test-blanks", INPUT_DIR), TRUE); TEST_ASSERT_EQUAL(3, kod_db_cnt); @@ -73,31 +83,30 @@ void test_ReadFileWithBlankLines() { TEST_ASSERT_EQUAL(0xabcd, res->timestamp); } -void test_WriteEmptyFile() { - //kod_db_file = estrdup(CreatePath("kod-output-blank", OUTPUT_DIR)); //causing issues on psp-at1, replaced + +void +test_WriteEmptyFile(void) { kod_db_file = estrdup("kod-output-blank"); - //printf("kod PATH: %s\n",kod_db_file); write_kod_db(); // Open file and ensure that the filesize is 0 bytes. - FILE * is; - is = fopen(kod_db_file, "rb");//std::ios::binary); - TEST_ASSERT_FALSE(is == NULL );//is.fail()); - + FILE * is = fopen(kod_db_file, "rb"); + TEST_ASSERT_NOT_NULL(is); + TEST_ASSERT_EQUAL(0, GetFileSize(is)); fclose(is); } -void test_WriteFileWithSingleEntry() { - //kod_db_file = estrdup(CreatePath("kod-output-single", OUTPUT_DIR)); //causing issues on psp-at1, replaced + +void +test_WriteFileWithSingleEntry(void) { kod_db_file = estrdup("kod-output-single"); - //printf("kod PATH: %s\n",kod_db_file); 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(); @@ -105,18 +114,19 @@ void test_WriteFileWithSingleEntry() { // Open file and compare sizes. FILE * actual = fopen(kod_db_file, "rb"); FILE * expected = fopen(CreatePath("kod-expected-single", INPUT_DIR),"rb"); - TEST_ASSERT_TRUE(actual !=NULL);//TEST_ASSERT_TRUE(actual.good()); - TEST_ASSERT_TRUE(expected !=NULL);//TEST_ASSERT_TRUE(expected.good()); - TEST_ASSERT_EQUAL(GetFileSize(expected), GetFileSize(actual)); + 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() { - //kod_db_file = estrdup(CreatePath("kod-output-multiple", OUTPUT_DIR)); //causing issues on psp-at1, replaced + +void +test_WriteFileWithMultipleEntries(void) { kod_db_file = estrdup("kod-output-multiple"); - //printf("kod PATH: %s\n",kod_db_file); add_entry("example.com", "RATE"); add_entry("192.0.2.1", "DENY"); add_entry("192.0.2.5", "RSTR"); @@ -134,12 +144,12 @@ void test_WriteFileWithMultipleEntries() { // 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_TRUE(actual !=NULL);//TEST_ASSERT_TRUE(actual.good()); - TEST_ASSERT_TRUE(expected !=NULL);//TEST_ASSERT_TRUE(expected.good()); - + 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/packetHandling.c b/contrib/ntp/sntp/tests/packetHandling.c index 4cb5a91..1036fc3 100644 --- a/contrib/ntp/sntp/tests/packetHandling.c +++ b/contrib/ntp/sntp/tests/packetHandling.c @@ -12,27 +12,37 @@ #include "unity.h" - -int counter = 0; - - -// old code from google test framework, moved to SetUp() for unity -void setUp(void) -{ +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) { - if (L_ISEQU(&expected, &actual)) { - return TRUE; - } else { - return FALSE; - } +int +LfpEquality(const l_fp expected, const l_fp actual) { + if (L_ISEQU(&expected, &actual)) + return TRUE; + else + return FALSE; } -void test_GenerateUnauthenticatedPacket(void) { + +void +test_GenerateUnauthenticatedPacket(void) { struct pkt testpkt; struct timeval xmt; @@ -55,7 +65,9 @@ void test_GenerateUnauthenticatedPacket(void) { TEST_ASSERT_TRUE(LfpEquality(expected_xmt, actual_xmt)); } -void test_GenerateAuthenticatedPacket(void) { + +void +test_GenerateAuthenticatedPacket(void) { struct key testkey; testkey.next = NULL; testkey.key_id = 30; @@ -91,10 +103,12 @@ void test_GenerateAuthenticatedPacket(void) { char expected_mac[MAX_MD5_LEN]; TEST_ASSERT_EQUAL(MAX_MD5_LEN - 4, // Remove the key_id, only keep the mac. make_mac((char*)&testpkt, LEN_PKT_NOMAC, MAX_MD5_LEN, &testkey, expected_mac)); - TEST_ASSERT_TRUE(memcmp(expected_mac, (char*)&testpkt.exten[1], MAX_MD5_LEN -4) == 0); + TEST_ASSERT_EQUAL_MEMORY(expected_mac, (char*)&testpkt.exten[1], MAX_MD5_LEN -4); } -void test_OffsetCalculationPositiveOffset(void) { + +void +test_OffsetCalculationPositiveOffset(void) { struct pkt rpkt; rpkt.precision = -16; // 0,000015259 @@ -132,13 +146,15 @@ void test_OffsetCalculationPositiveOffset(void) { double offset, precision, synch_distance; offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance); - TEST_ASSERT_EQUAL_FLOAT(1.25, offset); - TEST_ASSERT_EQUAL_FLOAT(1. / ULOGTOD(16), precision); + TEST_ASSERT_EQUAL_DOUBLE(1.25, offset); + TEST_ASSERT_EQUAL_DOUBLE(1. / ULOGTOD(16), precision); // 1.1250150000000001 ? - TEST_ASSERT_EQUAL_FLOAT(1.125015, synch_distance); + TEST_ASSERT_EQUAL_DOUBLE(1.125015, synch_distance); } -void test_OffsetCalculationNegativeOffset(void) { + +void +test_OffsetCalculationNegativeOffset(void) { struct pkt rpkt; rpkt.precision = -1; @@ -176,12 +192,14 @@ void test_OffsetCalculationNegativeOffset(void) { double offset, precision, synch_distance; offset_calculation(&rpkt, LEN_PKT_NOMAC, &dst, &offset, &precision, &synch_distance); - TEST_ASSERT_EQUAL_FLOAT(-1, offset); - TEST_ASSERT_EQUAL_FLOAT(1. / ULOGTOD(1), precision); - TEST_ASSERT_EQUAL_FLOAT(1.3333483333333334, 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) { + +void +test_HandleUnusableServer(void) { struct pkt rpkt; sockaddr_u host; int rpktl; @@ -192,7 +210,9 @@ void test_HandleUnusableServer(void) { TEST_ASSERT_EQUAL(-1, handle_pkt(rpktl, &rpkt, &host, "")); } -void test_HandleUnusablePacket(void) { + +void +test_HandleUnusablePacket(void) { struct pkt rpkt; sockaddr_u host; int rpktl; @@ -203,7 +223,9 @@ void test_HandleUnusablePacket(void) { TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, "")); } -void test_HandleServerAuthenticationFailure(void) { + +void +test_HandleServerAuthenticationFailure(void) { struct pkt rpkt; sockaddr_u host; int rpktl; @@ -214,7 +236,9 @@ void test_HandleServerAuthenticationFailure(void) { TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, "")); } -void test_HandleKodDemobilize(void) { + +void +test_HandleKodDemobilize(void) { const char * HOSTNAME = "192.0.2.1"; const char * REASON = "DENY"; struct pkt rpkt; @@ -235,10 +259,12 @@ void test_HandleKodDemobilize(void) { TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, HOSTNAME)); TEST_ASSERT_EQUAL(1, search_entry(HOSTNAME, &entry)); - TEST_ASSERT_TRUE(memcmp(REASON, entry->type, 4) == 0); + TEST_ASSERT_EQUAL_MEMORY(REASON, entry->type, 4); } -void test_HandleKodRate(void) { + +void +test_HandleKodRate(void) { struct pkt rpkt; sockaddr_u host; int rpktl; @@ -249,7 +275,9 @@ void test_HandleKodRate(void) { TEST_ASSERT_EQUAL(1, handle_pkt(rpktl, &rpkt, &host, "")); } -void test_HandleCorrectPacket(void) { + +void +test_HandleCorrectPacket(void) { struct pkt rpkt; sockaddr_u host; int rpktl; diff --git a/contrib/ntp/sntp/tests/packetProcessing.c b/contrib/ntp/sntp/tests/packetProcessing.c index 27ab72e..1fd649e 100644 --- a/contrib/ntp/sntp/tests/packetProcessing.c +++ b/contrib/ntp/sntp/tests/packetProcessing.c @@ -4,6 +4,7 @@ #include "ntp_stdlib.h" #include "unity.h" + const char * Version = "stub unit test Version string"; // Hacks into the key database. @@ -11,21 +12,47 @@ 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); + + static struct pkt testpkt; static struct pkt testspkt; static sockaddr_u testsock; bool restoreKeyDb; -void PrepareAuthenticationTest(int key_id, + +void +PrepareAuthenticationTest(int key_id, int key_len, const char* type, const void* key_seq) { char str[25]; - sprintf(str, "%d", key_id); + snprintf(str, 25, "%d", key_id); ActivateOption("-a", str); key_cnt = 1; - key_ptr = malloc(sizeof(struct key)); + key_ptr = emalloc(sizeof(struct key)); key_ptr->next = NULL; key_ptr->key_id = key_id; key_ptr->key_len = key_len; @@ -37,13 +64,17 @@ void PrepareAuthenticationTest(int key_id, restoreKeyDb = true; } -void PrepareAuthenticationTestMD5(int key_id, + +void +PrepareAuthenticationTestMD5(int key_id, int key_len, const void* key_seq) { PrepareAuthenticationTest(key_id, key_len, "MD5", key_seq); } -void setUp() { + +void +setUp(void) { sntptest(); restoreKeyDb = false; @@ -63,10 +94,11 @@ void setUp() { HTONL_FP(&tmp, &testpkt.org); HTONL_FP(&tmp, &testspkt.xmt); - } -void tearDown() { + +void +tearDown(void) { if (restoreKeyDb) { key_cnt = 0; @@ -75,12 +107,12 @@ void tearDown() { } sntptest_destroy(); //only on the final test!! if counter == 0 etc... - } -void test_TooShortLength(void) { +void +test_TooShortLength(void) { TEST_ASSERT_EQUAL(PACKET_UNUSEABLE, process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC - 1, MODE_SERVER, &testspkt, "UnitTest")); @@ -89,7 +121,9 @@ void test_TooShortLength(void) { MODE_BROADCAST, &testspkt, "UnitTest")); } -void test_LengthNotMultipleOfFour(void) { + +void +test_LengthNotMultipleOfFour(void) { TEST_ASSERT_EQUAL(PACKET_UNUSEABLE, process_pkt(&testpkt, &testsock, LEN_PKT_NOMAC + 6, MODE_SERVER, &testspkt, "UnitTest")); @@ -98,7 +132,9 @@ void test_LengthNotMultipleOfFour(void) { MODE_BROADCAST, &testspkt, "UnitTest")); } -void test_TooShortExtensionFieldLength(void) { + +void +test_TooShortExtensionFieldLength(void) { /* 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. */ @@ -114,7 +150,9 @@ void test_TooShortExtensionFieldLength(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_UnauthenticatedPacketReject(void) { + +void +test_UnauthenticatedPacketReject(void) { //sntptest(); // Activate authentication option ActivateOption("-a", "123"); @@ -128,7 +166,9 @@ void test_UnauthenticatedPacketReject(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_CryptoNAKPacketReject(void) { + +void +test_CryptoNAKPacketReject(void) { // Activate authentication option ActivateOption("-a", "123"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -140,7 +180,9 @@ void test_CryptoNAKPacketReject(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_AuthenticatedPacketInvalid(void) { + +void +test_AuthenticatedPacketInvalid(void) { // Activate authentication option PrepareAuthenticationTestMD5(50, 9, "123456789"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -163,7 +205,9 @@ void test_AuthenticatedPacketInvalid(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_AuthenticatedPacketUnknownKey(void) { + +void +test_AuthenticatedPacketUnknownKey(void) { // Activate authentication option PrepareAuthenticationTestMD5(30, 9, "123456789"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -183,7 +227,9 @@ void test_AuthenticatedPacketUnknownKey(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_ServerVersionTooOld(void) { + +void +test_ServerVersionTooOld(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, @@ -198,7 +244,9 @@ void test_ServerVersionTooOld(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_ServerVersionTooNew(void) { + +void +test_ServerVersionTooNew(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, @@ -213,7 +261,9 @@ void test_ServerVersionTooNew(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_NonWantedMode(void) { + +void +test_NonWantedMode(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, @@ -227,8 +277,10 @@ void test_NonWantedMode(void) { MODE_SERVER, &testspkt, "UnitTest")); } + /* Tests bug 1597 */ -void test_KoDRate(void) { +void +test_KoDRate(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.stratum = STRATUM_PKT_UNSPEC; @@ -239,7 +291,9 @@ void test_KoDRate(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_KoDDeny(void) { + +void +test_KoDDeny(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.stratum = STRATUM_PKT_UNSPEC; @@ -250,7 +304,9 @@ void test_KoDDeny(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_RejectUnsyncedServer(void) { + +void +test_RejectUnsyncedServer(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC, @@ -262,7 +318,9 @@ void test_RejectUnsyncedServer(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_RejectWrongResponseServerMode(void) { + +void +test_RejectWrongResponseServerMode(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); l_fp tmp; @@ -279,7 +337,9 @@ void test_RejectWrongResponseServerMode(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_AcceptNoSentPacketBroadcastMode(void) { + +void +test_AcceptNoSentPacketBroadcastMode(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); testpkt.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, @@ -291,7 +351,9 @@ void test_AcceptNoSentPacketBroadcastMode(void) { MODE_BROADCAST, NULL, "UnitTest")); } -void test_CorrectUnauthenticatedPacket(void) { + +void +test_CorrectUnauthenticatedPacket(void) { TEST_ASSERT_FALSE(ENABLED_OPT(AUTHENTICATION)); TEST_ASSERT_EQUAL(LEN_PKT_NOMAC, @@ -299,7 +361,9 @@ void test_CorrectUnauthenticatedPacket(void) { MODE_SERVER, &testspkt, "UnitTest")); } -void test_CorrectAuthenticatedPacketMD5(void) { + +void +test_CorrectAuthenticatedPacketMD5(void) { PrepareAuthenticationTestMD5(10, 15, "123456789abcdef"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); @@ -319,7 +383,9 @@ void test_CorrectAuthenticatedPacketMD5(void) { } -void test_CorrectAuthenticatedPacketSHA1(void) { + +void +test_CorrectAuthenticatedPacketSHA1(void) { PrepareAuthenticationTest(20, 15, "SHA1", "abcdefghijklmno"); TEST_ASSERT_TRUE(ENABLED_OPT(AUTHENTICATION)); diff --git a/contrib/ntp/sntp/tests/run-crypto.c b/contrib/ntp/sntp/tests/run-crypto.c index c5dbaf6..8b2a735 100644 --- a/contrib/ntp/sntp/tests/run-crypto.c +++ b/contrib/ntp/sntp/tests/run-crypto.c @@ -22,11 +22,14 @@ #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); -void resetTest(void); extern void test_MakeMd5Mac(void); extern void test_MakeSHA1Mac(void); extern void test_VerifyCorrectMD5(void); @@ -36,27 +39,27 @@ extern void test_PacketSizeNotMultipleOfFourBytes(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "crypto.c"; UnityBegin("crypto.c"); - RUN_TEST(test_MakeMd5Mac, 11); - RUN_TEST(test_MakeSHA1Mac, 33); - RUN_TEST(test_VerifyCorrectMD5, 59); - RUN_TEST(test_VerifySHA1, 78); - RUN_TEST(test_VerifyFailure, 100); - RUN_TEST(test_PacketSizeNotMultipleOfFourBytes, 120); + 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 index 0a6380d..8629109 100644 --- a/contrib/ntp/sntp/tests/run-keyFile.c +++ b/contrib/ntp/sntp/tests/run-keyFile.c @@ -22,38 +22,43 @@ #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(); -extern void test_ReadASCIIKeys(); -extern void test_ReadHexKeys(); -extern void test_ReadKeyFileWithComments(); -extern void test_ReadKeyFileWithInvalidHex(); +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 resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "keyFile.c"; UnityBegin("keyFile.c"); - RUN_TEST(test_ReadEmptyKeyFile, 53); - RUN_TEST(test_ReadASCIIKeys, 61); - RUN_TEST(test_ReadHexKeys, 79); - RUN_TEST(test_ReadKeyFileWithComments, 105); - RUN_TEST(test_ReadKeyFileWithInvalidHex, 124); + 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 index 7fc9678..e5bf3d7 100644 --- a/contrib/ntp/sntp/tests/run-kodDatabase.c +++ b/contrib/ntp/sntp/tests/run-kodDatabase.c @@ -22,38 +22,45 @@ #include "unity.h" #include <setjmp.h> #include <stdio.h> +#include "config.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(); -extern void test_MultipleEntryHandling(); -extern void test_NoMatchInSearch(); -extern void test_AddDuplicate(); -extern void test_DeleteEntry(); +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 resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "kodDatabase.c"; UnityBegin("kodDatabase.c"); - RUN_TEST(test_SingleEntryHandling, 22); - RUN_TEST(test_MultipleEntryHandling, 35); - RUN_TEST(test_NoMatchInSearch, 66); - RUN_TEST(test_AddDuplicate, 79); - RUN_TEST(test_DeleteEntry, 104); + RUN_TEST(test_SingleEntryHandling, 13); + RUN_TEST(test_MultipleEntryHandling, 14); + RUN_TEST(test_NoMatchInSearch, 15); + RUN_TEST(test_AddDuplicate, 16); + RUN_TEST(test_DeleteEntry, 17); return (UnityEnd()); } diff --git a/contrib/ntp/sntp/tests/run-kodFile.c b/contrib/ntp/sntp/tests/run-kodFile.c index 9c58962..3943550 100644 --- a/contrib/ntp/sntp/tests/run-kodFile.c +++ b/contrib/ntp/sntp/tests/run-kodFile.c @@ -22,40 +22,45 @@ #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(); -extern void test_ReadCorrectFile(); -extern void test_ReadFileWithBlankLines(); -extern void test_WriteEmptyFile(); -extern void test_WriteFileWithSingleEntry(); -extern void test_WriteFileWithMultipleEntries(); +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 resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "kodFile.c"; UnityBegin("kodFile.c"); - RUN_TEST(test_ReadEmptyFile, 29); - RUN_TEST(test_ReadCorrectFile, 35); - RUN_TEST(test_ReadFileWithBlankLines, 53); - RUN_TEST(test_WriteEmptyFile, 76); - RUN_TEST(test_WriteFileWithSingleEntry, 92); - RUN_TEST(test_WriteFileWithMultipleEntries, 116); + 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 index d5e822c..70caaa0 100644 --- a/contrib/ntp/sntp/tests/run-networking.c +++ b/contrib/ntp/sntp/tests/run-networking.c @@ -22,6 +22,9 @@ #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); @@ -29,20 +32,20 @@ extern void tearDown(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "networking.c"; UnityBegin("networking.c"); return (UnityEnd()); diff --git a/contrib/ntp/sntp/tests/run-packetHandling.c b/contrib/ntp/sntp/tests/run-packetHandling.c index 69e958e..bc20d7f 100644 --- a/contrib/ntp/sntp/tests/run-packetHandling.c +++ b/contrib/ntp/sntp/tests/run-packetHandling.c @@ -22,11 +22,19 @@ #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); -void resetTest(void); extern void test_GenerateUnauthenticatedPacket(void); extern void test_GenerateAuthenticatedPacket(void); extern void test_OffsetCalculationPositiveOffset(void); @@ -40,31 +48,31 @@ extern void test_HandleCorrectPacket(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "packetHandling.c"; UnityBegin("packetHandling.c"); - RUN_TEST(test_GenerateUnauthenticatedPacket, 35); - RUN_TEST(test_GenerateAuthenticatedPacket, 58); - RUN_TEST(test_OffsetCalculationPositiveOffset, 97); - RUN_TEST(test_OffsetCalculationNegativeOffset, 141); - RUN_TEST(test_HandleUnusableServer, 184); - RUN_TEST(test_HandleUnusablePacket, 195); - RUN_TEST(test_HandleServerAuthenticationFailure, 206); - RUN_TEST(test_HandleKodDemobilize, 217); - RUN_TEST(test_HandleKodRate, 241); - RUN_TEST(test_HandleCorrectPacket, 252); + 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 index f41d5c7..bf3a63e 100644 --- a/contrib/ntp/sntp/tests/run-packetProcessing.c +++ b/contrib/ntp/sntp/tests/run-packetProcessing.c @@ -22,11 +22,14 @@ #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); -void resetTest(void); extern void test_TooShortLength(void); extern void test_LengthNotMultipleOfFour(void); extern void test_TooShortExtensionFieldLength(void); @@ -48,39 +51,39 @@ extern void test_CorrectAuthenticatedPacketSHA1(void); //=======Test Reset Option===== -void resetTest() +void resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "packetProcessing.c"; UnityBegin("packetProcessing.c"); - RUN_TEST(test_TooShortLength, 83); - RUN_TEST(test_LengthNotMultipleOfFour, 92); - RUN_TEST(test_TooShortExtensionFieldLength, 101); - RUN_TEST(test_UnauthenticatedPacketReject, 117); - RUN_TEST(test_CryptoNAKPacketReject, 131); - RUN_TEST(test_AuthenticatedPacketInvalid, 143); - RUN_TEST(test_AuthenticatedPacketUnknownKey, 166); - RUN_TEST(test_ServerVersionTooOld, 186); - RUN_TEST(test_ServerVersionTooNew, 201); - RUN_TEST(test_NonWantedMode, 216); - RUN_TEST(test_KoDRate, 231); - RUN_TEST(test_KoDDeny, 242); - RUN_TEST(test_RejectUnsyncedServer, 253); - RUN_TEST(test_RejectWrongResponseServerMode, 265); - RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 282); - RUN_TEST(test_CorrectUnauthenticatedPacket, 294); - RUN_TEST(test_CorrectAuthenticatedPacketMD5, 302); - RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 322); + RUN_TEST(test_TooShortLength, 19); + RUN_TEST(test_LengthNotMultipleOfFour, 20); + RUN_TEST(test_TooShortExtensionFieldLength, 21); + RUN_TEST(test_UnauthenticatedPacketReject, 22); + RUN_TEST(test_CryptoNAKPacketReject, 23); + RUN_TEST(test_AuthenticatedPacketInvalid, 24); + RUN_TEST(test_AuthenticatedPacketUnknownKey, 25); + RUN_TEST(test_ServerVersionTooOld, 26); + RUN_TEST(test_ServerVersionTooNew, 27); + RUN_TEST(test_NonWantedMode, 28); + RUN_TEST(test_KoDRate, 29); + RUN_TEST(test_KoDDeny, 30); + RUN_TEST(test_RejectUnsyncedServer, 31); + RUN_TEST(test_RejectWrongResponseServerMode, 32); + RUN_TEST(test_AcceptNoSentPacketBroadcastMode, 33); + RUN_TEST(test_CorrectUnauthenticatedPacket, 34); + RUN_TEST(test_CorrectAuthenticatedPacketMD5, 35); + RUN_TEST(test_CorrectAuthenticatedPacketSHA1, 36); 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 0000000..dc9fa04 --- /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, 9); + RUN_TEST(testOpenLogfileTest, 10); + RUN_TEST(testWriteInCustomLogfile, 35); + + return (UnityEnd()); +} diff --git a/contrib/ntp/sntp/tests/run-utilities.c b/contrib/ntp/sntp/tests/run-utilities.c index 715bd11..7c2237b 100644 --- a/contrib/ntp/sntp/tests/run-utilities.c +++ b/contrib/ntp/sntp/tests/run-utilities.c @@ -22,43 +22,48 @@ #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); -void resetTest(void); -extern void test_IPv4Address(); -extern void test_IPv6Address(); -extern void test_SetLiVnMode1(); -extern void test_SetLiVnMode2(); -extern void test_PktOutput(); -extern void test_LfpOutputBinaryFormat(); -extern void test_LfpOutputDecimalFormat(); +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 resetTest(void); +void resetTest(void) { tearDown(); setUp(); } -char *progname; +char const *progname; //=======MAIN===== int main(int argc, char *argv[]) { progname = argv[0]; - Unity.TestFile = "utilities.c"; UnityBegin("utilities.c"); - RUN_TEST(test_IPv4Address, 68); - RUN_TEST(test_IPv6Address, 78); - RUN_TEST(test_SetLiVnMode1, 98); - RUN_TEST(test_SetLiVnMode2, 111); - RUN_TEST(test_PktOutput, 126); - RUN_TEST(test_LfpOutputBinaryFormat, 146); - RUN_TEST(test_LfpOutputDecimalFormat, 162); + 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 0000000..73c1ad2 --- /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 index eff6f6e..82e2562 100644 --- a/contrib/ntp/sntp/tests/sntptest.h +++ b/contrib/ntp/sntp/tests/sntptest.h @@ -4,28 +4,8 @@ #include "ntp_stdlib.h" #include "sntp-opts.h" - -sntptest() { - optionSaveState(&sntpOptions); -} - -sntptest_destroy() { - 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); -} - +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 0000000..1546584 --- /dev/null +++ b/contrib/ntp/sntp/tests/t-log.c @@ -0,0 +1,68 @@ +#include "config.h" +#include "unity.h" +#include "ntp_types.h" + + +//#include "log.h" +#include "log.c" + +void testChangePrognameInMysyslog(void); +void testOpenLogfileTest(void); + + +//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()"); //%m will print the last errno? +} + +//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! + +} + + +//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"; + + remove("testLogfile2.log"); + + sntp_init_logging(testName); + open_logfile("testLogfile2.log"); // ./ causing issues + //sntp_init_logging(testName); + + + msyslog(LOG_ERR, testString); + FILE * f = fopen("testLogfile2.log","r"); + char line[256]; + + //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. +} + + diff --git a/contrib/ntp/sntp/tests/utilities.c b/contrib/ntp/sntp/tests/utilities.c index 65be8df..39d22d6 100644 --- a/contrib/ntp/sntp/tests/utilities.c +++ b/contrib/ntp/sntp/tests/utilities.c @@ -2,18 +2,31 @@ #include "sntptest.h" #include "fileHandlingTest.h" - #include "main.h" #include "utilities.h" -#include "math.h" #include "unity.h" -const char * Version = "stub unit test Version string"; +#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); -sockaddr_u CreateSockaddr4(const char* address) { +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); @@ -22,7 +35,9 @@ sockaddr_u CreateSockaddr4(const char* address) { return s; } -struct addrinfo CreateAddrinfo( sockaddr_u* sock) { + +struct addrinfo +CreateAddrinfo(sockaddr_u* sock) { struct addrinfo a; a.ai_family = sock->sa.sa_family; a.ai_addrlen = SIZEOF_SOCKADDR(a.ai_family); @@ -34,26 +49,28 @@ struct addrinfo CreateAddrinfo( sockaddr_u* sock) { bool outputFileOpened; FILE* outputFile; -//debugUtilitiesTest() : outputFileOpened(false) {} -void InitDebugTest(const char * filename) { +void +InitDebugTest(const char * filename) { // Clear the contents of the current file. // Open the output file outputFile = fopen(filename, "w+"); - TEST_ASSERT_TRUE(outputFile != NULL); + TEST_ASSERT_NOT_NULL(outputFile); outputFileOpened = true; } + // Closes outputFile, and compare contents. -void FinishDebugTest(const char * expected, +void +FinishDebugTest(const char * expected, const char * actual) { if (outputFileOpened) fclose(outputFile); FILE * e = fopen(expected,"rb"); FILE * a = fopen(actual,"rb"); - TEST_ASSERT_TRUE(e != NULL); - TEST_ASSERT_TRUE(a != NULL); + TEST_ASSERT_NOT_NULL(e); + TEST_ASSERT_NOT_NULL(a); CompareFileContent(e, a); } @@ -65,7 +82,8 @@ void FinishDebugTest(const char * expected, * tests can be removed. */ -void test_IPv4Address() { +void +test_IPv4Address(void) { const char* ADDR = "192.0.2.10"; sockaddr_u input = CreateSockaddr4(ADDR); @@ -75,7 +93,9 @@ void test_IPv4Address() { TEST_ASSERT_EQUAL_STRING(ADDR, addrinfo_to_str(&inputA)); } -void test_IPv6Address() { + +void +test_IPv6Address(void) { const struct in6_addr address = { 0x20, 0x01, 0x0d, 0xb8, 0x85, 0xa3, 0x08, 0xd3, @@ -95,7 +115,9 @@ void test_IPv6Address() { TEST_ASSERT_EQUAL_STRING(expected, addrinfo_to_str(&inputA)); } -void test_SetLiVnMode1() { + +void +test_SetLiVnMode1(void) { struct pkt expected; expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOWARNING, NTP_VERSION, @@ -108,7 +130,9 @@ void test_SetLiVnMode1() { TEST_ASSERT_EQUAL(expected.li_vn_mode, actual.li_vn_mode); } -void test_SetLiVnMode2() { + +void +test_SetLiVnMode2(void) { struct pkt expected; expected.li_vn_mode = PKT_LI_VN_MODE(LEAP_NOTINSYNC, NTP_OLDVERSION, @@ -123,8 +147,9 @@ void test_SetLiVnMode2() { /* Debug utilities tests */ -void test_PktOutput() { - char * filename = "debug-output-pkt";//CreatePath("debug-output-pkt", OUTPUT_DIR); +void +test_PktOutput(void) { + char * filename = "debug-output-pkt"; InitDebugTest(filename); struct pkt testpkt; @@ -143,7 +168,9 @@ void test_PktOutput() { FinishDebugTest(CreatePath("debug-input-pkt", INPUT_DIR), filename); } -void test_LfpOutputBinaryFormat() { + +void +test_LfpOutputBinaryFormat(void) { char * filename = "debug-output-lfp-bin";//CreatePath("debug-output-lfp-bin", OUTPUT_DIR); InitDebugTest(filename); @@ -159,8 +186,10 @@ void test_LfpOutputBinaryFormat() { FinishDebugTest(CreatePath("debug-input-lfp-bin", INPUT_DIR), filename); } -void test_LfpOutputDecimalFormat() { - char * filename = "debug-output-lfp-dec"; //CreatePath("debug-output-lfp-dec", OUTPUT_DIR); + +void +test_LfpOutputDecimalFormat(void) { + char * filename = "debug-output-lfp-dec"; InitDebugTest(filename); l_fp test; @@ -174,4 +203,3 @@ void test_LfpOutputDecimalFormat() { FinishDebugTest(CreatePath("debug-input-lfp-dec", INPUT_DIR), filename); } - diff --git a/contrib/ntp/sntp/tests_main.cpp b/contrib/ntp/sntp/tests_main.cpp deleted file mode 100644 index 584165d..0000000 --- a/contrib/ntp/sntp/tests_main.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "tests_main.h" - -extern "C" { -const char * Version = "stub unit test Version string"; -}; - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - - init_lib(); - init_auth(); - - // Some tests makes use of extra parameters passed to the tests - // executable. Save these params as static members of the base class. - if (argc > 1) { - ntptest::SetExtraParams(1, argc-1, argv); - } - - return RUN_ALL_TESTS(); -} - -std::vector<std::string> ntptest::m_params; - -void ntptest::SetExtraParams(int start, int count, char** argv) -{ - for (int i=0; i<count; i++) { - m_params.push_back(argv[i+start]); - } -} diff --git a/contrib/ntp/sntp/tests_main.h b/contrib/ntp/sntp/tests_main.h deleted file mode 100644 index 991f4b6..0000000 --- a/contrib/ntp/sntp/tests_main.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TESTS_MAIN_H -#define TESTS_MAIN_H - -#include "config.h" - -#include <string> -#include <vector> - -#include <gtest/gtest.h> - -extern "C" { -#include "ntp_stdlib.h" -} - -class ntptest : public ::testing::Test { -public: - static void SetExtraParams(int start, int count, char** argv); -protected: - static std::vector<std::string> m_params; -}; - -#endif // TESTS_MAIN_H diff --git a/contrib/ntp/sntp/unity/Makefile.am b/contrib/ntp/sntp/unity/Makefile.am index a09e36e..31029ff 100644 --- a/contrib/ntp/sntp/unity/Makefile.am +++ b/contrib/ntp/sntp/unity/Makefile.am @@ -6,18 +6,20 @@ CLEANFILES = noinst_LIBRARIES = libunity.a libunity_a_CFLAGS = \ - -DUNITY_INCLUDE_DOUBLE \ + -DUNITY_INCLUDE_CONFIG_H \ $(NULL) libunity_a_SOURCES = \ ../libpkgver/colcomp.c \ unity.c \ unity.h \ + unity_config.h \ unity_internals.h \ unity_fixture.c \ unity_fixture.h \ unity_fixture_internals.h \ unity_fixture_malloc_overrides.h \ + unity_config.h \ $(NULL) include $(top_srcdir)/depsver.mf diff --git a/contrib/ntp/sntp/unity/Makefile.in b/contrib/ntp/sntp/unity/Makefile.in index 956ff1e..a5758b4 100644 --- a/contrib/ntp/sntp/unity/Makefile.in +++ b/contrib/ntp/sntp/unity/Makefile.in @@ -213,6 +213,7 @@ 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@ @@ -221,6 +222,7 @@ CALC_TICKADJ_NI = @CALC_TICKADJ_NI@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAGS_LIBEVENT = @CFLAGS_LIBEVENT@ CFLAGS_NTP = @CFLAGS_NTP@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ @@ -274,6 +276,7 @@ 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@ @@ -443,18 +446,20 @@ BUILT_SOURCES = .deps-ver CLEANFILES = .deps-ver noinst_LIBRARIES = libunity.a libunity_a_CFLAGS = \ - -DUNITY_INCLUDE_DOUBLE \ + -DUNITY_INCLUDE_CONFIG_H \ $(NULL) libunity_a_SOURCES = \ ../libpkgver/colcomp.c \ unity.c \ unity.h \ + unity_config.h \ unity_internals.h \ unity_fixture.c \ unity_fixture.h \ unity_fixture_internals.h \ unity_fixture_malloc_overrides.h \ + unity_config.h \ $(NULL) SNTP_INCS = -I$(top_srcdir)/../include \ diff --git a/contrib/ntp/sntp/unity/auto/generate_test_runner.rb b/contrib/ntp/sntp/unity/auto/generate_test_runner.rb index c115fad..5b1d451 100644 --- a/contrib/ntp/sntp/unity/auto/generate_test_runner.rb +++ b/contrib/ntp/sntp/unity/auto/generate_test_runner.rb @@ -2,28 +2,44 @@ # Unity Project - A Test Framework for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] -# ========================================== +# ========================================== +$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i } File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt')) class UnityTestRunnerGenerator def initialize(options = nil) - @options = { :includes => [], :plugins => [], :framework => :unity } + @options = UnityTestRunnerGenerator.default_options + case(options) when NilClass then @options when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options)) when Hash then @options.merge!(options) else raise "If you specify arguments, it should be a filename or a hash of options" end + require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer" + end + + def self.default_options + { + :includes => [], + :plugins => [], + :framework => :unity, + :test_prefix => "test|spec|should", + :setup_name => "setUp", + :teardown_name => "tearDown", + } end - + + def self.grab_config(config_file) - options = { :includes => [], :plugins => [], :framework => :unity } + options = self.default_options + unless (config_file.nil? or config_file.empty?) require 'yaml' yaml_guts = YAML.load_file(config_file) - options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock]) + options.merge!(yaml_guts[:unity] || yaml_guts[:cmock]) raise "No :unity or :cmock section found in #{config_file}" unless options end return(options) @@ -31,126 +47,167 @@ class UnityTestRunnerGenerator def run(input_file, output_file, options=nil) tests = [] - includes = [] + testfile_includes = [] used_mocks = [] - + + @options.merge!(options) unless options.nil? module_name = File.basename(input_file) - + + #pull required data from source file - File.open(input_file, 'r') do |input| - tests = find_tests(input) - includes = find_includes(input) - used_mocks = find_mocks(includes) - end + source = File.read(input_file) + source = source.force_encoding("ISO-8859-1").encode("utf-8", :replace => nil) if ($QUICK_RUBY_VERSION > 10900) + tests = find_tests(source) + headers = find_includes(source) + testfile_includes = headers[:local] + headers[:system] + used_mocks = find_mocks(testfile_includes) + #build runner file + generate(input_file, output_file, tests, used_mocks, testfile_includes) + + #determine which files were used to return them + all_files_used = [input_file, output_file] + all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty? + all_files_used += @options[:includes] unless @options[:includes].empty? + return all_files_used.uniq + end + + def generate(input_file, output_file, tests, used_mocks, testfile_includes) File.open(output_file, 'w') do |output| - create_header(output, used_mocks) + create_header(output, used_mocks, testfile_includes) create_externs(output, tests, used_mocks) create_mock_management(output, used_mocks) create_suite_setup_and_teardown(output) create_reset(output, used_mocks) - create_main(output, input_file, tests) + create_main(output, input_file, tests, used_mocks) end - - all_files_used = [input_file, output_file] - all_files_used += includes.map {|filename| filename + '.c'} unless includes.empty? - all_files_used += @options[:includes] unless @options[:includes].empty? - return all_files_used.uniq + + + + + end - - def find_tests(input_file) - tests_raw = [] - tests_args = [] + + + def find_tests(source) + + tests_and_line_numbers = [] - - input_file.rewind - source_raw = input_file.read - source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments + + + + + source_scrubbed = source.gsub(/\/\/.*$/, '') # remove line comments source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line | (;|\{|\}) /x) # Match ;, {, and } as end of lines lines.each_with_index do |line, index| #find tests - if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/ + arguments = $1 name = $2 call = $3 - args = (@options[:use_param_tests] and $1) ? ($1.gsub(/\s*TEST_CASE\s*\(\s*/,'').strip.split(/\s*\)/).compact) : nil - tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } - tests_args = [] + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end + tests_and_line_numbers << { :test => name, :args => args, :call => call, :line_number => 0 } + end end + tests_and_line_numbers.uniq! {|v| v[:test] } #determine line numbers and create tests to run - source_lines = source_raw.split("\n") + source_lines = source.split("\n") source_index = 0; tests_and_line_numbers.size.times do |i| source_lines[source_index..-1].each_with_index do |line, index| - if (line =~ /#{tests_and_line_numbers[i][:name]}/) + if (line =~ /#{tests_and_line_numbers[i][:test]}/) source_index += index tests_and_line_numbers[i][:line_number] = source_index + 1 break end end end - + + return tests_and_line_numbers end - def find_includes(input_file) - input_file.rewind - includes = [] - input_file.readlines.each do |line| - scan_results = line.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/) - includes << scan_results[0][0] if (scan_results.size > 0) - end + def find_includes(source) + + #remove comments (block and line, in three steps to ensure correct precedence) + source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks + source.gsub!(/\/\*.*?\*\//m, '') # remove block comments + source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain) + + #parse out includes + + includes = { + + :local => source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten, + :system => source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" } + } + + return includes end - + + def find_mocks(includes) mock_headers = [] includes.each do |include_file| mock_headers << File.basename(include_file) if (include_file =~ /^mock/i) end - return mock_headers + return mock_headers end - - def create_header(output, mocks) + + + def create_header(output, mocks, testfile_includes=[]) output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */') create_runtest(output, mocks) output.puts("\n//=======Automagically Detected Files To Include=====") output.puts("#include \"#{@options[:framework].to_s}.h\"") output.puts('#include "cmock.h"') unless (mocks.empty?) - @options[:includes].flatten.uniq.compact.each do |includes| - output.puts("#include \"#{includes.gsub('.h','')}.h\"") + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") end output.puts('#include <setjmp.h>') output.puts('#include <stdio.h>') output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception) + testfile_includes.delete_if{|inc| inc =~ /(unity|cmock)/} + testrunner_includes = testfile_includes - mocks + testrunner_includes.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") + end mocks.each do |mock| output.puts("#include \"#{mock.gsub('.h','')}.h\"") end if @options[:enforce_strict_ordering] - output.puts('') - output.puts('int GlobalExpectCount;') - output.puts('int GlobalVerifyOrder;') - output.puts('char* GlobalOrderError;') + output.puts('') + output.puts('int GlobalExpectCount;') + output.puts('int GlobalVerifyOrder;') + output.puts('char* GlobalOrderError;') end end - + + def create_externs(output, tests, mocks) output.puts("\n//=======External Functions This Runner Calls=====") - output.puts("extern void setUp(void);") - output.puts("extern void tearDown(void);") - output.puts("void resetTest(void);") + output.puts("extern void #{@options[:setup_name]}(void);") + output.puts("extern void #{@options[:teardown_name]}(void);") + tests.each do |test| - output.puts("extern void #{test[:name]}(#{test[:call]});") + output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});") end output.puts('') end - + + def create_mock_management(output, mocks) unless (mocks.empty?) output.puts("\n//=======Mock Management=====") @@ -158,30 +215,34 @@ class UnityTestRunnerGenerator output.puts("{") if @options[:enforce_strict_ordering] output.puts(" GlobalExpectCount = 0;") - output.puts(" GlobalVerifyOrder = 0;") - output.puts(" GlobalOrderError = NULL;") + output.puts(" GlobalVerifyOrder = 0;") + output.puts(" GlobalOrderError = NULL;") end mocks.each do |mock| - output.puts(" #{mock}_Init();") + mock_clean = TypeSanitizer.sanitize_c_identifier(mock) + output.puts(" #{mock_clean}_Init();") end output.puts("}\n") output.puts("static void CMock_Verify(void)") output.puts("{") mocks.each do |mock| - output.puts(" #{mock}_Verify();") + mock_clean = TypeSanitizer.sanitize_c_identifier(mock) + output.puts(" #{mock_clean}_Verify();") end output.puts("}\n") output.puts("static void CMock_Destroy(void)") output.puts("{") mocks.each do |mock| - output.puts(" #{mock}_Destroy();") + mock_clean = TypeSanitizer.sanitize_c_identifier(mock) + output.puts(" #{mock_clean}_Destroy();") end output.puts("}\n") end end - + + def create_suite_setup_and_teardown(output) unless (@options[:suite_setup].nil?) output.puts("\n//=======Suite Setup=====") @@ -198,78 +259,91 @@ class UnityTestRunnerGenerator output.puts("}") end end - + + def create_runtest(output, used_mocks) cexception = @options[:plugins].include? :cexception va_args1 = @options[:use_param_tests] ? ', ...' : '' va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' output.puts("\n//=======Test Runner Used To Run Each Test Below=====") - output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") output.puts("{ \\") output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\") output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\") output.puts(" Unity.NumberOfTests++; \\") + output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) output.puts(" if (TEST_PROTECT()) \\") output.puts(" { \\") output.puts(" CEXCEPTION_T e; \\") if cexception output.puts(" Try { \\") if cexception - output.puts(" CMock_Init(); \\") unless (used_mocks.empty?) - output.puts(" setUp(); \\") + output.puts(" #{@options[:setup_name]}(); \\") + + output.puts(" TestFunc(#{va_args2}); \\") - output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception output.puts(" } \\") - output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) + output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\") output.puts(" { \\") - output.puts(" tearDown(); \\") + output.puts(" #{@options[:teardown_name]}(); \\") + output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?) + output.puts(" } \\") + output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?) output.puts(" UnityConcludeTest(); \\") output.puts("}\n") end - + + def create_reset(output, used_mocks) output.puts("\n//=======Test Reset Option=====") - output.puts("void resetTest()") + output.puts("void resetTest(void);") + output.puts("void resetTest(void)") + output.puts("{") output.puts(" CMock_Verify();") unless (used_mocks.empty?) output.puts(" CMock_Destroy();") unless (used_mocks.empty?) - output.puts(" tearDown();") - output.puts(" CMock_Init();") unless (used_mocks.empty?) - output.puts(" setUp();") + output.puts(" #{@options[:teardown_name]}();") + + output.puts(" CMock_Init();") unless (used_mocks.empty?) + output.puts(" #{@options[:setup_name]}();") + output.puts("}") end - - def create_main(output, filename, tests) - output.puts("\nchar *progname;\n") + + + def create_main(output, filename, tests, used_mocks) + output.puts("\nchar const *progname;\n") output.puts("\n\n//=======MAIN=====") - + output.puts("int main(int argc, char *argv[])") output.puts("{") - #new stuff added - #output.puts("\nu_long current_time = 4; // needed by authkeys. Used only in to calculate lifetime.\n"); - - output.puts(" progname = argv[0];\n") - #not necessary after all - #output.puts(" init_lib();\n") - #output.puts(" init_auth();\n") + output.puts(" progname = argv[0];\n") + + + + + + output.puts(" suite_setup();") unless @options[:suite_setup].nil? - output.puts(" Unity.TestFile = \"#{filename}\";") + output.puts(" UnityBegin(\"#{filename}\");") if (@options[:use_param_tests]) tests.each do |test| if ((test[:args].nil?) or (test[:args].empty?)) - output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") else - test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")} end end else - tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } + tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") } end output.puts() + output.puts(" CMock_Guts_MemFreeFinal();") unless used_mocks.empty? output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") output.puts("}") end @@ -279,31 +353,56 @@ end if ($0 == __FILE__) options = { :includes => [] } yaml_file = nil - - #parse out all the options first - ARGV.reject! do |arg| + + + #parse out all the options first (these will all be removed as we go) + ARGV.reject! do |arg| case(arg) - when '-cexception' + when '-cexception' options[:plugins] = [:cexception]; true - when /\w+\.yml/ + when /\.*\.ya?ml/ + options = UnityTestRunnerGenerator.grab_config(arg); true + when /\.*\.h/ + options[:includes] << arg; true + when /--(\w+)=\"?(.*)\"?/ + options[$1.to_sym] = $2; true else false end - end - + end + + #make sure there is at least one parameter left (the input file) if !ARGV[0] - puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)", - " blah.yml - will use config options in the yml file (see docs)", - " -cexception - include cexception support"].join("\n") + puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)", + "\n input_test_file - this is the C file you want to create a runner for", + " output - this is the name of the runner file to generate", + " defaults to (input_test_file)_Runner", + " files:", + " *.yml / *.yaml - loads configuration from here in :unity or :cmock", + " *.h - header files are added as #includes in runner", + " options:", + + " -cexception - include cexception support", + " --setup_name=\"\" - redefine setUp func name to something else", + " --teardown_name=\"\" - redefine tearDown func name to something else", + " --test_prefix=\"\" - redefine test prefix from default test|spec|should", + " --suite_setup=\"\" - code to execute for setup of entire suite", + " --suite_teardown=\"\" - code to execute for teardown of entire suite", + " --use_param_tests=1 - enable parameterized tests (disabled by default)", + ].join("\n") exit 1 end - + + #create the default test runner name if not specified ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) - - #everything else is an include file - options[:includes] = (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) - + + + + + + UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) end + diff --git a/contrib/ntp/sntp/unity/auto/parseOutput.rb b/contrib/ntp/sntp/unity/auto/parseOutput.rb new file mode 100755 index 0000000..7ea180f --- /dev/null +++ b/contrib/ntp/sntp/unity/auto/parseOutput.rb @@ -0,0 +1,191 @@ +#============================================================ +# Author: John Theofanopoulos +# A simple parser. Takes the output files generated during the build process and +# extracts information relating to the tests. +# +# Notes: +# To capture an output file under VS builds use the following: +# devenv [build instructions] > Output.txt & type Output.txt +# +# To capture an output file under GCC/Linux builds use the following: +# make | tee Output.txt +# +# To use this parser use the following command +# ruby parseOutput.rb [options] [file] +# options: -xml : produce a JUnit compatible XML file +# file : file to scan for results +#============================================================ + + +class ParseOutput +# The following flag is set to true when a test is found or false otherwise. + @testFlag + @xmlOut + @arrayList + @totalTests + @classIndex + +# Set the flag to indicate if there will be an XML output file or not + def setXmlOutput() + @xmlOut = true + end + +# if write our output to XML + def writeXmlOuput() + output = File.open("report.xml", "w") + output << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + @arrayList.each do |item| + output << item << "\n" + end + output << "</testsuite>\n" + end + +# This function will try and determine when the suite is changed. This is +# is the name that gets added to the classname parameter. + def testSuiteVerify(testSuiteName) + if @testFlag == false + @testFlag = true; + # Split the path name + testName = testSuiteName.split("/") + # Remove the extension + baseName = testName[testName.size - 1].split(".") + @testSuite = "test." + baseName[0] + printf "New Test: %s\n", @testSuite + end + end + + +# Test was flagged as having passed so format the output + def testPassed(array) + lastItem = array.length - 1 + testName = array[lastItem - 1] + testSuiteVerify(array[@className]) + printf "%-40s PASS\n", testName + if @xmlOut == true + @arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\"/>" + end + end + +# Test was flagged as being ingored so format the output + def testIgnored(array) + lastItem = array.length - 1 + testName = array[lastItem - 2] + reason = array[lastItem].chomp + testSuiteVerify(array[@className]) + printf "%-40s IGNORED\n", testName + if @xmlOut == true + @arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">" + @arrayList.push " <skipped type=\"TEST IGNORED\"> " + reason + " </skipped>" + @arrayList.push " </testcase>" + end + end + +# Test was flagged as having failed so format the line + def testFailed(array) + lastItem = array.length - 1 + testName = array[lastItem - 2] + reason = array[lastItem].chomp + " at line: " + array[lastItem - 3] + testSuiteVerify(array[@className]) + printf "%-40s FAILED\n", testName + if @xmlOut == true + @arrayList.push " <testcase classname=\"" + @testSuite + "\" name=\"" + testName + "\">" + @arrayList.push " <failure type=\"ASSERT FAILED\"> " + reason + " </failure>" + @arrayList.push " </testcase>" + end + end + + +# Figure out what OS we are running on. For now we are assuming if it's not Windows it must +# be Unix based. + def detectOS() + myOS = RUBY_PLATFORM.split("-") + if myOS.size == 2 + if myOS[1] == "mingw32" + @className = 1 + else + @className = 0 + end + else + @className = 0 + end + + end + +# Main function used to parse the file that was captured. + def process(name) + @testFlag = false + @arrayList = Array.new + + detectOS() + + puts "Parsing file: " + name + + + testPass = 0 + testFail = 0 + testIgnore = 0 + puts "" + puts "=================== RESULTS =====================" + puts "" + File.open(name).each do |line| + # Typical test lines look like this: + # <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0 + # <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented + # <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS + # + # where path is different on Unix vs Windows devices (Windows leads with a drive letter) + lineArray = line.split(":") + lineSize = lineArray.size + # If we were able to split the line then we can look to see if any of our target words + # were found. Case is important. + if lineSize >= 4 + # Determine if this test passed + if line.include? ":PASS" + testPassed(lineArray) + testPass += 1 + elsif line.include? ":FAIL:" + testFailed(lineArray) + testFail += 1 + elsif line.include? ":IGNORE:" + testIgnored(lineArray) + testIgnore += 1 + # If none of the keywords are found there are no more tests for this suite so clear + # the test flag + else + @testFlag = false + end + else + @testFlag = false + end + end + puts "" + puts "=================== SUMMARY =====================" + puts "" + puts "Tests Passed : " + testPass.to_s + puts "Tests Failed : " + testFail.to_s + puts "Tests Ignored : " + testIgnore.to_s + @totalTests = testPass + testFail + testIgnore + if @xmlOut == true + heading = "<testsuite tests=\"" + @totalTests.to_s + "\" failures=\"" + testFail.to_s + "\"" + " skips=\"" + testIgnore.to_s + "\">" + @arrayList.insert(0, heading) + writeXmlOuput() + end + + # return result + end + + end + +# If the command line has no values in, used a default value of Output.txt +parseMyFile = ParseOutput.new + +if ARGV.size >= 1 + ARGV.each do |a| + if a == "-xml" + parseMyFile.setXmlOutput(); + else + parseMyFile.process(a) + break + end + end +end diff --git a/contrib/ntp/sntp/unity/auto/type_sanitizer.rb b/contrib/ntp/sntp/unity/auto/type_sanitizer.rb new file mode 100755 index 0000000..7c2c0ac --- /dev/null +++ b/contrib/ntp/sntp/unity/auto/type_sanitizer.rb @@ -0,0 +1,8 @@ +module TypeSanitizer + + def self.sanitize_c_identifier(unsanitized) + # convert filename to valid C identifier by replacing invalid chars with '_' + return unsanitized.gsub(/[-\/\\\.\,\s]/, "_") + end + +end diff --git a/contrib/ntp/sntp/unity/auto/unity_test_summary.py b/contrib/ntp/sntp/unity/auto/unity_test_summary.py new file mode 100755 index 0000000..c64f6c5 --- /dev/null +++ b/contrib/ntp/sntp/unity/auto/unity_test_summary.py @@ -0,0 +1,135 @@ +#! python3 +# ========================================== +# Unity Project - A Test Framework for C +# Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de +# [Released under MIT License. Please refer to license.txt for details] +# Based on the ruby script by Mike Karlesky, Mark VanderVoord, Greg Williams +# ========================================== +import sys +import os +import re +from glob import glob + +class UnityTestSummary: + def __init__(self): + self.report = '' + self.total_tests = 0 + self.failures = 0 + self.ignored = 0 + + def run(self): + # Clean up result file names + results = [] + for target in self.targets: + results.append(target.replace('\\', '/')) + + # Dig through each result file, looking for details on pass/fail: + failure_output = [] + ignore_output = [] + + for result_file in results: + lines = list(map(lambda line: line.rstrip(), open(result_file, "r").read().split('\n'))) + if len(lines) == 0: + raise Exception("Empty test result file: %s" % result_file) + + details = self.get_details(result_file, lines) + failures = details['failures'] + ignores = details['ignores'] + if len(failures) > 0: failure_output.append('\n'.join(failures)) + if len(ignores) > 0: ignore_output.append('n'.join(ignores)) + tests,failures,ignored = self.parse_test_summary('\n'.join(lines)) + self.total_tests += tests + self.failures += failures + self.ignored += ignored + + if self.ignored > 0: + self.report += "\n" + self.report += "--------------------------\n" + self.report += "UNITY IGNORED TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += "\n".join(ignore_output) + + if self.failures > 0: + self.report += "\n" + self.report += "--------------------------\n" + self.report += "UNITY FAILED TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += '\n'.join(failure_output) + + self.report += "\n" + self.report += "--------------------------\n" + self.report += "OVERALL UNITY TEST SUMMARY\n" + self.report += "--------------------------\n" + self.report += "{total_tests} TOTAL TESTS {failures} TOTAL FAILURES {ignored} IGNORED\n".format(total_tests = self.total_tests, failures=self.failures, ignored=self.ignored) + self.report += "\n" + + return self.report + + def set_targets(self, target_array): + self.targets = target_array + + def set_root_path(self, path): + self.root = path + + def usage(self, err_msg=None): + print("\nERROR: ") + if err_msg: + print(err_msg) + print("\nUsage: unity_test_summary.rb result_file_directory/ root_path/") + print(" result_file_directory - The location of your results files.") + print(" Defaults to current directory if not specified.") + print(" Should end in / if specified.") + print(" root_path - Helpful for producing more verbose output if using relative paths.") + sys.exit(1) + + def get_details(self, result_file, lines): + results = { 'failures': [], 'ignores': [], 'successes': [] } + for line in lines: + parts = line.split(':') + if len(parts) != 5: + continue + src_file,src_line,test_name,status,msg = parts + if len(self.root) > 0: + line_out = "%s%s" % (self.root, line) + else: + line_out = line + if status == 'IGNORE': + results['ignores'].append(line_out) + elif status == 'FAIL': + results['failures'].append(line_out) + elif status == 'PASS': + results['successes'].append(line_out) + return results + + def parse_test_summary(self, summary): + m = re.search(r"([0-9]+) Tests ([0-9]+) Failures ([0-9]+) Ignored", summary) + if not m: + raise Exception("Couldn't parse test results: %s" % summary) + + return int(m.group(1)), int(m.group(2)), int(m.group(3)) + + +if __name__ == '__main__': + uts = UnityTestSummary() + try: + #look in the specified or current directory for result files + if len(sys.argv) > 1: + targets_dir = sys.argv[1] + else: + targets_dir = './' + targets = list(map(lambda x: x.replace('\\', '/'), glob(targets_dir + '*.test*'))) + if len(targets) == 0: + raise Exception("No *.testpass or *.testfail files found in '%s'" % targets_dir) + uts.set_targets(targets) + + #set the root path + if len(sys.argv) > 2: + root_path = sys.argv[2] + else: + root_path = os.path.split(__file__)[0] + uts.set_root_path(root_path) + + #run the summarizer + print(uts.run()) + except Exception as e: + uts.usage(e) diff --git a/contrib/ntp/sntp/unity/auto/unity_test_summary.rb b/contrib/ntp/sntp/unity/auto/unity_test_summary.rb index 69ec2e8..78d727e 100644 --- a/contrib/ntp/sntp/unity/auto/unity_test_summary.rb +++ b/contrib/ntp/sntp/unity/auto/unity_test_summary.rb @@ -2,7 +2,7 @@ # Unity Project - A Test Framework for C # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams # [Released under MIT License. Please refer to license.txt for details] -# ========================================== +# ========================================== #!/usr/bin/ruby # @@ -15,22 +15,24 @@ class UnityTestSummary include FileUtils::Verbose attr_reader :report, :total_tests, :failures, :ignored - - def initialize + + def initialize(opts = {}) @report = '' @total_tests = 0 @failures = 0 @ignored = 0 + + end - + def run # Clean up result file names results = @targets.map {|target| target.gsub(/\\/,'/')} - - # Dig through each result file, looking for details on pass/fail: + + # Dig through each result file, looking for details on pass/fail: failure_output = [] ignore_output = [] - + results.each do |result_file| lines = File.readlines(result_file).map { |line| line.chomp } if lines.length == 0 @@ -45,7 +47,7 @@ class UnityTestSummary @ignored += ignored end end - + if @ignored > 0 @report += "\n" @report += "--------------------------\n" @@ -53,7 +55,7 @@ class UnityTestSummary @report += "--------------------------\n" @report += ignore_output.flatten.join("\n") end - + if @failures > 0 @report += "\n" @report += "--------------------------\n" @@ -61,7 +63,7 @@ class UnityTestSummary @report += "--------------------------\n" @report += failure_output.flatten.join("\n") end - + @report += "\n" @report += "--------------------------\n" @report += "OVERALL UNITY TEST SUMMARY\n" @@ -69,32 +71,33 @@ class UnityTestSummary @report += "#{@total_tests} TOTAL TESTS #{@failures} TOTAL FAILURES #{@ignored} IGNORED\n" @report += "\n" end - + def set_targets(target_array) @targets = target_array end - + def set_root_path(path) @root = path end def usage(err_msg=nil) + puts "\nERROR: " puts err_msg if err_msg - puts "Usage: unity_test_summary.rb" + puts "\nUsage: unity_test_summary.rb result_file_directory/ root_path/" + puts " result_file_directory - The location of your results files." + puts " Defaults to current directory if not specified." + puts " Should end in / if specified." + puts " root_path - Helpful for producing more verbose output if using relative paths." exit 1 end - + protected - - @@targets=nil - @@path=nil - @@root=nil def get_details(result_file, lines) results = { :failures => [], :ignores => [], :successes => [] } lines.each do |line| src_file,src_line,test_name,status,msg = line.split(/:/) - line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") + line_out = ((@root && (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\") case(status) when 'IGNORE' then results[:ignores] << line_out when 'FAIL' then results[:failures] << line_out @@ -103,9 +106,9 @@ class UnityTestSummary end return results end - + def parse_test_summary(summary) - if summary[-3..-1].join("\n") =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ + if summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ } [$1.to_i,$2.to_i,$3.to_i] else raise "Couldn't parse test results: #{summary}" @@ -113,14 +116,34 @@ class UnityTestSummary end def here; File.expand_path(File.dirname(__FILE__)); end - + end if $0 == __FILE__ - script = UnityTestSummary.new + + #parse out the command options + opts, args = ARGV.partition {|v| v =~ /^--\w+/} + opts.map! {|v| v[2..-1].to_sym } + + #create an instance to work with + uts = UnityTestSummary.new(opts) + begin - script.run + #look in the specified or current directory for result files + args[0] ||= './' + targets = "#{ARGV[0].gsub(/\\/, '/')}**/*.test*" + results = Dir[targets] + raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty? + uts.set_targets(results) + + #set the root path + args[1] ||= Dir.pwd + '/' + uts.set_root_path(ARGV[1]) + + #run the summarizer + puts uts.run rescue Exception => e - script.usage e.message + uts.usage e.message end end + diff --git a/contrib/ntp/sntp/unity/unity.c b/contrib/ntp/sntp/unity/unity.c index cbdef3b..0161f8f 100644 --- a/contrib/ntp/sntp/unity/unity.c +++ b/contrib/ntp/sntp/unity/unity.c @@ -327,16 +327,14 @@ void UnityConcludeTest(void) } printf("| "); - printf(Unity.XFAILMessage); + printf("%s", Unity.XFAILMessage); Unity.XFAILMessage = NULL; } else { printf(" - EXPECTED FAIL!"); } - } - else if (Unity.CurrentTestIgnored) diff --git a/contrib/ntp/sntp/unity/unity_config.h b/contrib/ntp/sntp/unity/unity_config.h new file mode 100644 index 0000000..25418bd --- /dev/null +++ b/contrib/ntp/sntp/unity/unity_config.h @@ -0,0 +1,12 @@ +/* unity_config.h */ + +#ifndef UNITY_CONFIG_H +#define UNITY_CONFIG_H + +#define UNITY_INCLUDE_DOUBLE + +#ifndef HAVE_STDINT_H +# define UNITY_EXCLUDE_STDINT_H +#endif + +#endif /* UNITY_CONFIG_H */ diff --git a/contrib/ntp/sntp/unity/unity_internals.h b/contrib/ntp/sntp/unity/unity_internals.h index a38e101..c2aabc3 100644 --- a/contrib/ntp/sntp/unity/unity_internals.h +++ b/contrib/ntp/sntp/unity/unity_internals.h @@ -82,22 +82,22 @@ // UNITY_INT_WIDTH. #ifndef UNITY_POINTER_WIDTH #ifdef UINTPTR_MAX - #if (UINTPTR_MAX <= 0xFFFF) + #if (UINTPTR_MAX+0 <= 0xFFFF) #define UNITY_POINTER_WIDTH (16) - #elif (UINTPTR_MAX <= 0xFFFFFFFF) + #elif (UINTPTR_MAX+0 <= 0xFFFFFFFF) #define UNITY_POINTER_WIDTH (32) - #elif (UINTPTR_MAX <= 0xFFFFFFFFFFFFFFFF) + #elif (UINTPTR_MAX+0 <= 0xFFFFFFFFFFFFFFFF) #define UNITY_POINTER_WIDTH (64) #endif #endif #endif #ifndef UNITY_POINTER_WIDTH #ifdef INTPTR_MAX - #if (INTPTR_MAX <= 0x7FFF) + #if (INTPTR_MAX+0 <= 0x7FFF) #define UNITY_POINTER_WIDTH (16) - #elif (INTPTR_MAX <= 0x7FFFFFFF) + #elif (INTPTR_MAX+0 <= 0x7FFFFFFF) #define UNITY_POINTER_WIDTH (32) - #elif (INTPTR_MAX <= 0x7FFFFFFFFFFFFFFF) + #elif (INTPTR_MAX+0 <= 0x7FFFFFFFFFFFFFFF) #define UNITY_POINTER_WIDTH (64) #endif #endif diff --git a/contrib/ntp/sntp/version.c b/contrib/ntp/sntp/version.c index 885dd31..4c87128 100644 --- a/contrib/ntp/sntp/version.c +++ b/contrib/ntp/sntp/version.c @@ -2,4 +2,4 @@ * version file for sntp */ #include <config.h> -const char * Version = "sntp 4.2.8p3-RCGO@1.3265-o Mon Jun 29 20:23:24 UTC 2015 (21)"; +const char * Version = "sntp 4.2.8p4@1.3265-o Wed Oct 21 16:41:07 UTC 2015 (25)"; |