diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
commit | f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch) | |
tree | 49e44c6f87febed37efb953ab5485aa49f6481a7 /src/lib/log/tests | |
parent | Initial commit. (diff) | |
download | isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.tar.xz isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.zip |
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/lib/log/tests')
33 files changed, 5503 insertions, 0 deletions
diff --git a/src/lib/log/tests/Makefile.am b/src/lib/log/tests/Makefile.am new file mode 100644 index 0000000..55240aa --- /dev/null +++ b/src/lib/log/tests/Makefile.am @@ -0,0 +1,158 @@ +SUBDIRS = . + +# Define the flags used in each set of tests. +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib +AM_CPPFLAGS += $(BOOST_INCLUDES) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) + +AM_CXXFLAGS = $(KEA_CXXFLAGS) + +AM_LDADD = +AM_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +AM_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la +AM_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +AM_LDADD += $(LOG4CPLUS_LIBS) $(GTEST_LDADD) + +AM_LDFLAGS = +if USE_STATIC_LINK +AM_LDFLAGS += -static +endif + +CLEANFILES = *.gcno *.gcda *.lock + +EXTRA_DIST = log_test_messages.mes + +# Helper programs used in shell tests +TEST_HELPERS = logger_example +logger_example_SOURCES = logger_example.cc +logger_example_CPPFLAGS = $(AM_CPPFLAGS) +logger_example_CXXFLAGS = $(AM_CXXFLAGS) +logger_example_LDADD = $(AM_LDADD) +logger_example_LDFLAGS = $(AM_LDFLAGS) + +TEST_HELPERS += init_logger_test +init_logger_test_SOURCES = init_logger_test.cc +init_logger_test_CPPFLAGS = $(AM_CPPFLAGS) +init_logger_test_CXXFLAGS = $(AM_CXXFLAGS) +init_logger_test_LDADD = $(AM_LDADD) +init_logger_test_LDFLAGS = $(AM_LDFLAGS) + +TEST_HELPERS += buffer_logger_test +buffer_logger_test_SOURCES = buffer_logger_test.cc +buffer_logger_test_CPPFLAGS = $(AM_CPPFLAGS) +buffer_logger_test_CXXFLAGS = $(AM_CXXFLAGS) +buffer_logger_test_LDADD = $(AM_LDADD) +buffer_logger_test_LDFLAGS = $(AM_LDFLAGS) + +TEST_HELPERS += logger_lock_test +logger_lock_test_SOURCES = logger_lock_test.cc +logger_lock_test_SOURCES += log_test_messages.cc log_test_messages.h +logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS) +logger_lock_test_CXXFLAGS = $(AM_CXXFLAGS) +logger_lock_test_LDADD = $(AM_LDADD) +logger_lock_test_LDFLAGS = $(AM_LDFLAGS) + +# Don't install helper binaries. +noinst_PROGRAMS = $(TEST_HELPERS) + +# Shell tests. These are principally tests where the global logging environment +# is affected, and where the output needs to be compared with stored output +# (where "cut" and "diff" are useful utilities). +SHTESTS = +SHTESTS += buffer_logger_test.sh +SHTESTS += console_test.sh +SHTESTS += destination_test.sh +SHTESTS += init_logger_test.sh +SHTESTS += local_file_test.sh +SHTESTS += logger_lock_test.sh +SHTESTS += severity_test.sh + +# As with every file generated by ./configure, clean them up when running +# "make distclean", but not on "make clean". +DISTCLEANFILES = tempdir.h +DISTCLEANFILES += $(SHTESTS) + +if HAVE_GTEST + +TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + +# Set of unit tests for the general logging classes +PROGRAM_TESTS = run_unittests +run_unittests_SOURCES = run_unittests.cc +run_unittests_SOURCES += log_formatter_unittest.cc +run_unittests_SOURCES += logger_level_impl_unittest.cc +run_unittests_SOURCES += logger_level_unittest.cc +run_unittests_SOURCES += logger_manager_unittest.cc +run_unittests_SOURCES += logger_name_unittest.cc +run_unittests_SOURCES += logger_support_unittest.cc +run_unittests_SOURCES += logger_unittest.cc +run_unittests_SOURCES += logger_specification_unittest.cc +run_unittests_SOURCES += message_dictionary_unittest.cc +run_unittests_SOURCES += message_reader_unittest.cc +run_unittests_SOURCES += output_option_unittest.cc +run_unittests_SOURCES += buffer_appender_unittest.cc +run_unittests_SOURCES += log_test_messages.cc log_test_messages.h +run_unittests_CPPFLAGS = $(AM_CPPFLAGS) +run_unittests_CXXFLAGS = $(AM_CXXFLAGS) +run_unittests_LDADD = $(AM_LDADD) +run_unittests_LDFLAGS = $(AM_LDFLAGS) + +# logging initialization tests. These are put in a separate program to +# ensure that the initialization status at the start of each test is known, +# and to prevent circumstances where the execution of one test affects the +# starting conditions of the next. +PROGRAM_TESTS += initializer_unittests_1 +initializer_unittests_1_SOURCES = run_initializer_unittests.cc +initializer_unittests_1_SOURCES += message_initializer_1_unittest.cc +initializer_unittests_1_SOURCES += message_initializer_1a_unittest.cc +initializer_unittests_1_CPPFLAGS = $(AM_CPPFLAGS) +initializer_unittests_1_CXXFLAGS = $(AM_CXXFLAGS) +initializer_unittests_1_LDADD = $(AM_LDADD) +initializer_unittests_1_LDFLAGS = $(AM_LDFLAGS) + +# Run C++ tests on "make check". +TESTS = $(PROGRAM_TESTS) + +# Run shell tests on "make check". +check_SCRIPTS = $(SHTESTS) +TESTS += $(SHTESTS) + +# Don't install test binaries. +noinst_PROGRAMS += $(PROGRAM_TESTS) + +endif + +# Don't install shell tests. +noinst_SCRIPTS = $(SHTESTS) + +# If we want to get rid of all generated messages files, we need to use +# make maintainer-clean. The proper way to introduce custom commands for +# that operation is to define maintainer-clean-local target. However, +# make maintainer-clean also removes Makefile, so running configure script +# is required. To make it easy to rebuild messages without going through +# reconfigure, a new target messages-clean has been added. +maintainer-clean-local: + rm -f log_test_messages.h log_test_messages.cc + +# To regenerate messages files, one can do: +# +# make messages-clean +# make messages +# +# This is needed only when a .mes file is modified. +messages-clean: maintainer-clean-local + +if GENERATE_MESSAGES + +# Define rule to build logging source files from message file +messages: log_test_messages.h log_test_messages.cc + @echo Message files regenerated + +log_test_messages.h log_test_messages.cc: log_test_messages.mes + $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/log/tests/log_test_messages.mes + +else + +messages log_test_messages.h log_test_messages.cc: + @echo Messages generation disabled. Configure with --enable-generate-messages to enable it. + +endif diff --git a/src/lib/log/tests/Makefile.in b/src/lib/log/tests/Makefile.in new file mode 100644 index 0000000..721a9e7 --- /dev/null +++ b/src/lib/log/tests/Makefile.in @@ -0,0 +1,1602 @@ +# Makefile.in generated by automake 1.16.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2018 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@USE_STATIC_LINK_TRUE@am__append_1 = -static +noinst_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_3) +@HAVE_GTEST_TRUE@TESTS = $(am__EXEEXT_2) $(SHTESTS) + +# Don't install test binaries. +@HAVE_GTEST_TRUE@am__append_2 = $(PROGRAM_TESTS) +subdir = src/lib/log/tests +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4macros/ax_boost_for_kea.m4 \ + $(top_srcdir)/m4macros/ax_cpp11.m4 \ + $(top_srcdir)/m4macros/ax_cpp20.m4 \ + $(top_srcdir)/m4macros/ax_crypto.m4 \ + $(top_srcdir)/m4macros/ax_find_library.m4 \ + $(top_srcdir)/m4macros/ax_gssapi.m4 \ + $(top_srcdir)/m4macros/ax_gtest.m4 \ + $(top_srcdir)/m4macros/ax_isc_rpath.m4 \ + $(top_srcdir)/m4macros/ax_netconf.m4 \ + $(top_srcdir)/m4macros/libtool.m4 \ + $(top_srcdir)/m4macros/ltoptions.m4 \ + $(top_srcdir)/m4macros/ltsugar.m4 \ + $(top_srcdir)/m4macros/ltversion.m4 \ + $(top_srcdir)/m4macros/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = buffer_logger_test.sh console_test.sh \ + destination_test.sh init_logger_test.sh local_file_test.sh \ + logger_lock_test.sh severity_test.sh tempdir.h +CONFIG_CLEAN_VPATH_FILES = +am__EXEEXT_1 = logger_example$(EXEEXT) init_logger_test$(EXEEXT) \ + buffer_logger_test$(EXEEXT) logger_lock_test$(EXEEXT) +@HAVE_GTEST_TRUE@am__EXEEXT_2 = run_unittests$(EXEEXT) \ +@HAVE_GTEST_TRUE@ initializer_unittests_1$(EXEEXT) +@HAVE_GTEST_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) +PROGRAMS = $(noinst_PROGRAMS) +am_buffer_logger_test_OBJECTS = \ + buffer_logger_test-buffer_logger_test.$(OBJEXT) +buffer_logger_test_OBJECTS = $(am_buffer_logger_test_OBJECTS) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(top_builddir)/src/lib/log/libkea-log.la \ + $(top_builddir)/src/lib/util/unittests/libutil_unittests.la \ + $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +buffer_logger_test_DEPENDENCIES = $(am__DEPENDENCIES_2) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +buffer_logger_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(buffer_logger_test_CXXFLAGS) $(CXXFLAGS) \ + $(buffer_logger_test_LDFLAGS) $(LDFLAGS) -o $@ +am_init_logger_test_OBJECTS = \ + init_logger_test-init_logger_test.$(OBJEXT) +init_logger_test_OBJECTS = $(am_init_logger_test_OBJECTS) +init_logger_test_DEPENDENCIES = $(am__DEPENDENCIES_2) +init_logger_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(init_logger_test_CXXFLAGS) $(CXXFLAGS) \ + $(init_logger_test_LDFLAGS) $(LDFLAGS) -o $@ +am__initializer_unittests_1_SOURCES_DIST = \ + run_initializer_unittests.cc message_initializer_1_unittest.cc \ + message_initializer_1a_unittest.cc +@HAVE_GTEST_TRUE@am_initializer_unittests_1_OBJECTS = initializer_unittests_1-run_initializer_unittests.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ initializer_unittests_1-message_initializer_1_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ initializer_unittests_1-message_initializer_1a_unittest.$(OBJEXT) +initializer_unittests_1_OBJECTS = \ + $(am_initializer_unittests_1_OBJECTS) +@HAVE_GTEST_TRUE@initializer_unittests_1_DEPENDENCIES = \ +@HAVE_GTEST_TRUE@ $(am__DEPENDENCIES_2) +initializer_unittests_1_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) \ + $(initializer_unittests_1_LDFLAGS) $(LDFLAGS) -o $@ +am_logger_example_OBJECTS = logger_example-logger_example.$(OBJEXT) +logger_example_OBJECTS = $(am_logger_example_OBJECTS) +logger_example_DEPENDENCIES = $(am__DEPENDENCIES_2) +logger_example_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(logger_example_CXXFLAGS) $(CXXFLAGS) \ + $(logger_example_LDFLAGS) $(LDFLAGS) -o $@ +am_logger_lock_test_OBJECTS = \ + logger_lock_test-logger_lock_test.$(OBJEXT) \ + logger_lock_test-log_test_messages.$(OBJEXT) +logger_lock_test_OBJECTS = $(am_logger_lock_test_OBJECTS) +logger_lock_test_DEPENDENCIES = $(am__DEPENDENCIES_2) +logger_lock_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) \ + $(logger_lock_test_LDFLAGS) $(LDFLAGS) -o $@ +am__run_unittests_SOURCES_DIST = run_unittests.cc \ + log_formatter_unittest.cc logger_level_impl_unittest.cc \ + logger_level_unittest.cc logger_manager_unittest.cc \ + logger_name_unittest.cc logger_support_unittest.cc \ + logger_unittest.cc logger_specification_unittest.cc \ + message_dictionary_unittest.cc message_reader_unittest.cc \ + output_option_unittest.cc buffer_appender_unittest.cc \ + log_test_messages.cc log_test_messages.h +@HAVE_GTEST_TRUE@am_run_unittests_OBJECTS = \ +@HAVE_GTEST_TRUE@ run_unittests-run_unittests.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-log_formatter_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_level_impl_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_level_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_manager_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_name_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_support_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-logger_specification_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-message_dictionary_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-message_reader_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-output_option_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-buffer_appender_unittest.$(OBJEXT) \ +@HAVE_GTEST_TRUE@ run_unittests-log_test_messages.$(OBJEXT) +run_unittests_OBJECTS = $(am_run_unittests_OBJECTS) +@HAVE_GTEST_TRUE@run_unittests_DEPENDENCIES = $(am__DEPENDENCIES_2) +run_unittests_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(run_unittests_CXXFLAGS) $(CXXFLAGS) $(run_unittests_LDFLAGS) \ + $(LDFLAGS) -o $@ +SCRIPTS = $(noinst_SCRIPTS) +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = \ + ./$(DEPDIR)/buffer_logger_test-buffer_logger_test.Po \ + ./$(DEPDIR)/init_logger_test-init_logger_test.Po \ + ./$(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po \ + ./$(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po \ + ./$(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po \ + ./$(DEPDIR)/logger_example-logger_example.Po \ + ./$(DEPDIR)/logger_lock_test-log_test_messages.Po \ + ./$(DEPDIR)/logger_lock_test-logger_lock_test.Po \ + ./$(DEPDIR)/run_unittests-buffer_appender_unittest.Po \ + ./$(DEPDIR)/run_unittests-log_formatter_unittest.Po \ + ./$(DEPDIR)/run_unittests-log_test_messages.Po \ + ./$(DEPDIR)/run_unittests-logger_level_impl_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_level_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_manager_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_name_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_specification_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_support_unittest.Po \ + ./$(DEPDIR)/run_unittests-logger_unittest.Po \ + ./$(DEPDIR)/run_unittests-message_dictionary_unittest.Po \ + ./$(DEPDIR)/run_unittests-message_reader_unittest.Po \ + ./$(DEPDIR)/run_unittests-output_option_unittest.Po \ + ./$(DEPDIR)/run_unittests-run_unittests.Po +am__mv = mv -f +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_@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 = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(buffer_logger_test_SOURCES) $(init_logger_test_SOURCES) \ + $(initializer_unittests_1_SOURCES) $(logger_example_SOURCES) \ + $(logger_lock_test_SOURCES) $(run_unittests_SOURCES) +DIST_SOURCES = $(buffer_logger_test_SOURCES) \ + $(init_logger_test_SOURCES) \ + $(am__initializer_unittests_1_SOURCES_DIST) \ + $(logger_example_SOURCES) $(logger_lock_test_SOURCES) \ + $(am__run_unittests_SOURCES_DIST) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = { \ + $(am__tty_colors_dummy); \ + if test "X$(AM_COLOR_TESTS)" = Xno; then \ + am__color_tests=no; \ + elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ + am__color_tests=yes; \ + elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ + am__color_tests=yes; \ + fi; \ + if test $$am__color_tests = yes; then \ + red='[0;31m'; \ + grn='[0;32m'; \ + lgn='[1;32m'; \ + blu='[1;34m'; \ + mgn='[0;35m'; \ + brg='[1m'; \ + std='[m'; \ + fi; \ +} +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(srcdir)/buffer_logger_test.sh.in \ + $(srcdir)/console_test.sh.in $(srcdir)/destination_test.sh.in \ + $(srcdir)/init_logger_test.sh.in \ + $(srcdir)/local_file_test.sh.in \ + $(srcdir)/logger_lock_test.sh.in $(srcdir)/severity_test.sh.in \ + $(srcdir)/tempdir.h.in $(top_srcdir)/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +ASCIIDOC = @ASCIIDOC@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOOST_INCLUDES = @BOOST_INCLUDES@ +BOOST_LIBS = @BOOST_LIBS@ +BOTAN_TOOL = @BOTAN_TOOL@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CONTRIB_DIR = @CONTRIB_DIR@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRYPTO_CFLAGS = @CRYPTO_CFLAGS@ +CRYPTO_INCLUDES = @CRYPTO_INCLUDES@ +CRYPTO_LDFLAGS = @CRYPTO_LDFLAGS@ +CRYPTO_LIBS = @CRYPTO_LIBS@ +CRYPTO_PACKAGE = @CRYPTO_PACKAGE@ +CRYPTO_RPATH = @CRYPTO_RPATH@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISTCHECK_BOOST_CONFIGURE_FLAG = @DISTCHECK_BOOST_CONFIGURE_FLAG@ +DISTCHECK_CONTRIB_CONFIGURE_FLAG = @DISTCHECK_CONTRIB_CONFIGURE_FLAG@ +DISTCHECK_CRYPTO_CONFIGURE_FLAG = @DISTCHECK_CRYPTO_CONFIGURE_FLAG@ +DISTCHECK_GSSAPI_CONFIGURE_FLAG = @DISTCHECK_GSSAPI_CONFIGURE_FLAG@ +DISTCHECK_GTEST_CONFIGURE_FLAG = @DISTCHECK_GTEST_CONFIGURE_FLAG@ +DISTCHECK_KEA_SHELL_CONFIGURE_FLAG = @DISTCHECK_KEA_SHELL_CONFIGURE_FLAG@ +DISTCHECK_LIBYANGCPP_CONFIGURE_FLAG = @DISTCHECK_LIBYANGCPP_CONFIGURE_FLAG@ +DISTCHECK_LIBYANG_CONFIGURE_FLAG = @DISTCHECK_LIBYANG_CONFIGURE_FLAG@ +DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG = @DISTCHECK_LOG4CPLUS_CONFIGURE_FLAG@ +DISTCHECK_MYSQL_CONFIGURE_FLAG = @DISTCHECK_MYSQL_CONFIGURE_FLAG@ +DISTCHECK_PERFDHCP_CONFIGURE_FLAG = @DISTCHECK_PERFDHCP_CONFIGURE_FLAG@ +DISTCHECK_PGSQL_CONFIGURE_FLAG = @DISTCHECK_PGSQL_CONFIGURE_FLAG@ +DISTCHECK_PREMIUM_CONFIGURE_FLAG = @DISTCHECK_PREMIUM_CONFIGURE_FLAG@ +DISTCHECK_SYSREPOCPP_CONFIGURE_FLAG = @DISTCHECK_SYSREPOCPP_CONFIGURE_FLAG@ +DISTCHECK_SYSREPO_CONFIGURE_FLAG = @DISTCHECK_SYSREPO_CONFIGURE_FLAG@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GENHTML = @GENHTML@ +GREP = @GREP@ +GSSAPI_CFLAGS = @GSSAPI_CFLAGS@ +GSSAPI_LIBS = @GSSAPI_LIBS@ +GTEST_CONFIG = @GTEST_CONFIG@ +GTEST_INCLUDES = @GTEST_INCLUDES@ +GTEST_LDADD = @GTEST_LDADD@ +GTEST_LDFLAGS = @GTEST_LDFLAGS@ +GTEST_SOURCE = @GTEST_SOURCE@ +HAVE_NETCONF = @HAVE_NETCONF@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KEA_CXXFLAGS = @KEA_CXXFLAGS@ +KEA_SRCID = @KEA_SRCID@ +KRB5_CONFIG = @KRB5_CONFIG@ +LCOV = @LCOV@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LEX = @LEX@ +LEXLIB = @LEXLIB@ +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIBYANGCPP_CPPFLAGS = @LIBYANGCPP_CPPFLAGS@ +LIBYANGCPP_INCLUDEDIR = @LIBYANGCPP_INCLUDEDIR@ +LIBYANGCPP_LIBS = @LIBYANGCPP_LIBS@ +LIBYANGCPP_PREFIX = @LIBYANGCPP_PREFIX@ +LIBYANGCPP_VERSION = @LIBYANGCPP_VERSION@ +LIBYANG_CPPFLAGS = @LIBYANG_CPPFLAGS@ +LIBYANG_INCLUDEDIR = @LIBYANG_INCLUDEDIR@ +LIBYANG_LIBS = @LIBYANG_LIBS@ +LIBYANG_PREFIX = @LIBYANG_PREFIX@ +LIBYANG_VERSION = @LIBYANG_VERSION@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LOG4CPLUS_INCLUDES = @LOG4CPLUS_INCLUDES@ +LOG4CPLUS_LIBS = @LOG4CPLUS_LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PACKAGE_VERSION_TYPE = @PACKAGE_VERSION_TYPE@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PDFLATEX = @PDFLATEX@ +PERL = @PERL@ +PGSQL_CPPFLAGS = @PGSQL_CPPFLAGS@ +PGSQL_LIBS = @PGSQL_LIBS@ +PKGPYTHONDIR = @PKGPYTHONDIR@ +PKG_CONFIG = @PKG_CONFIG@ +PLANTUML = @PLANTUML@ +PREMIUM_DIR = @PREMIUM_DIR@ +PYTHON = @PYTHON@ +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ +PYTHON_PLATFORM = @PYTHON_PLATFORM@ +PYTHON_PREFIX = @PYTHON_PREFIX@ +PYTHON_VERSION = @PYTHON_VERSION@ +RANLIB = @RANLIB@ +SED = @SED@ +SEP = @SEP@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SPHINXBUILD = @SPHINXBUILD@ +SRPD_PLUGINS_PATH = @SRPD_PLUGINS_PATH@ +SR_PLUGINS_PATH = @SR_PLUGINS_PATH@ +SR_REPO_PATH = @SR_REPO_PATH@ +STRIP = @STRIP@ +SYSREPOCPP_CPPFLAGS = @SYSREPOCPP_CPPFLAGS@ +SYSREPOCPP_INCLUDEDIR = @SYSREPOCPP_INCLUDEDIR@ +SYSREPOCPP_LIBS = @SYSREPOCPP_LIBS@ +SYSREPOCPP_PREFIX = @SYSREPOCPP_PREFIX@ +SYSREPOCPP_VERSION = @SYSREPOCPP_VERSION@ +SYSREPO_CPPFLAGS = @SYSREPO_CPPFLAGS@ +SYSREPO_INCLUDEDIR = @SYSREPO_INCLUDEDIR@ +SYSREPO_LIBS = @SYSREPO_LIBS@ +SYSREPO_PREFIX = @SYSREPO_PREFIX@ +SYSREPO_VERSION = @SYSREPO_VERSION@ +USE_LCOV = @USE_LCOV@ +VALGRIND = @VALGRIND@ +VERSION = @VERSION@ +WARNING_GCC_44_STRICT_ALIASING_CFLAG = @WARNING_GCC_44_STRICT_ALIASING_CFLAG@ +YACC = @YACC@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgpyexecdir = @pkgpyexecdir@ +pkgpythondir = @pkgpythondir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +pyexecdir = @pyexecdir@ +pythondir = @pythondir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +SUBDIRS = . + +# Define the flags used in each set of tests. +AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib \ + $(BOOST_INCLUDES) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES) +AM_CXXFLAGS = $(KEA_CXXFLAGS) +AM_LDADD = $(top_builddir)/src/lib/log/libkea-log.la \ + $(top_builddir)/src/lib/util/unittests/libutil_unittests.la \ + $(top_builddir)/src/lib/exceptions/libkea-exceptions.la \ + $(LOG4CPLUS_LIBS) $(GTEST_LDADD) +AM_LDFLAGS = $(am__append_1) +CLEANFILES = *.gcno *.gcda *.lock +EXTRA_DIST = log_test_messages.mes + +# Helper programs used in shell tests +TEST_HELPERS = logger_example init_logger_test buffer_logger_test \ + logger_lock_test +logger_example_SOURCES = logger_example.cc +logger_example_CPPFLAGS = $(AM_CPPFLAGS) +logger_example_CXXFLAGS = $(AM_CXXFLAGS) +logger_example_LDADD = $(AM_LDADD) +logger_example_LDFLAGS = $(AM_LDFLAGS) +init_logger_test_SOURCES = init_logger_test.cc +init_logger_test_CPPFLAGS = $(AM_CPPFLAGS) +init_logger_test_CXXFLAGS = $(AM_CXXFLAGS) +init_logger_test_LDADD = $(AM_LDADD) +init_logger_test_LDFLAGS = $(AM_LDFLAGS) +buffer_logger_test_SOURCES = buffer_logger_test.cc +buffer_logger_test_CPPFLAGS = $(AM_CPPFLAGS) +buffer_logger_test_CXXFLAGS = $(AM_CXXFLAGS) +buffer_logger_test_LDADD = $(AM_LDADD) +buffer_logger_test_LDFLAGS = $(AM_LDFLAGS) +logger_lock_test_SOURCES = logger_lock_test.cc log_test_messages.cc \ + log_test_messages.h +logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS) +logger_lock_test_CXXFLAGS = $(AM_CXXFLAGS) +logger_lock_test_LDADD = $(AM_LDADD) +logger_lock_test_LDFLAGS = $(AM_LDFLAGS) + +# Shell tests. These are principally tests where the global logging environment +# is affected, and where the output needs to be compared with stored output +# (where "cut" and "diff" are useful utilities). +SHTESTS = buffer_logger_test.sh console_test.sh destination_test.sh \ + init_logger_test.sh local_file_test.sh logger_lock_test.sh \ + severity_test.sh + +# As with every file generated by ./configure, clean them up when running +# "make distclean", but not on "make clean". +DISTCLEANFILES = tempdir.h $(SHTESTS) +@HAVE_GTEST_TRUE@TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + +# Set of unit tests for the general logging classes + +# logging initialization tests. These are put in a separate program to +# ensure that the initialization status at the start of each test is known, +# and to prevent circumstances where the execution of one test affects the +# starting conditions of the next. +@HAVE_GTEST_TRUE@PROGRAM_TESTS = run_unittests initializer_unittests_1 +@HAVE_GTEST_TRUE@run_unittests_SOURCES = run_unittests.cc \ +@HAVE_GTEST_TRUE@ log_formatter_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_level_impl_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_level_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_manager_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_name_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_support_unittest.cc logger_unittest.cc \ +@HAVE_GTEST_TRUE@ logger_specification_unittest.cc \ +@HAVE_GTEST_TRUE@ message_dictionary_unittest.cc \ +@HAVE_GTEST_TRUE@ message_reader_unittest.cc \ +@HAVE_GTEST_TRUE@ output_option_unittest.cc \ +@HAVE_GTEST_TRUE@ buffer_appender_unittest.cc \ +@HAVE_GTEST_TRUE@ log_test_messages.cc log_test_messages.h +@HAVE_GTEST_TRUE@run_unittests_CPPFLAGS = $(AM_CPPFLAGS) +@HAVE_GTEST_TRUE@run_unittests_CXXFLAGS = $(AM_CXXFLAGS) +@HAVE_GTEST_TRUE@run_unittests_LDADD = $(AM_LDADD) +@HAVE_GTEST_TRUE@run_unittests_LDFLAGS = $(AM_LDFLAGS) +@HAVE_GTEST_TRUE@initializer_unittests_1_SOURCES = \ +@HAVE_GTEST_TRUE@ run_initializer_unittests.cc \ +@HAVE_GTEST_TRUE@ message_initializer_1_unittest.cc \ +@HAVE_GTEST_TRUE@ message_initializer_1a_unittest.cc +@HAVE_GTEST_TRUE@initializer_unittests_1_CPPFLAGS = $(AM_CPPFLAGS) +@HAVE_GTEST_TRUE@initializer_unittests_1_CXXFLAGS = $(AM_CXXFLAGS) +@HAVE_GTEST_TRUE@initializer_unittests_1_LDADD = $(AM_LDADD) +@HAVE_GTEST_TRUE@initializer_unittests_1_LDFLAGS = $(AM_LDFLAGS) + +# Run shell tests on "make check". +@HAVE_GTEST_TRUE@check_SCRIPTS = $(SHTESTS) + +# Don't install shell tests. +noinst_SCRIPTS = $(SHTESTS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/lib/log/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign src/lib/log/tests/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +buffer_logger_test.sh: $(top_builddir)/config.status $(srcdir)/buffer_logger_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +console_test.sh: $(top_builddir)/config.status $(srcdir)/console_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +destination_test.sh: $(top_builddir)/config.status $(srcdir)/destination_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +init_logger_test.sh: $(top_builddir)/config.status $(srcdir)/init_logger_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +local_file_test.sh: $(top_builddir)/config.status $(srcdir)/local_file_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +logger_lock_test.sh: $(top_builddir)/config.status $(srcdir)/logger_lock_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +severity_test.sh: $(top_builddir)/config.status $(srcdir)/severity_test.sh.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +tempdir.h: $(top_builddir)/config.status $(srcdir)/tempdir.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +buffer_logger_test$(EXEEXT): $(buffer_logger_test_OBJECTS) $(buffer_logger_test_DEPENDENCIES) $(EXTRA_buffer_logger_test_DEPENDENCIES) + @rm -f buffer_logger_test$(EXEEXT) + $(AM_V_CXXLD)$(buffer_logger_test_LINK) $(buffer_logger_test_OBJECTS) $(buffer_logger_test_LDADD) $(LIBS) + +init_logger_test$(EXEEXT): $(init_logger_test_OBJECTS) $(init_logger_test_DEPENDENCIES) $(EXTRA_init_logger_test_DEPENDENCIES) + @rm -f init_logger_test$(EXEEXT) + $(AM_V_CXXLD)$(init_logger_test_LINK) $(init_logger_test_OBJECTS) $(init_logger_test_LDADD) $(LIBS) + +initializer_unittests_1$(EXEEXT): $(initializer_unittests_1_OBJECTS) $(initializer_unittests_1_DEPENDENCIES) $(EXTRA_initializer_unittests_1_DEPENDENCIES) + @rm -f initializer_unittests_1$(EXEEXT) + $(AM_V_CXXLD)$(initializer_unittests_1_LINK) $(initializer_unittests_1_OBJECTS) $(initializer_unittests_1_LDADD) $(LIBS) + +logger_example$(EXEEXT): $(logger_example_OBJECTS) $(logger_example_DEPENDENCIES) $(EXTRA_logger_example_DEPENDENCIES) + @rm -f logger_example$(EXEEXT) + $(AM_V_CXXLD)$(logger_example_LINK) $(logger_example_OBJECTS) $(logger_example_LDADD) $(LIBS) + +logger_lock_test$(EXEEXT): $(logger_lock_test_OBJECTS) $(logger_lock_test_DEPENDENCIES) $(EXTRA_logger_lock_test_DEPENDENCIES) + @rm -f logger_lock_test$(EXEEXT) + $(AM_V_CXXLD)$(logger_lock_test_LINK) $(logger_lock_test_OBJECTS) $(logger_lock_test_LDADD) $(LIBS) + +run_unittests$(EXEEXT): $(run_unittests_OBJECTS) $(run_unittests_DEPENDENCIES) $(EXTRA_run_unittests_DEPENDENCIES) + @rm -f run_unittests$(EXEEXT) + $(AM_V_CXXLD)$(run_unittests_LINK) $(run_unittests_OBJECTS) $(run_unittests_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer_logger_test-buffer_logger_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init_logger_test-init_logger_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger_example-logger_example.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger_lock_test-log_test_messages.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/logger_lock_test-logger_lock_test.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-buffer_appender_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-log_formatter_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-log_test_messages.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_level_impl_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_level_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_manager_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_name_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_specification_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_support_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-logger_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-message_dictionary_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-message_reader_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-output_option_unittest.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/run_unittests-run_unittests.Po@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.cc.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 $@ $< + +.cc.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) '$<'` + +.cc.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 $@ $< + +buffer_logger_test-buffer_logger_test.o: buffer_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(buffer_logger_test_CPPFLAGS) $(CPPFLAGS) $(buffer_logger_test_CXXFLAGS) $(CXXFLAGS) -MT buffer_logger_test-buffer_logger_test.o -MD -MP -MF $(DEPDIR)/buffer_logger_test-buffer_logger_test.Tpo -c -o buffer_logger_test-buffer_logger_test.o `test -f 'buffer_logger_test.cc' || echo '$(srcdir)/'`buffer_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/buffer_logger_test-buffer_logger_test.Tpo $(DEPDIR)/buffer_logger_test-buffer_logger_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_logger_test.cc' object='buffer_logger_test-buffer_logger_test.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) $(buffer_logger_test_CPPFLAGS) $(CPPFLAGS) $(buffer_logger_test_CXXFLAGS) $(CXXFLAGS) -c -o buffer_logger_test-buffer_logger_test.o `test -f 'buffer_logger_test.cc' || echo '$(srcdir)/'`buffer_logger_test.cc + +buffer_logger_test-buffer_logger_test.obj: buffer_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(buffer_logger_test_CPPFLAGS) $(CPPFLAGS) $(buffer_logger_test_CXXFLAGS) $(CXXFLAGS) -MT buffer_logger_test-buffer_logger_test.obj -MD -MP -MF $(DEPDIR)/buffer_logger_test-buffer_logger_test.Tpo -c -o buffer_logger_test-buffer_logger_test.obj `if test -f 'buffer_logger_test.cc'; then $(CYGPATH_W) 'buffer_logger_test.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_logger_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/buffer_logger_test-buffer_logger_test.Tpo $(DEPDIR)/buffer_logger_test-buffer_logger_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_logger_test.cc' object='buffer_logger_test-buffer_logger_test.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) $(buffer_logger_test_CPPFLAGS) $(CPPFLAGS) $(buffer_logger_test_CXXFLAGS) $(CXXFLAGS) -c -o buffer_logger_test-buffer_logger_test.obj `if test -f 'buffer_logger_test.cc'; then $(CYGPATH_W) 'buffer_logger_test.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_logger_test.cc'; fi` + +init_logger_test-init_logger_test.o: init_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(init_logger_test_CPPFLAGS) $(CPPFLAGS) $(init_logger_test_CXXFLAGS) $(CXXFLAGS) -MT init_logger_test-init_logger_test.o -MD -MP -MF $(DEPDIR)/init_logger_test-init_logger_test.Tpo -c -o init_logger_test-init_logger_test.o `test -f 'init_logger_test.cc' || echo '$(srcdir)/'`init_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/init_logger_test-init_logger_test.Tpo $(DEPDIR)/init_logger_test-init_logger_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='init_logger_test.cc' object='init_logger_test-init_logger_test.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) $(init_logger_test_CPPFLAGS) $(CPPFLAGS) $(init_logger_test_CXXFLAGS) $(CXXFLAGS) -c -o init_logger_test-init_logger_test.o `test -f 'init_logger_test.cc' || echo '$(srcdir)/'`init_logger_test.cc + +init_logger_test-init_logger_test.obj: init_logger_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(init_logger_test_CPPFLAGS) $(CPPFLAGS) $(init_logger_test_CXXFLAGS) $(CXXFLAGS) -MT init_logger_test-init_logger_test.obj -MD -MP -MF $(DEPDIR)/init_logger_test-init_logger_test.Tpo -c -o init_logger_test-init_logger_test.obj `if test -f 'init_logger_test.cc'; then $(CYGPATH_W) 'init_logger_test.cc'; else $(CYGPATH_W) '$(srcdir)/init_logger_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/init_logger_test-init_logger_test.Tpo $(DEPDIR)/init_logger_test-init_logger_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='init_logger_test.cc' object='init_logger_test-init_logger_test.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) $(init_logger_test_CPPFLAGS) $(CPPFLAGS) $(init_logger_test_CXXFLAGS) $(CXXFLAGS) -c -o init_logger_test-init_logger_test.obj `if test -f 'init_logger_test.cc'; then $(CYGPATH_W) 'init_logger_test.cc'; else $(CYGPATH_W) '$(srcdir)/init_logger_test.cc'; fi` + +initializer_unittests_1-run_initializer_unittests.o: run_initializer_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-run_initializer_unittests.o -MD -MP -MF $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Tpo -c -o initializer_unittests_1-run_initializer_unittests.o `test -f 'run_initializer_unittests.cc' || echo '$(srcdir)/'`run_initializer_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Tpo $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_initializer_unittests.cc' object='initializer_unittests_1-run_initializer_unittests.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-run_initializer_unittests.o `test -f 'run_initializer_unittests.cc' || echo '$(srcdir)/'`run_initializer_unittests.cc + +initializer_unittests_1-run_initializer_unittests.obj: run_initializer_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-run_initializer_unittests.obj -MD -MP -MF $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Tpo -c -o initializer_unittests_1-run_initializer_unittests.obj `if test -f 'run_initializer_unittests.cc'; then $(CYGPATH_W) 'run_initializer_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_initializer_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Tpo $(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_initializer_unittests.cc' object='initializer_unittests_1-run_initializer_unittests.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-run_initializer_unittests.obj `if test -f 'run_initializer_unittests.cc'; then $(CYGPATH_W) 'run_initializer_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_initializer_unittests.cc'; fi` + +initializer_unittests_1-message_initializer_1_unittest.o: message_initializer_1_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-message_initializer_1_unittest.o -MD -MP -MF $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Tpo -c -o initializer_unittests_1-message_initializer_1_unittest.o `test -f 'message_initializer_1_unittest.cc' || echo '$(srcdir)/'`message_initializer_1_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Tpo $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_initializer_1_unittest.cc' object='initializer_unittests_1-message_initializer_1_unittest.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-message_initializer_1_unittest.o `test -f 'message_initializer_1_unittest.cc' || echo '$(srcdir)/'`message_initializer_1_unittest.cc + +initializer_unittests_1-message_initializer_1_unittest.obj: message_initializer_1_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-message_initializer_1_unittest.obj -MD -MP -MF $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Tpo -c -o initializer_unittests_1-message_initializer_1_unittest.obj `if test -f 'message_initializer_1_unittest.cc'; then $(CYGPATH_W) 'message_initializer_1_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_initializer_1_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Tpo $(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_initializer_1_unittest.cc' object='initializer_unittests_1-message_initializer_1_unittest.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-message_initializer_1_unittest.obj `if test -f 'message_initializer_1_unittest.cc'; then $(CYGPATH_W) 'message_initializer_1_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_initializer_1_unittest.cc'; fi` + +initializer_unittests_1-message_initializer_1a_unittest.o: message_initializer_1a_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-message_initializer_1a_unittest.o -MD -MP -MF $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Tpo -c -o initializer_unittests_1-message_initializer_1a_unittest.o `test -f 'message_initializer_1a_unittest.cc' || echo '$(srcdir)/'`message_initializer_1a_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Tpo $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_initializer_1a_unittest.cc' object='initializer_unittests_1-message_initializer_1a_unittest.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-message_initializer_1a_unittest.o `test -f 'message_initializer_1a_unittest.cc' || echo '$(srcdir)/'`message_initializer_1a_unittest.cc + +initializer_unittests_1-message_initializer_1a_unittest.obj: message_initializer_1a_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -MT initializer_unittests_1-message_initializer_1a_unittest.obj -MD -MP -MF $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Tpo -c -o initializer_unittests_1-message_initializer_1a_unittest.obj `if test -f 'message_initializer_1a_unittest.cc'; then $(CYGPATH_W) 'message_initializer_1a_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_initializer_1a_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Tpo $(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_initializer_1a_unittest.cc' object='initializer_unittests_1-message_initializer_1a_unittest.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) $(initializer_unittests_1_CPPFLAGS) $(CPPFLAGS) $(initializer_unittests_1_CXXFLAGS) $(CXXFLAGS) -c -o initializer_unittests_1-message_initializer_1a_unittest.obj `if test -f 'message_initializer_1a_unittest.cc'; then $(CYGPATH_W) 'message_initializer_1a_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_initializer_1a_unittest.cc'; fi` + +logger_example-logger_example.o: logger_example.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_example_CPPFLAGS) $(CPPFLAGS) $(logger_example_CXXFLAGS) $(CXXFLAGS) -MT logger_example-logger_example.o -MD -MP -MF $(DEPDIR)/logger_example-logger_example.Tpo -c -o logger_example-logger_example.o `test -f 'logger_example.cc' || echo '$(srcdir)/'`logger_example.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_example-logger_example.Tpo $(DEPDIR)/logger_example-logger_example.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_example.cc' object='logger_example-logger_example.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) $(logger_example_CPPFLAGS) $(CPPFLAGS) $(logger_example_CXXFLAGS) $(CXXFLAGS) -c -o logger_example-logger_example.o `test -f 'logger_example.cc' || echo '$(srcdir)/'`logger_example.cc + +logger_example-logger_example.obj: logger_example.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_example_CPPFLAGS) $(CPPFLAGS) $(logger_example_CXXFLAGS) $(CXXFLAGS) -MT logger_example-logger_example.obj -MD -MP -MF $(DEPDIR)/logger_example-logger_example.Tpo -c -o logger_example-logger_example.obj `if test -f 'logger_example.cc'; then $(CYGPATH_W) 'logger_example.cc'; else $(CYGPATH_W) '$(srcdir)/logger_example.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_example-logger_example.Tpo $(DEPDIR)/logger_example-logger_example.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_example.cc' object='logger_example-logger_example.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) $(logger_example_CPPFLAGS) $(CPPFLAGS) $(logger_example_CXXFLAGS) $(CXXFLAGS) -c -o logger_example-logger_example.obj `if test -f 'logger_example.cc'; then $(CYGPATH_W) 'logger_example.cc'; else $(CYGPATH_W) '$(srcdir)/logger_example.cc'; fi` + +logger_lock_test-logger_lock_test.o: logger_lock_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -MT logger_lock_test-logger_lock_test.o -MD -MP -MF $(DEPDIR)/logger_lock_test-logger_lock_test.Tpo -c -o logger_lock_test-logger_lock_test.o `test -f 'logger_lock_test.cc' || echo '$(srcdir)/'`logger_lock_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_lock_test-logger_lock_test.Tpo $(DEPDIR)/logger_lock_test-logger_lock_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_lock_test.cc' object='logger_lock_test-logger_lock_test.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) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -c -o logger_lock_test-logger_lock_test.o `test -f 'logger_lock_test.cc' || echo '$(srcdir)/'`logger_lock_test.cc + +logger_lock_test-logger_lock_test.obj: logger_lock_test.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -MT logger_lock_test-logger_lock_test.obj -MD -MP -MF $(DEPDIR)/logger_lock_test-logger_lock_test.Tpo -c -o logger_lock_test-logger_lock_test.obj `if test -f 'logger_lock_test.cc'; then $(CYGPATH_W) 'logger_lock_test.cc'; else $(CYGPATH_W) '$(srcdir)/logger_lock_test.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_lock_test-logger_lock_test.Tpo $(DEPDIR)/logger_lock_test-logger_lock_test.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_lock_test.cc' object='logger_lock_test-logger_lock_test.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) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -c -o logger_lock_test-logger_lock_test.obj `if test -f 'logger_lock_test.cc'; then $(CYGPATH_W) 'logger_lock_test.cc'; else $(CYGPATH_W) '$(srcdir)/logger_lock_test.cc'; fi` + +logger_lock_test-log_test_messages.o: log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -MT logger_lock_test-log_test_messages.o -MD -MP -MF $(DEPDIR)/logger_lock_test-log_test_messages.Tpo -c -o logger_lock_test-log_test_messages.o `test -f 'log_test_messages.cc' || echo '$(srcdir)/'`log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_lock_test-log_test_messages.Tpo $(DEPDIR)/logger_lock_test-log_test_messages.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_test_messages.cc' object='logger_lock_test-log_test_messages.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) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -c -o logger_lock_test-log_test_messages.o `test -f 'log_test_messages.cc' || echo '$(srcdir)/'`log_test_messages.cc + +logger_lock_test-log_test_messages.obj: log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -MT logger_lock_test-log_test_messages.obj -MD -MP -MF $(DEPDIR)/logger_lock_test-log_test_messages.Tpo -c -o logger_lock_test-log_test_messages.obj `if test -f 'log_test_messages.cc'; then $(CYGPATH_W) 'log_test_messages.cc'; else $(CYGPATH_W) '$(srcdir)/log_test_messages.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/logger_lock_test-log_test_messages.Tpo $(DEPDIR)/logger_lock_test-log_test_messages.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_test_messages.cc' object='logger_lock_test-log_test_messages.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) $(logger_lock_test_CPPFLAGS) $(CPPFLAGS) $(logger_lock_test_CXXFLAGS) $(CXXFLAGS) -c -o logger_lock_test-log_test_messages.obj `if test -f 'log_test_messages.cc'; then $(CYGPATH_W) 'log_test_messages.cc'; else $(CYGPATH_W) '$(srcdir)/log_test_messages.cc'; fi` + +run_unittests-run_unittests.o: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-run_unittests.o -MD -MP -MF $(DEPDIR)/run_unittests-run_unittests.Tpo -c -o run_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-run_unittests.Tpo $(DEPDIR)/run_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_unittests-run_unittests.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-run_unittests.o `test -f 'run_unittests.cc' || echo '$(srcdir)/'`run_unittests.cc + +run_unittests-run_unittests.obj: run_unittests.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-run_unittests.obj -MD -MP -MF $(DEPDIR)/run_unittests-run_unittests.Tpo -c -o run_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-run_unittests.Tpo $(DEPDIR)/run_unittests-run_unittests.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='run_unittests.cc' object='run_unittests-run_unittests.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-run_unittests.obj `if test -f 'run_unittests.cc'; then $(CYGPATH_W) 'run_unittests.cc'; else $(CYGPATH_W) '$(srcdir)/run_unittests.cc'; fi` + +run_unittests-log_formatter_unittest.o: log_formatter_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-log_formatter_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-log_formatter_unittest.Tpo -c -o run_unittests-log_formatter_unittest.o `test -f 'log_formatter_unittest.cc' || echo '$(srcdir)/'`log_formatter_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-log_formatter_unittest.Tpo $(DEPDIR)/run_unittests-log_formatter_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_formatter_unittest.cc' object='run_unittests-log_formatter_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-log_formatter_unittest.o `test -f 'log_formatter_unittest.cc' || echo '$(srcdir)/'`log_formatter_unittest.cc + +run_unittests-log_formatter_unittest.obj: log_formatter_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-log_formatter_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-log_formatter_unittest.Tpo -c -o run_unittests-log_formatter_unittest.obj `if test -f 'log_formatter_unittest.cc'; then $(CYGPATH_W) 'log_formatter_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/log_formatter_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-log_formatter_unittest.Tpo $(DEPDIR)/run_unittests-log_formatter_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_formatter_unittest.cc' object='run_unittests-log_formatter_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-log_formatter_unittest.obj `if test -f 'log_formatter_unittest.cc'; then $(CYGPATH_W) 'log_formatter_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/log_formatter_unittest.cc'; fi` + +run_unittests-logger_level_impl_unittest.o: logger_level_impl_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_level_impl_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_level_impl_unittest.Tpo -c -o run_unittests-logger_level_impl_unittest.o `test -f 'logger_level_impl_unittest.cc' || echo '$(srcdir)/'`logger_level_impl_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_level_impl_unittest.Tpo $(DEPDIR)/run_unittests-logger_level_impl_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_level_impl_unittest.cc' object='run_unittests-logger_level_impl_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_level_impl_unittest.o `test -f 'logger_level_impl_unittest.cc' || echo '$(srcdir)/'`logger_level_impl_unittest.cc + +run_unittests-logger_level_impl_unittest.obj: logger_level_impl_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_level_impl_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_level_impl_unittest.Tpo -c -o run_unittests-logger_level_impl_unittest.obj `if test -f 'logger_level_impl_unittest.cc'; then $(CYGPATH_W) 'logger_level_impl_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_level_impl_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_level_impl_unittest.Tpo $(DEPDIR)/run_unittests-logger_level_impl_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_level_impl_unittest.cc' object='run_unittests-logger_level_impl_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_level_impl_unittest.obj `if test -f 'logger_level_impl_unittest.cc'; then $(CYGPATH_W) 'logger_level_impl_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_level_impl_unittest.cc'; fi` + +run_unittests-logger_level_unittest.o: logger_level_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_level_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_level_unittest.Tpo -c -o run_unittests-logger_level_unittest.o `test -f 'logger_level_unittest.cc' || echo '$(srcdir)/'`logger_level_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_level_unittest.Tpo $(DEPDIR)/run_unittests-logger_level_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_level_unittest.cc' object='run_unittests-logger_level_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_level_unittest.o `test -f 'logger_level_unittest.cc' || echo '$(srcdir)/'`logger_level_unittest.cc + +run_unittests-logger_level_unittest.obj: logger_level_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_level_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_level_unittest.Tpo -c -o run_unittests-logger_level_unittest.obj `if test -f 'logger_level_unittest.cc'; then $(CYGPATH_W) 'logger_level_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_level_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_level_unittest.Tpo $(DEPDIR)/run_unittests-logger_level_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_level_unittest.cc' object='run_unittests-logger_level_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_level_unittest.obj `if test -f 'logger_level_unittest.cc'; then $(CYGPATH_W) 'logger_level_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_level_unittest.cc'; fi` + +run_unittests-logger_manager_unittest.o: logger_manager_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_manager_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_manager_unittest.Tpo -c -o run_unittests-logger_manager_unittest.o `test -f 'logger_manager_unittest.cc' || echo '$(srcdir)/'`logger_manager_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_manager_unittest.Tpo $(DEPDIR)/run_unittests-logger_manager_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_manager_unittest.cc' object='run_unittests-logger_manager_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_manager_unittest.o `test -f 'logger_manager_unittest.cc' || echo '$(srcdir)/'`logger_manager_unittest.cc + +run_unittests-logger_manager_unittest.obj: logger_manager_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_manager_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_manager_unittest.Tpo -c -o run_unittests-logger_manager_unittest.obj `if test -f 'logger_manager_unittest.cc'; then $(CYGPATH_W) 'logger_manager_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_manager_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_manager_unittest.Tpo $(DEPDIR)/run_unittests-logger_manager_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_manager_unittest.cc' object='run_unittests-logger_manager_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_manager_unittest.obj `if test -f 'logger_manager_unittest.cc'; then $(CYGPATH_W) 'logger_manager_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_manager_unittest.cc'; fi` + +run_unittests-logger_name_unittest.o: logger_name_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_name_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_name_unittest.Tpo -c -o run_unittests-logger_name_unittest.o `test -f 'logger_name_unittest.cc' || echo '$(srcdir)/'`logger_name_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_name_unittest.Tpo $(DEPDIR)/run_unittests-logger_name_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_name_unittest.cc' object='run_unittests-logger_name_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_name_unittest.o `test -f 'logger_name_unittest.cc' || echo '$(srcdir)/'`logger_name_unittest.cc + +run_unittests-logger_name_unittest.obj: logger_name_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_name_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_name_unittest.Tpo -c -o run_unittests-logger_name_unittest.obj `if test -f 'logger_name_unittest.cc'; then $(CYGPATH_W) 'logger_name_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_name_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_name_unittest.Tpo $(DEPDIR)/run_unittests-logger_name_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_name_unittest.cc' object='run_unittests-logger_name_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_name_unittest.obj `if test -f 'logger_name_unittest.cc'; then $(CYGPATH_W) 'logger_name_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_name_unittest.cc'; fi` + +run_unittests-logger_support_unittest.o: logger_support_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_support_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_support_unittest.Tpo -c -o run_unittests-logger_support_unittest.o `test -f 'logger_support_unittest.cc' || echo '$(srcdir)/'`logger_support_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_support_unittest.Tpo $(DEPDIR)/run_unittests-logger_support_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_support_unittest.cc' object='run_unittests-logger_support_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_support_unittest.o `test -f 'logger_support_unittest.cc' || echo '$(srcdir)/'`logger_support_unittest.cc + +run_unittests-logger_support_unittest.obj: logger_support_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_support_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_support_unittest.Tpo -c -o run_unittests-logger_support_unittest.obj `if test -f 'logger_support_unittest.cc'; then $(CYGPATH_W) 'logger_support_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_support_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_support_unittest.Tpo $(DEPDIR)/run_unittests-logger_support_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_support_unittest.cc' object='run_unittests-logger_support_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_support_unittest.obj `if test -f 'logger_support_unittest.cc'; then $(CYGPATH_W) 'logger_support_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_support_unittest.cc'; fi` + +run_unittests-logger_unittest.o: logger_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_unittest.Tpo -c -o run_unittests-logger_unittest.o `test -f 'logger_unittest.cc' || echo '$(srcdir)/'`logger_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_unittest.Tpo $(DEPDIR)/run_unittests-logger_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_unittest.cc' object='run_unittests-logger_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_unittest.o `test -f 'logger_unittest.cc' || echo '$(srcdir)/'`logger_unittest.cc + +run_unittests-logger_unittest.obj: logger_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_unittest.Tpo -c -o run_unittests-logger_unittest.obj `if test -f 'logger_unittest.cc'; then $(CYGPATH_W) 'logger_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_unittest.Tpo $(DEPDIR)/run_unittests-logger_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_unittest.cc' object='run_unittests-logger_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_unittest.obj `if test -f 'logger_unittest.cc'; then $(CYGPATH_W) 'logger_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_unittest.cc'; fi` + +run_unittests-logger_specification_unittest.o: logger_specification_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_specification_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-logger_specification_unittest.Tpo -c -o run_unittests-logger_specification_unittest.o `test -f 'logger_specification_unittest.cc' || echo '$(srcdir)/'`logger_specification_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_specification_unittest.Tpo $(DEPDIR)/run_unittests-logger_specification_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_specification_unittest.cc' object='run_unittests-logger_specification_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_specification_unittest.o `test -f 'logger_specification_unittest.cc' || echo '$(srcdir)/'`logger_specification_unittest.cc + +run_unittests-logger_specification_unittest.obj: logger_specification_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-logger_specification_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-logger_specification_unittest.Tpo -c -o run_unittests-logger_specification_unittest.obj `if test -f 'logger_specification_unittest.cc'; then $(CYGPATH_W) 'logger_specification_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_specification_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-logger_specification_unittest.Tpo $(DEPDIR)/run_unittests-logger_specification_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='logger_specification_unittest.cc' object='run_unittests-logger_specification_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-logger_specification_unittest.obj `if test -f 'logger_specification_unittest.cc'; then $(CYGPATH_W) 'logger_specification_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/logger_specification_unittest.cc'; fi` + +run_unittests-message_dictionary_unittest.o: message_dictionary_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-message_dictionary_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-message_dictionary_unittest.Tpo -c -o run_unittests-message_dictionary_unittest.o `test -f 'message_dictionary_unittest.cc' || echo '$(srcdir)/'`message_dictionary_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-message_dictionary_unittest.Tpo $(DEPDIR)/run_unittests-message_dictionary_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_dictionary_unittest.cc' object='run_unittests-message_dictionary_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-message_dictionary_unittest.o `test -f 'message_dictionary_unittest.cc' || echo '$(srcdir)/'`message_dictionary_unittest.cc + +run_unittests-message_dictionary_unittest.obj: message_dictionary_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-message_dictionary_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-message_dictionary_unittest.Tpo -c -o run_unittests-message_dictionary_unittest.obj `if test -f 'message_dictionary_unittest.cc'; then $(CYGPATH_W) 'message_dictionary_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_dictionary_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-message_dictionary_unittest.Tpo $(DEPDIR)/run_unittests-message_dictionary_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_dictionary_unittest.cc' object='run_unittests-message_dictionary_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-message_dictionary_unittest.obj `if test -f 'message_dictionary_unittest.cc'; then $(CYGPATH_W) 'message_dictionary_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_dictionary_unittest.cc'; fi` + +run_unittests-message_reader_unittest.o: message_reader_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-message_reader_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-message_reader_unittest.Tpo -c -o run_unittests-message_reader_unittest.o `test -f 'message_reader_unittest.cc' || echo '$(srcdir)/'`message_reader_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-message_reader_unittest.Tpo $(DEPDIR)/run_unittests-message_reader_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_reader_unittest.cc' object='run_unittests-message_reader_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-message_reader_unittest.o `test -f 'message_reader_unittest.cc' || echo '$(srcdir)/'`message_reader_unittest.cc + +run_unittests-message_reader_unittest.obj: message_reader_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-message_reader_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-message_reader_unittest.Tpo -c -o run_unittests-message_reader_unittest.obj `if test -f 'message_reader_unittest.cc'; then $(CYGPATH_W) 'message_reader_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_reader_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-message_reader_unittest.Tpo $(DEPDIR)/run_unittests-message_reader_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='message_reader_unittest.cc' object='run_unittests-message_reader_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-message_reader_unittest.obj `if test -f 'message_reader_unittest.cc'; then $(CYGPATH_W) 'message_reader_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/message_reader_unittest.cc'; fi` + +run_unittests-output_option_unittest.o: output_option_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-output_option_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-output_option_unittest.Tpo -c -o run_unittests-output_option_unittest.o `test -f 'output_option_unittest.cc' || echo '$(srcdir)/'`output_option_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-output_option_unittest.Tpo $(DEPDIR)/run_unittests-output_option_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='output_option_unittest.cc' object='run_unittests-output_option_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-output_option_unittest.o `test -f 'output_option_unittest.cc' || echo '$(srcdir)/'`output_option_unittest.cc + +run_unittests-output_option_unittest.obj: output_option_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-output_option_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-output_option_unittest.Tpo -c -o run_unittests-output_option_unittest.obj `if test -f 'output_option_unittest.cc'; then $(CYGPATH_W) 'output_option_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/output_option_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-output_option_unittest.Tpo $(DEPDIR)/run_unittests-output_option_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='output_option_unittest.cc' object='run_unittests-output_option_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-output_option_unittest.obj `if test -f 'output_option_unittest.cc'; then $(CYGPATH_W) 'output_option_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/output_option_unittest.cc'; fi` + +run_unittests-buffer_appender_unittest.o: buffer_appender_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-buffer_appender_unittest.o -MD -MP -MF $(DEPDIR)/run_unittests-buffer_appender_unittest.Tpo -c -o run_unittests-buffer_appender_unittest.o `test -f 'buffer_appender_unittest.cc' || echo '$(srcdir)/'`buffer_appender_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-buffer_appender_unittest.Tpo $(DEPDIR)/run_unittests-buffer_appender_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_appender_unittest.cc' object='run_unittests-buffer_appender_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-buffer_appender_unittest.o `test -f 'buffer_appender_unittest.cc' || echo '$(srcdir)/'`buffer_appender_unittest.cc + +run_unittests-buffer_appender_unittest.obj: buffer_appender_unittest.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-buffer_appender_unittest.obj -MD -MP -MF $(DEPDIR)/run_unittests-buffer_appender_unittest.Tpo -c -o run_unittests-buffer_appender_unittest.obj `if test -f 'buffer_appender_unittest.cc'; then $(CYGPATH_W) 'buffer_appender_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_appender_unittest.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-buffer_appender_unittest.Tpo $(DEPDIR)/run_unittests-buffer_appender_unittest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='buffer_appender_unittest.cc' object='run_unittests-buffer_appender_unittest.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-buffer_appender_unittest.obj `if test -f 'buffer_appender_unittest.cc'; then $(CYGPATH_W) 'buffer_appender_unittest.cc'; else $(CYGPATH_W) '$(srcdir)/buffer_appender_unittest.cc'; fi` + +run_unittests-log_test_messages.o: log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-log_test_messages.o -MD -MP -MF $(DEPDIR)/run_unittests-log_test_messages.Tpo -c -o run_unittests-log_test_messages.o `test -f 'log_test_messages.cc' || echo '$(srcdir)/'`log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-log_test_messages.Tpo $(DEPDIR)/run_unittests-log_test_messages.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_test_messages.cc' object='run_unittests-log_test_messages.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-log_test_messages.o `test -f 'log_test_messages.cc' || echo '$(srcdir)/'`log_test_messages.cc + +run_unittests-log_test_messages.obj: log_test_messages.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -MT run_unittests-log_test_messages.obj -MD -MP -MF $(DEPDIR)/run_unittests-log_test_messages.Tpo -c -o run_unittests-log_test_messages.obj `if test -f 'log_test_messages.cc'; then $(CYGPATH_W) 'log_test_messages.cc'; else $(CYGPATH_W) '$(srcdir)/log_test_messages.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/run_unittests-log_test_messages.Tpo $(DEPDIR)/run_unittests-log_test_messages.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='log_test_messages.cc' object='run_unittests-log_test_messages.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) $(run_unittests_CPPFLAGS) $(CPPFLAGS) $(run_unittests_CXXFLAGS) $(CXXFLAGS) -c -o run_unittests-log_test_messages.obj `if test -f 'log_test_messages.cc'; then $(CYGPATH_W) 'log_test_messages.cc'; else $(CYGPATH_W) '$(srcdir)/log_test_messages.cc'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-recursive +all-am: Makefile $(PROGRAMS) $(SCRIPTS) +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/buffer_logger_test-buffer_logger_test.Po + -rm -f ./$(DEPDIR)/init_logger_test-init_logger_test.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po + -rm -f ./$(DEPDIR)/logger_example-logger_example.Po + -rm -f ./$(DEPDIR)/logger_lock_test-log_test_messages.Po + -rm -f ./$(DEPDIR)/logger_lock_test-logger_lock_test.Po + -rm -f ./$(DEPDIR)/run_unittests-buffer_appender_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-log_formatter_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-log_test_messages.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_level_impl_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_level_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_manager_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_name_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_specification_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_support_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-message_dictionary_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-message_reader_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-output_option_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-run_unittests.Po + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/buffer_logger_test-buffer_logger_test.Po + -rm -f ./$(DEPDIR)/init_logger_test-init_logger_test.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-message_initializer_1_unittest.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-message_initializer_1a_unittest.Po + -rm -f ./$(DEPDIR)/initializer_unittests_1-run_initializer_unittests.Po + -rm -f ./$(DEPDIR)/logger_example-logger_example.Po + -rm -f ./$(DEPDIR)/logger_lock_test-log_test_messages.Po + -rm -f ./$(DEPDIR)/logger_lock_test-logger_lock_test.Po + -rm -f ./$(DEPDIR)/run_unittests-buffer_appender_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-log_formatter_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-log_test_messages.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_level_impl_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_level_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_manager_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_name_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_specification_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_support_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-logger_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-message_dictionary_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-message_reader_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-output_option_unittest.Po + -rm -f ./$(DEPDIR)/run_unittests-run_unittests.Po + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic \ + maintainer-clean-local + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) check-am install-am install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-TESTS check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS cscopelist-am ctags \ + ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-local mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# If we want to get rid of all generated messages files, we need to use +# make maintainer-clean. The proper way to introduce custom commands for +# that operation is to define maintainer-clean-local target. However, +# make maintainer-clean also removes Makefile, so running configure script +# is required. To make it easy to rebuild messages without going through +# reconfigure, a new target messages-clean has been added. +maintainer-clean-local: + rm -f log_test_messages.h log_test_messages.cc + +# To regenerate messages files, one can do: +# +# make messages-clean +# make messages +# +# This is needed only when a .mes file is modified. +messages-clean: maintainer-clean-local + +# Define rule to build logging source files from message file +@GENERATE_MESSAGES_TRUE@messages: log_test_messages.h log_test_messages.cc +@GENERATE_MESSAGES_TRUE@ @echo Message files regenerated + +@GENERATE_MESSAGES_TRUE@log_test_messages.h log_test_messages.cc: log_test_messages.mes +@GENERATE_MESSAGES_TRUE@ $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/log/tests/log_test_messages.mes + +@GENERATE_MESSAGES_FALSE@messages log_test_messages.h log_test_messages.cc: +@GENERATE_MESSAGES_FALSE@ @echo Messages generation disabled. Configure with --enable-generate-messages to enable it. + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/lib/log/tests/buffer_appender_unittest.cc b/src/lib/log/tests/buffer_appender_unittest.cc new file mode 100644 index 0000000..f52d833 --- /dev/null +++ b/src/lib/log/tests/buffer_appender_unittest.cc @@ -0,0 +1,138 @@ +// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> +#include <gtest/gtest.h> + +#include <log/macros.h> +#include <log/logger_support.h> +#include <log/log_messages.h> +#include <log/buffer_appender_impl.h> + +#include <log4cplus/loggingmacros.h> +#include <log4cplus/logger.h> +#include <log4cplus/nullappender.h> +#include <log4cplus/spi/loggingevent.h> + +using namespace isc::log; +using namespace isc::log::internal; + +namespace isc { +namespace log { + +/// \brief Specialized test class +/// +/// In order to test append() somewhat directly, this +/// class implements one more method (addEvent) +class TestBufferAppender : public BufferAppender { +public: + void addEvent(const log4cplus::spi::InternalLoggingEvent& event) { + append(event); + } +}; + +class BufferAppenderTest : public ::testing::Test { +protected: + BufferAppenderTest() : buffer_appender1(new TestBufferAppender()), + appender1(buffer_appender1), + buffer_appender2(new TestBufferAppender()), + appender2(buffer_appender2), + logger(log4cplus::Logger::getInstance("buffer")) + { + logger.setLogLevel(log4cplus::TRACE_LOG_LEVEL); + } + + ~BufferAppenderTest() { + // If any log messages are left, we don't care, get rid of them, + // by flushing them to a null appender + // Given the 'messages should not get lost' approach of the logging + // system, not flushing them to a null appender would cause them + // to be dumped to stdout as the test is destroyed, making + // unnecessarily messy test output. + log4cplus::SharedAppenderPtr null_appender( + new log4cplus::NullAppender()); + logger.removeAllAppenders(); + logger.addAppender(null_appender); + buffer_appender1->flush(); + buffer_appender2->flush(); + } + + TestBufferAppender* buffer_appender1; + log4cplus::SharedAppenderPtr appender1; + TestBufferAppender* buffer_appender2; + log4cplus::SharedAppenderPtr appender2; + log4cplus::Logger logger; +}; + +// Test that log events are indeed stored, and that they are +// flushed to the new appenders of their logger +TEST_F(BufferAppenderTest, flush) { + ASSERT_EQ(0, buffer_appender1->getBufferSize()); + ASSERT_EQ(0, buffer_appender2->getBufferSize()); + + // Create a Logger, log a few messages with the first appender + logger.addAppender(appender1); + LOG4CPLUS_INFO(logger, "Foo"); + ASSERT_EQ(1, buffer_appender1->getBufferSize()); + LOG4CPLUS_INFO(logger, "Foo"); + ASSERT_EQ(2, buffer_appender1->getBufferSize()); + LOG4CPLUS_INFO(logger, "Foo"); + ASSERT_EQ(3, buffer_appender1->getBufferSize()); + + // Second buffer should still be empty + ASSERT_EQ(0, buffer_appender2->getBufferSize()); + + // Replace the appender by the second one, and call flush; + // this should cause all events to be moved to the second buffer + logger.removeAllAppenders(); + logger.addAppender(appender2); + buffer_appender1->flush(); + ASSERT_EQ(0, buffer_appender1->getBufferSize()); + ASSERT_EQ(3, buffer_appender2->getBufferSize()); +} + +// Once flushed, logging new messages with the same buffer should fail +TEST_F(BufferAppenderTest, addAfterFlush) { + logger.addAppender(appender1); + buffer_appender1->flush(); + EXPECT_THROW(LOG4CPLUS_INFO(logger, "Foo"), LogBufferAddAfterFlush); + // It should not have been added + ASSERT_EQ(0, buffer_appender1->getBufferSize()); + + // But logging should work again as long as a different buffer is used + logger.removeAllAppenders(); + logger.addAppender(appender2); + LOG4CPLUS_INFO(logger, "Foo"); + ASSERT_EQ(1, buffer_appender2->getBufferSize()); +} + +TEST_F(BufferAppenderTest, addDirectly) { + // A few direct calls + log4cplus::spi::InternalLoggingEvent event("buffer", + log4cplus::INFO_LOG_LEVEL, + "Bar", "file", 123); + buffer_appender1->addEvent(event); + ASSERT_EQ(1, buffer_appender1->getBufferSize()); + + // Do one from a smaller scope to make sure destruction doesn't harm + { + log4cplus::spi::InternalLoggingEvent event2("buffer", + log4cplus::INFO_LOG_LEVEL, + "Bar", "file", 123); + buffer_appender1->addEvent(event2); + } + ASSERT_EQ(2, buffer_appender1->getBufferSize()); + + // And flush them to the next + logger.removeAllAppenders(); + logger.addAppender(appender2); + buffer_appender1->flush(); + ASSERT_EQ(0, buffer_appender1->getBufferSize()); + ASSERT_EQ(2, buffer_appender2->getBufferSize()); +} + +} +} diff --git a/src/lib/log/tests/buffer_logger_test.cc b/src/lib/log/tests/buffer_logger_test.cc new file mode 100644 index 0000000..956e2f1 --- /dev/null +++ b/src/lib/log/tests/buffer_logger_test.cc @@ -0,0 +1,66 @@ +// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/macros.h> +#include <log/logger_support.h> +#include <log/logger_manager.h> +#include <log/log_messages.h> +#include <log/interprocess/interprocess_sync_null.h> + +using namespace isc::log; + +namespace { +void usage() { + std::cout << "Usage: buffer_logger_test [-n]" << std::endl; +} +} // end unnamed namespace + +/// \brief Test InitLogger +/// +/// A program used in testing the logger that initializes logging with +/// buffering enabled, so that initial log messages are not immediately +/// logged, but are not lost (they should be logged the moment process() +/// is called. +/// +/// If -n is given as an argument, process() is never called. In this +/// case, upon exit, all leftover log messages should be printed to +/// stdout, but without normal logging additions (such as time and +/// logger name) +int +main(int argc, char** argv) { + bool do_process = true; + int opt; + while ((opt = getopt(argc, argv, "n")) != -1) { + switch (opt) { + case 'n': + do_process = false; + break; + default: + usage(); + return (1); + } + } + + // Note, level is INFO, so DEBUG should normally not show + // up. Unless process is never called (at which point it + // will end up in the dump at the end). + initLogger("buffertest", isc::log::INFO, 0, NULL, true); + Logger logger("log"); + // No need for file interprocess locking in this test + logger.setInterprocessSync( + new isc::log::interprocess::InterprocessSyncNull("logger")); + LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); + LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50"); + LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); + // process should cause them to be logged + if (do_process) { + LoggerManager logger_manager; + logger_manager.process(); + } + return (0); +} diff --git a/src/lib/log/tests/buffer_logger_test.sh.in b/src/lib/log/tests/buffer_logger_test.sh.in new file mode 100644 index 0000000..975df97 --- /dev/null +++ b/src/lib/log/tests/buffer_logger_test.sh.in @@ -0,0 +1,45 @@ +#!/bin/sh + +# Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that the initLogger() call uses for unit tests respects the setting of +# the buffer value + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/buffer_logger_test_tempfile_$$" + +printf 'Checking that buffer initialization works:\n' + +test_start 'buffer-logger.buffer-including-process()-call' +cat > $tempfile << . +INFO [buffertest.log] LOG_BAD_SEVERITY unrecognized log severity: info +INFO [buffertest.log] LOG_BAD_SEVERITY unrecognized log severity: info +. +./buffer_logger_test 2>&1 | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish 0 + +test_start 'buffer-logger.buffer-excluding-process()-call' +cat > $tempfile << . +INFO [buffertest.log]: LOG_BAD_SEVERITY unrecognized log severity: info +DEBUG [buffertest.log]: LOG_BAD_DESTINATION unrecognized log destination: debug-50 +INFO [buffertest.log]: LOG_BAD_SEVERITY unrecognized log severity: info +. +./buffer_logger_test -n 2>&1 | diff $tempfile - +test_finish 0 + +# Tidy up. +rm -f $tempfile diff --git a/src/lib/log/tests/console_test.sh.in b/src/lib/log/tests/console_test.sh.in new file mode 100644 index 0000000..7c5ebeb --- /dev/null +++ b/src/lib/log/tests/console_test.sh.in @@ -0,0 +1,54 @@ +#!/bin/sh + +# Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# The logger supports the idea of a "console" logger than logs to either stdout +# or stderr. This test checks that both these options work. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/console_test_tempfile_$$" + +# Look at tempfile and check that the count equals the expected count +passfail() { + count=$(wc -l $tempfile | awk '{print $1}') + if [ "${count}" -eq "${1}" ]; then + test_finish 0 + else + test_finish 1 + fi +} + +test_start 'console-output.stdout' +rm -f $tempfile +./logger_example -c stdout -s error 1> $tempfile 2> /dev/null +passfail 4 + +test_start 'console-output.stdout-not-stderr' +rm -f $tempfile +./logger_example -c stdout -s error 1> /dev/null 2> $tempfile +passfail 0 + +test_start 'console-output.stderr' +rm -f $tempfile +./logger_example -c stderr -s error 1> /dev/null 2> $tempfile +passfail 4 + +test_start 'console-output.stderr-not-stdout' +rm -f $tempfile +./logger_example -c stderr -s error 1> $tempfile 2> /dev/null +passfail 0 + +# Tidy up +rm -f $tempfile diff --git a/src/lib/log/tests/destination_test.sh.in b/src/lib/log/tests/destination_test.sh.in new file mode 100644 index 0000000..86fc415 --- /dev/null +++ b/src/lib/log/tests/destination_test.sh.in @@ -0,0 +1,85 @@ +#!/bin/sh + +# Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that the logger will route messages to the chosen destination. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/destination_test_tempfile_$$" +destfile1_tmp="@abs_builddir@/destination_test_destfile_1_tmp_$$" +destfile2_tmp="@abs_builddir@/destination_test_destfile_2_tmp_$$" +destfile1="@abs_builddir@/destination_test_destfile_1_$$" +destfile2="@abs_builddir@/destination_test_destfile_2_$$" + +printf '1. One logger, multiple destinations:\n' + +cat > $tempfile << . +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +. +rm -f $destfile1 $destfile2 +./logger_example -s error -f $destfile1_tmp -f $destfile2_tmp + +# strip the pids and thread ids +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile1_tmp > $destfile1 +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile2_tmp > $destfile2 +# strip the thread ids + +test_start 'logger-destination.one-logger-file-1' +cut -d' ' -f3- $destfile1 | diff $tempfile - +test_finish $? + +test_start 'logger-destination.one-logger-file-2' +cut -d' ' -f3- $destfile2 | diff $tempfile - +test_finish $? + +# Tidy up. +rm -f $tempfile $destfile1_tmp $destfile2_tmp $destfile1 $destfile2 + +printf '2. Two loggers, different destinations and severities:\n' +rm -f $destfile1 $destfile2 +./logger_example -l example -s info -f $destfile1_tmp -l alpha -s warn -f $destfile2_tmp + +# strip the pids and thread ids +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile1_tmp > $destfile1 +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile2_tmp > $destfile2 + +# All output for example and example.beta should have gone to destfile1. +# Output for example.alpha should have done to destfile2. + +test_start 'logger-destination.multiples-loggers-file-1' +cat > $tempfile << . +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +WARN [example] LOG_BAD_STREAM bad log console output stream: example +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +WARN [example.beta] LOG_BAD_STREAM bad log console output stream: beta_warn +INFO [example.beta] LOG_READ_ERROR error reading from message file beta: info +. +cut -d' ' -f3- $destfile1 | diff $tempfile - +test_finish $? + +test_start 'logger-destination.multiples-loggers-file-2' +cat > $tempfile << . +WARN [example.alpha] LOG_READ_ERROR error reading from message file a.txt: dummy reason +. +cut -d' ' -f3- $destfile2 | diff $tempfile - +test_finish $? + +# Tidy up. +rm -f $tempfile $destfile1_tmp $destfile2_tmp $destfile1 $destfile2 diff --git a/src/lib/log/tests/init_logger_test.cc b/src/lib/log/tests/init_logger_test.cc new file mode 100644 index 0000000..02862fd --- /dev/null +++ b/src/lib/log/tests/init_logger_test.cc @@ -0,0 +1,36 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/macros.h> +#include <log/logger_support.h> +#include <log/log_messages.h> + +using namespace isc::log; + +/// \brief Test InitLogger +/// +/// A program used in testing the logger that initializes logging using +/// initLogger(), then outputs several messages at different severities and +/// debug levels. An external script sets the environment variables and checks +/// that they have the desired effect. + +int +main(int, char**) { + initLogger(); + Logger logger("log"); + + LOG_DEBUG(logger, 0, LOG_BAD_DESTINATION).arg("debug-0"); + LOG_DEBUG(logger, 50, LOG_BAD_DESTINATION).arg("debug-50"); + LOG_DEBUG(logger, 99, LOG_BAD_DESTINATION).arg("debug-99"); + LOG_INFO(logger, LOG_BAD_SEVERITY).arg("info"); + LOG_WARN(logger, LOG_BAD_STREAM).arg("warn"); + LOG_ERROR(logger, LOG_DUPLICATE_MESSAGE_ID).arg("error"); + LOG_FATAL(logger, LOG_NO_MESSAGE_ID).arg("fatal"); + + return (0); +} diff --git a/src/lib/log/tests/init_logger_test.sh.in b/src/lib/log/tests/init_logger_test.sh.in new file mode 100644 index 0000000..348008d --- /dev/null +++ b/src/lib/log/tests/init_logger_test.sh.in @@ -0,0 +1,96 @@ +#!/bin/sh + +# Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that the initLogger() call uses for unit tests respects the setting of +# the environment variables. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/init_logger_test_tempfile_$$" +destfile_tmp="@abs_builddir@/init_logger_test_destfile_tmp_$$" +destfile="@abs_builddir@/init_logger_test_destfile_$$" + +printf '1. Checking that KEA_LOGGER_SEVERITY/KEA_LOGGER_DBGLEVEL work:\n' + +test_start 'init-logger.severity=DEBUG,dbglevel=99' +cat > $tempfile << . +DEBUG [kea.log] LOG_BAD_DESTINATION unrecognized log destination: debug-0 +DEBUG [kea.log] LOG_BAD_DESTINATION unrecognized log destination: debug-50 +DEBUG [kea.log] LOG_BAD_DESTINATION unrecognized log destination: debug-99 +INFO [kea.log] LOG_BAD_SEVERITY unrecognized log severity: info +WARN [kea.log] LOG_BAD_STREAM bad log console output stream: warn +ERROR [kea.log] LOG_DUPLICATE_MESSAGE_ID duplicate message ID (error) in compiled code +FATAL [kea.log] LOG_NO_MESSAGE_ID line fatal: message definition line found without a message ID +. +KEA_LOGGER_DESTINATION=stdout KEA_LOGGER_SEVERITY=DEBUG KEA_LOGGER_DBGLEVEL=99 ./init_logger_test | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +test_start 'init-logger.severity=DEBUG,dbglevel=50' +cat > $tempfile << . +DEBUG [kea.log] LOG_BAD_DESTINATION unrecognized log destination: debug-0 +DEBUG [kea.log] LOG_BAD_DESTINATION unrecognized log destination: debug-50 +INFO [kea.log] LOG_BAD_SEVERITY unrecognized log severity: info +WARN [kea.log] LOG_BAD_STREAM bad log console output stream: warn +ERROR [kea.log] LOG_DUPLICATE_MESSAGE_ID duplicate message ID (error) in compiled code +FATAL [kea.log] LOG_NO_MESSAGE_ID line fatal: message definition line found without a message ID +. +KEA_LOGGER_DESTINATION=stdout KEA_LOGGER_SEVERITY=DEBUG KEA_LOGGER_DBGLEVEL=50 ./init_logger_test | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +test_start 'init-logger.severity=WARN' +cat > $tempfile << . +WARN [kea.log] LOG_BAD_STREAM bad log console output stream: warn +ERROR [kea.log] LOG_DUPLICATE_MESSAGE_ID duplicate message ID (error) in compiled code +FATAL [kea.log] LOG_NO_MESSAGE_ID line fatal: message definition line found without a message ID +. +KEA_LOGGER_DESTINATION=stdout KEA_LOGGER_SEVERITY=WARN ./init_logger_test | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +printf '2. Checking that KEA_LOGGER_DESTINATION works:\n' + +test_start 'init-logger.stdout' +cat > $tempfile << . +FATAL [kea.log] LOG_NO_MESSAGE_ID line fatal: message definition line found without a message ID +. +rm -f $destfile_tmp $destfile +KEA_LOGGER_SEVERITY=FATAL KEA_LOGGER_DESTINATION=stdout ./init_logger_test 1> $destfile_tmp +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile_tmp > $destfile +cut -d' ' -f3- $destfile | diff $tempfile - +test_finish $? + +test_start 'init-logger.stderr' +rm -f $destfile_tmp $destfile +KEA_LOGGER_SEVERITY=FATAL KEA_LOGGER_DESTINATION=stderr ./init_logger_test 2> $destfile_tmp +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile_tmp > $destfile +cut -d' ' -f3- $destfile | diff $tempfile - +test_finish $? + +test_start 'init-logger.file' +rm -f $destfile_tmp $destfile +KEA_LOGGER_SEVERITY=FATAL KEA_LOGGER_DESTINATION=$destfile_tmp ./init_logger_test +sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' < $destfile_tmp > $destfile +cut -d' ' -f3- $destfile | diff $tempfile - +test_finish $? + +# Note: can't automatically test syslog output. + +# Tidy up. +rm -f $tempfile $destfile_tmp $destfile diff --git a/src/lib/log/tests/local_file_test.sh.in b/src/lib/log/tests/local_file_test.sh.in new file mode 100644 index 0000000..c1e7a53 --- /dev/null +++ b/src/lib/log/tests/local_file_test.sh.in @@ -0,0 +1,66 @@ +#!/bin/sh + +# Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that a local message file can override the definitions in the message +# dictionary. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +localmes="@abs_builddir@/localdef_mes_$$" +tempfile="@abs_builddir@/run_time_init_test_tempfile_$$" + +# Create the local message file for testing + +cat > $localmes << . +% LOG_NOTHERE this message is not in the global dictionary +% LOG_READ_ERROR replacement read error, parameters: '%1' and '%2' +% LOG_READING_LOCAL_FILE replacement read local message file, parameter is '%1' +. + +test_start 'local-file.local-message-replacement' +cat > $tempfile << . +WARN [example.log] LOG_NO_SUCH_MESSAGE could not replace message text for 'LOG_NOTHERE': no such message +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE replacement read local message file, parameter is 'dummy/file' +WARN [example] LOG_BAD_STREAM bad log console output stream: example +WARN [example.alpha] LOG_READ_ERROR replacement read error, parameters: 'a.txt' and 'dummy reason' +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +WARN [example.beta] LOG_BAD_STREAM bad log console output stream: beta_warn +. +./logger_example -c stdout -s warn $localmes | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +test_start 'local-file.read-error-reporting' +cat > $tempfile << . +ERROR [example.log] LOG_INPUT_OPEN_FAIL unable to open message file $localmes for input: No such file or directory +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +WARN [example] LOG_BAD_STREAM bad log console output stream: example +WARN [example.alpha] LOG_READ_ERROR error reading from message file a.txt: dummy reason +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +WARN [example.beta] LOG_BAD_STREAM bad log console output stream: beta_warn +. +rm -f $localmes +./logger_example -c stdout -s warn $localmes | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +# Tidy up. +rm -f $tempfile diff --git a/src/lib/log/tests/log_formatter_unittest.cc b/src/lib/log/tests/log_formatter_unittest.cc new file mode 100644 index 0000000..4bd0405 --- /dev/null +++ b/src/lib/log/tests/log_formatter_unittest.cc @@ -0,0 +1,181 @@ +// Copyright (C) 2011-2022 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> +#include <gtest/gtest.h> + +#include <util/unittests/resource.h> +#include <util/unittests/check_valgrind.h> + +#include <log/log_formatter.h> +#include <log/logger_level.h> + +#include <vector> +#include <string> + +using namespace std; + +namespace { + +class FormatterTest : public ::testing::Test { +protected: + typedef pair<isc::log::Severity, string> Output; + typedef isc::log::Formatter<FormatterTest> Formatter; + vector<Output> outputs; +public: + void output(const isc::log::Severity& prefix, const string& message) { + outputs.push_back(Output(prefix, message)); + } + // Just shortcut for new string + boost::shared_ptr<string> s(const char* text) { + return (boost::make_shared<string>(text)); + } +}; + +// Create an inactive formatter and check it doesn't produce any output +TEST_F(FormatterTest, inactive) { + Formatter(); + EXPECT_EQ(0, outputs.size()); +} + +// Create an active formatter and check it produces output. Does no arg +// substitution yet +TEST_F(FormatterTest, active) { + Formatter(isc::log::INFO, s("Text of message"), this); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("Text of message", outputs[0].second); +} + +// No output even when we have an arg on the inactive formatter +TEST_F(FormatterTest, inactiveArg) { + Formatter().arg("Hello"); + EXPECT_EQ(0, outputs.size()); +} + +// Create an active formatter and replace a placeholder with string +TEST_F(FormatterTest, stringArg) { + { + SCOPED_TRACE("C++ string"); + Formatter(isc::log::INFO, s("Hello %1"), this).arg(string("World")); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("Hello World", outputs[0].second); + } + { + SCOPED_TRACE("C++ string"); + Formatter(isc::log::INFO, s("Hello %1"), this).arg(string("Internet")); + ASSERT_EQ(2, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[1].first); + EXPECT_EQ("Hello Internet", outputs[1].second); + } +} + +// Test the .deactivate() method +TEST_F(FormatterTest, deactivate) { + Formatter(isc::log::INFO, s("Text of message"), this).deactivate(); + // If there was no .deactivate, it should have output it. + // But not now. + ASSERT_EQ(0, outputs.size()); +} + +// Can convert to string +TEST_F(FormatterTest, intArg) { + Formatter(isc::log::INFO, s("The answer is %1"), this).arg(42); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("The answer is 42", outputs[0].second); +} + +// Can use multiple arguments at different places +TEST_F(FormatterTest, multiArg) { + Formatter(isc::log::INFO, s("The %2 are %1"), this).arg("switched"). + arg("arguments"); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("The arguments are switched", outputs[0].second); +} + +#ifdef ENABLE_LOGGER_CHECKS + +TEST_F(FormatterTest, mismatchedPlaceholders) { + // Throws MismatchedPlaceholders exception if the placeholder is missing + // for a supplied argument. + EXPECT_THROW(Formatter(isc::log::INFO, s("Missing the second %1"), this). + arg("argument").arg("missing"), + isc::log::MismatchedPlaceholders); + +#ifdef EXPECT_DEATH + // Likewise, if there's a redundant placeholder (or missing argument), the + // check detects it and aborts the program. Due to the restriction of the + // current implementation, it doesn't throw. + if (!isc::util::unittests::runningOnValgrind()) { + EXPECT_DEATH({ + isc::util::unittests::dontCreateCoreDumps(); + Formatter(isc::log::INFO, s("Too many arguments in %1 %2"), this). + arg("only one"); + }, ".*"); + } +#endif /* EXPECT_DEATH */ + // Mixed case of above two: the exception will be thrown due to the missing + // placeholder. The other check is disabled due to that. + EXPECT_THROW(Formatter(isc::log::INFO, s("Missing the first %2"), this). + arg("missing").arg("argument"), + isc::log::MismatchedPlaceholders); +} + +#else + +// If logger checks are not enabled, nothing is thrown +TEST_F(FormatterTest, mismatchedPlaceholders) { + Formatter(isc::log::INFO, s("Missing the second %1"), this). + arg("argument").arg("missing"); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("Missing the second argument " + "@@Missing logger placeholder '%2' for value 'missing'@@", + outputs[0].second); + + EXPECT_NO_THROW(Formatter(isc::log::INFO, + s("Too many arguments in %1 %2"), this). + arg("only one")); + ASSERT_EQ(2, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[1].first); + EXPECT_EQ("Too many arguments in only one %2 " + "@@Excess logger placeholder '%2' still exists@@", + outputs[1].second); + + EXPECT_NO_THROW(Formatter(isc::log::INFO, s("Missing the first %2"), this). + arg("missing").arg("argument")); + ASSERT_EQ(3, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[2].first); + EXPECT_EQ("Missing the first argument " + "@@Missing logger placeholder '%1' for value 'missing'@@", + outputs[2].second); +} + +#endif /* ENABLE_LOGGER_CHECKS */ + +// Can replace multiple placeholders +TEST_F(FormatterTest, multiPlaceholder) { + Formatter(isc::log::INFO, s("The %1 is the %1"), this). + arg("first rule of tautology club"); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("The first rule of tautology club is " + "the first rule of tautology club", outputs[0].second); +} + +// Test we can cope with replacement containing the placeholder +TEST_F(FormatterTest, noRecurse) { + // If we recurse, this will probably eat all the memory and crash + Formatter(isc::log::INFO, s("%1"), this).arg("%1 %1"); + ASSERT_EQ(1, outputs.size()); + EXPECT_EQ(isc::log::INFO, outputs[0].first); + EXPECT_EQ("%1 %1", outputs[0].second); +} + +} diff --git a/src/lib/log/tests/log_test_messages.cc b/src/lib/log/tests/log_test_messages.cc new file mode 100644 index 0000000..5cb25ad --- /dev/null +++ b/src/lib/log/tests/log_test_messages.cc @@ -0,0 +1,25 @@ +// File created from ../../../../src/lib/log/tests/log_test_messages.mes + +#include <cstddef> +#include <log/message_types.h> +#include <log/message_initializer.h> + +namespace isc { +namespace log { + +extern const isc::log::MessageID LOG_LOCK_TEST_MESSAGE = "LOG_LOCK_TEST_MESSAGE"; + +} // namespace log +} // namespace isc + +namespace { + +const char* values[] = { + "LOG_LOCK_TEST_MESSAGE", "this is a test message.", + NULL +}; + +const isc::log::MessageInitializer initializer(values); + +} // Anonymous namespace + diff --git a/src/lib/log/tests/log_test_messages.h b/src/lib/log/tests/log_test_messages.h new file mode 100644 index 0000000..96553f5 --- /dev/null +++ b/src/lib/log/tests/log_test_messages.h @@ -0,0 +1,16 @@ +// File created from ../../../../src/lib/log/tests/log_test_messages.mes + +#ifndef LOG_TEST_MESSAGES_H +#define LOG_TEST_MESSAGES_H + +#include <log/message_types.h> + +namespace isc { +namespace log { + +extern const isc::log::MessageID LOG_LOCK_TEST_MESSAGE; + +} // namespace log +} // namespace isc + +#endif // LOG_TEST_MESSAGES_H diff --git a/src/lib/log/tests/log_test_messages.mes b/src/lib/log/tests/log_test_messages.mes new file mode 100644 index 0000000..f7bee43 --- /dev/null +++ b/src/lib/log/tests/log_test_messages.mes @@ -0,0 +1,18 @@ +# Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# \brief Message Utility Message File +# +# This is the source of the set of messages generated by the message and +# logging components. The associated .h and .cc files are created by hand from +# this file though and are not built during the build process; this is to avoid +# the chicken-and-egg situation where we need the files to build the message +# compiler, yet we need the compiler to build the files. + +$NAMESPACE isc::log + +% LOG_LOCK_TEST_MESSAGE this is a test message. +This is a log message used in testing. diff --git a/src/lib/log/tests/logger_example.cc b/src/lib/log/tests/logger_example.cc new file mode 100644 index 0000000..ff3d512 --- /dev/null +++ b/src/lib/log/tests/logger_example.cc @@ -0,0 +1,306 @@ +// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +/// \brief Example Program +/// +/// Simple example program showing how to use the logger. The various +/// command-line options let most aspects of the logger be exercised, so +/// making this a useful tool for testing. +/// +/// See the usage() method for details of use. + +#include <config.h> + +#include <stdlib.h> +#include <unistd.h> +#include <string.h> + +#include <boost/lexical_cast.hpp> + +#include <iostream> +#include <string> +#include <vector> + +#include <util/strutil.h> + +#include <log/logger.h> +#include <log/logger_level.h> +#include <log/logger_manager.h> +#include <log/logger_name.h> +#include <log/logger_specification.h> +#include <log/macros.h> + +// Include a set of message definitions. +#include <log/log_messages.h> +#include <log/interprocess/interprocess_sync_null.h> + +using namespace isc::log; +using namespace std; +using isc::log::interprocess::InterprocessSyncNull; + +// Print usage information + +void usage() { + cout << +"logger_support_test [-h | [logger_spec] [[logger_spec]...]]\n" +"\n" +" -h Print this message and exit\n" +"\n" +"The rest of the command line comprises the set of logger specifications.\n" +"Each specification is of the form:\n" +"\n" +" -l logger [-s severity] [-d dbglevel] output_spec] [[output_spec] ...\n" +"\n" +"where:\n" +"\n" +" -l logger Give the name of the logger to which the following\n" +" output specifications will apply.\n" +"\n" +"Each logger is followed by the indication of the severity it is logging\n" +"and, if applicable, its debug level:\n" +"\n" +" -d dbglevel Debug level. Only interpreted if the severity is 'debug'\n" +" this is a number between 0 and 99.\n" +" -s severity Set the severity of messages output. 'severity' is one\n" +" of 'debug', 'info', 'warn', 'error', 'fatal', the default\n" +" being 'info'.\n" +"\n" +"The output specifications - there may be more than one per logger - detail\n" +"the output streams attached to the logger. These are of the form:\n" +"\n" +" -c stream | -f file [-m maxver] [-z maxsize] | -y facility\n" +"\n" +"These are:\n" +"\n" +" -c stream Send output to the console. 'stream' is one of 'stdout'\n" +" of 'stderr'.\n" +" -f file Send output to specified file, appending to existing file\n" +" if one exists.\n" +" -y facility Send output to the syslog file with the given facility\n" +" name (e.g. local1, cron etc.)\n" +"\n" +"The following can be specified for the file logger:\n" +"\n" +" -m maxver If file rolling is selected (by the maximum file size being\n" +" non-zero), the maximum number of versions to keep (defaults\n" +" to 0)\n" +" -z maxsize Maximum size of the file before the file is closed and a\n" +" new one opened. The default of 0 means no maximum size.\n" +"\n" +"If none of -c, -f or -y is given, by default, output is sent to stdout. If no\n" +"logger is specified, the default is the program's root logger ('example').\n"; + +} + + +// The program sets the attributes on the root logger and logs a set of +// messages. Looking at the output determines whether the program worked. + +int main(int argc, char** argv) { + const char* ROOT_NAME = "example"; + + bool sw_found = false; // Set true if switch found + bool c_found = false; // Set true if "-c" found + bool f_found = false; // Set true if "-f" found + bool y_found = false; // Set true if "-y" found + int option; // For getopt() processing + OutputOption def_opt; // Default output option - used + // for initialization + LoggerSpecification cur_spec(ROOT_NAME);// Current specification + OutputOption cur_opt; // Current output option + vector<LoggerSpecification> loggers; // Set of logger specifications + std::string severity; // Severity set for logger + + // Initialize logging system - set the root logger name. + LoggerManager manager; + manager.init(ROOT_NAME); + + // In the parsing loop that follows, the construction of the logging + // specification is always "one behind". In other words, the parsing of + // command-line options updates the current logging specification/output + // options. When the flag indicating a new logger or output specification + // is encountered, the previous one is added to the list. + // + // One complication is that there is deemed to be a default active when + // the parsing starts (console output for the Kea root logger). This + // is included in the logging specifications UNLESS the first switch on + // the command line is a "-l" flag starting a new logger. To track this, + // the "sw_found" flag is set when a switch is completely processed. The + // processing of "-l" will only add information for a previous logger to + // the list if this flag is set. + while ((option = getopt(argc, argv, "hc:d:f:l:m:s:y:z:")) != -1) { + switch (option) { + case 'c': // Console output + // New output spec. If one was currently active, add it to the + // list and reset the current output option to the defaults. + if (c_found || f_found || y_found) { + cur_spec.addOutputOption(cur_opt); + cur_opt = def_opt; + f_found = y_found = false; + } + + // Set the output option for this switch. + c_found = true; + cur_opt.destination = OutputOption::DEST_CONSOLE; + if (strcmp(optarg, "stdout") == 0) { + cur_opt.stream = OutputOption::STR_STDOUT; + + } else if (strcmp(optarg, "stderr") == 0) { + cur_opt.stream = OutputOption::STR_STDERR; + + } else { + cerr << "Unrecognized console option: " << optarg << "\n"; + return (1); + } + break; + + case 'd': // Debug level + cur_spec.setDbglevel(boost::lexical_cast<int>(optarg)); + break; + + case 'f': // File output specification + // New output spec. If one was currently active, add it to the + // list and reset the current output option to the defaults. + if (c_found || f_found || y_found) { + cur_spec.addOutputOption(cur_opt); + cur_opt = def_opt; + c_found = y_found = false; + } + + // Set the output option for this switch. + f_found = true; + cur_opt.destination = OutputOption::DEST_FILE; + cur_opt.filename = optarg; + break; + + case 'h': // Help + usage(); + return (0); + + case 'l': // Logger + // If a current specification is active, add the last output option + // to it, add it to the list and reset. A specification is active + // if at least one switch has been previously found. + if (sw_found) { + cur_spec.addOutputOption(cur_opt); + loggers.push_back(cur_spec); + cur_spec.reset(); + } + + // Set the logger name + cur_spec.setName(std::string(optarg)); + + // Reset the output option to the default. + cur_opt = def_opt; + + // Indicate nothing is found to prevent the console option (the + // default output option) being added to the output list if an + // output option is found. + c_found = f_found = y_found = false; + break; + + case 'm': // Maximum file version + if (!f_found) { + std::cerr << "Attempt to set maximum version (-m) " + "outside of file output specification\n"; + return (1); + } + try { + cur_opt.maxver = boost::lexical_cast<unsigned int>(optarg); + } catch (const boost::bad_lexical_cast&) { + std::cerr << "Maximum version (-m) argument must be a positive " + "integer\n"; + return (1); + } + break; + + case 's': // Severity + severity = optarg; + isc::util::str::uppercase(severity); + cur_spec.setSeverity(getSeverity(severity)); + break; + + case 'y': // Syslog output + // New output spec. If one was currently active, add it to the + // list and reset the current output option to the defaults. + if (c_found || f_found || y_found) { + cur_spec.addOutputOption(cur_opt); + cur_opt = def_opt; + c_found = f_found = false; + } + y_found = true; + cur_opt.destination = OutputOption::DEST_SYSLOG; + cur_opt.facility = optarg; + break; + + case 'z': // Maximum size + if (! f_found) { + std::cerr << "Attempt to set file size (-z) " + "outside of file output specification\n"; + return (1); + } + try { + cur_opt.maxsize = boost::lexical_cast<size_t>(optarg); + } catch (const boost::bad_lexical_cast&) { + std::cerr << "File size (-z) argument must be a positive " + "integer\n"; + return (1); + } + break; + + + default: + std::cerr << "Unrecognized option: " << + static_cast<char>(option) << "\n"; + return (1); + } + + // Have found at least one command-line switch, so note the fact. + sw_found = true; + } + + // Add the current (unfinished specification) to the list. + cur_spec.addOutputOption(cur_opt); + loggers.push_back(cur_spec); + + // Set the logging options. + manager.process(loggers.begin(), loggers.end()); + + // Set the local file + if (optind < argc) { + LoggerManager::readLocalMessageFile(argv[optind]); + } + + // Log a few messages to different loggers. Here, we switch to using + // null interprocess sync objects for the loggers below as the + // logger example can be used as a standalone program (which may not + // have write access to a local state directory to create + // lockfiles). + isc::log::Logger logger_ex(ROOT_NAME); + logger_ex.setInterprocessSync(new InterprocessSyncNull("logger")); + isc::log::Logger logger_alpha("alpha"); + logger_alpha.setInterprocessSync(new InterprocessSyncNull("logger")); + isc::log::Logger logger_beta("beta"); + logger_beta.setInterprocessSync(new InterprocessSyncNull("logger")); + + LOG_FATAL(logger_ex, LOG_WRITE_ERROR).arg("test1").arg("42"); + LOG_ERROR(logger_ex, LOG_READING_LOCAL_FILE).arg("dummy/file"); + LOG_WARN(logger_ex, LOG_BAD_STREAM).arg("example"); + LOG_WARN(logger_alpha, LOG_READ_ERROR).arg("a.txt").arg("dummy reason"); + LOG_INFO(logger_alpha, LOG_INPUT_OPEN_FAIL).arg("example.msg").arg("dummy reason"); + LOG_DEBUG(logger_ex, 0, LOG_READING_LOCAL_FILE).arg("example/0"); + LOG_DEBUG(logger_ex, 24, LOG_READING_LOCAL_FILE).arg("example/24"); + LOG_DEBUG(logger_ex, 25, LOG_READING_LOCAL_FILE).arg("example/25"); + LOG_DEBUG(logger_ex, 26, LOG_READING_LOCAL_FILE).arg("example/26"); + LOG_FATAL(logger_beta, LOG_BAD_SEVERITY).arg("beta_fatal"); + LOG_ERROR(logger_beta, LOG_BAD_DESTINATION).arg("beta_error"); + LOG_WARN(logger_beta, LOG_BAD_STREAM).arg("beta_warn"); + LOG_INFO(logger_beta, LOG_READ_ERROR).arg("beta").arg("info"); + LOG_DEBUG(logger_beta, 25, LOG_BAD_SEVERITY).arg("beta/25"); + LOG_DEBUG(logger_beta, 26, LOG_BAD_SEVERITY).arg("beta/26"); + + return (0); +} diff --git a/src/lib/log/tests/logger_level_impl_unittest.cc b/src/lib/log/tests/logger_level_impl_unittest.cc new file mode 100644 index 0000000..c82be69 --- /dev/null +++ b/src/lib/log/tests/logger_level_impl_unittest.cc @@ -0,0 +1,168 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <iostream> +#include <string> + +#include <gtest/gtest.h> +#include <boost/static_assert.hpp> +#include <boost/lexical_cast.hpp> + +#include <log/logger_level_impl.h> +#include <log/logger_support.h> +#include <log4cplus/logger.h> + +using namespace isc::log; +using namespace std; + +class LoggerLevelImplTest : public ::testing::Test { +protected: + LoggerLevelImplTest() { + // Ensure logging set to default for unit tests + setDefaultLoggingOutput(); + } + + ~LoggerLevelImplTest() + {} +}; + + +// Checks that the log4cplus and Kea levels convert correctly +TEST_F(LoggerLevelImplTest, DefaultConversionFromBind) { + log4cplus::LogLevel fatal = + LoggerLevelImpl::convertFromBindLevel(Level(FATAL)); + EXPECT_EQ(log4cplus::FATAL_LOG_LEVEL, fatal); + + log4cplus::LogLevel error = + LoggerLevelImpl::convertFromBindLevel(Level(ERROR)); + EXPECT_EQ(log4cplus::ERROR_LOG_LEVEL, error); + + log4cplus::LogLevel warn = + LoggerLevelImpl::convertFromBindLevel(Level(WARN)); + EXPECT_EQ(log4cplus::WARN_LOG_LEVEL, warn); + + log4cplus::LogLevel info = + LoggerLevelImpl::convertFromBindLevel(Level(INFO)); + EXPECT_EQ(log4cplus::INFO_LOG_LEVEL, info); + + log4cplus::LogLevel debug = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL, debug); +} + +// Checks that the debug severity and level converts correctly +TEST_F(LoggerLevelImplTest, DebugConversionFromBind) { + log4cplus::LogLevel debug0 = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG, 0)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - 0, debug0); + + log4cplus::LogLevel debug1 = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG, 1)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - 1, debug1); + + log4cplus::LogLevel debug99 = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG, 99)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - 99, debug99); + + // Out of range should be coerced to the nearest boundary + log4cplus::LogLevel debug_1 = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG, MIN_DEBUG_LEVEL - 1)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL, debug_1); + + log4cplus::LogLevel debug100 = + LoggerLevelImpl::convertFromBindLevel(Level(DEBUG, MAX_DEBUG_LEVEL + 1)); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - MAX_DEBUG_LEVEL, debug100); +} + +// Do the checks the other way +static void +test_convert_to(const char* trace, isc::log::Severity severity, int dbglevel, + log4cplus::LogLevel level) +{ + SCOPED_TRACE(trace); + Level test = LoggerLevelImpl::convertToBindLevel(level); + EXPECT_EQ(severity, test.severity); + EXPECT_EQ(dbglevel, test.dbglevel); +} + +TEST_F(LoggerLevelImplTest, ConversionToBind) { + test_convert_to("FATAL", FATAL, MIN_DEBUG_LEVEL, log4cplus::FATAL_LOG_LEVEL); + test_convert_to("ERROR", ERROR, MIN_DEBUG_LEVEL, log4cplus::ERROR_LOG_LEVEL); + test_convert_to("WARN", WARN , MIN_DEBUG_LEVEL, log4cplus::WARN_LOG_LEVEL); + test_convert_to("INFO", INFO , MIN_DEBUG_LEVEL, log4cplus::INFO_LOG_LEVEL); + test_convert_to("DEBUG", DEBUG, MIN_DEBUG_LEVEL, log4cplus::DEBUG_LOG_LEVEL); + + test_convert_to("DEBUG0", DEBUG, MIN_DEBUG_LEVEL + 0, + (log4cplus::DEBUG_LOG_LEVEL)); + test_convert_to("DEBUG1", DEBUG, MIN_DEBUG_LEVEL + 1, + (log4cplus::DEBUG_LOG_LEVEL - 1)); + test_convert_to("DEBUG2", DEBUG, MIN_DEBUG_LEVEL + 2, + (log4cplus::DEBUG_LOG_LEVEL - 2)); + test_convert_to("DEBUG99", DEBUG, MIN_DEBUG_LEVEL + 99, + (log4cplus::DEBUG_LOG_LEVEL - 99)); + + // ... and some invalid valid values + test_convert_to("DEBUG-1", INFO, MIN_DEBUG_LEVEL, + (log4cplus::DEBUG_LOG_LEVEL + 1)); + BOOST_STATIC_ASSERT(MAX_DEBUG_LEVEL == 99); + test_convert_to("DEBUG+100", DEFAULT, 0, + (log4cplus::DEBUG_LOG_LEVEL - MAX_DEBUG_LEVEL - 1)); +} + +// Check that we can convert from a string to the new log4cplus levels +TEST_F(LoggerLevelImplTest, FromString) { + + // Test all valid values + for (int i = MIN_DEBUG_LEVEL; i <= MAX_DEBUG_LEVEL; ++i) { + std::string token = string("DEBUG") + boost::lexical_cast<std::string>(i); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - i, + LoggerLevelImpl::logLevelFromString(token)); + } + + // ... in lowercase too + for (int i = MIN_DEBUG_LEVEL; i <= MAX_DEBUG_LEVEL; ++i) { + std::string token = string("debug") + boost::lexical_cast<std::string>(i); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - i, + LoggerLevelImpl::logLevelFromString(token)); + } + + // A few below the minimum + for (int i = MIN_DEBUG_LEVEL - 5; i < MIN_DEBUG_LEVEL; ++i) { + std::string token = string("DEBUG") + boost::lexical_cast<std::string>(i); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL, LoggerLevelImpl::logLevelFromString(token)); + } + + // ... and above the maximum + for (int i = MAX_DEBUG_LEVEL + 1; i < MAX_DEBUG_LEVEL + 5; ++i) { + std::string token = string("DEBUG") + boost::lexical_cast<std::string>(i); + EXPECT_EQ(log4cplus::DEBUG_LOG_LEVEL - MAX_DEBUG_LEVEL, + LoggerLevelImpl::logLevelFromString(token)); + } + + // Invalid strings. + EXPECT_EQ(log4cplus::NOT_SET_LOG_LEVEL, + LoggerLevelImpl::logLevelFromString("DEBU")); + EXPECT_EQ(log4cplus::NOT_SET_LOG_LEVEL, + LoggerLevelImpl::logLevelFromString("unrecognized")); +} + +// ... and check the conversion back again. All levels should convert to "DEBUG". +TEST_F(LoggerLevelImplTest, ToString) { + + for (int i = MIN_DEBUG_LEVEL; i <= MAX_DEBUG_LEVEL; ++i) { + EXPECT_EQ(std::string("DEBUG"), + LoggerLevelImpl::logLevelToString(log4cplus::DEBUG_LOG_LEVEL - i)); + } + + // ... and that out of range stuff returns an empty string. + EXPECT_EQ(std::string(), + LoggerLevelImpl::logLevelToString(log4cplus::DEBUG_LOG_LEVEL + 1)); + EXPECT_EQ(std::string(), + LoggerLevelImpl::logLevelToString( + log4cplus::DEBUG_LOG_LEVEL - MAX_DEBUG_LEVEL - 100)); +} diff --git a/src/lib/log/tests/logger_level_unittest.cc b/src/lib/log/tests/logger_level_unittest.cc new file mode 100644 index 0000000..ccaecd9 --- /dev/null +++ b/src/lib/log/tests/logger_level_unittest.cc @@ -0,0 +1,78 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <iostream> +#include <string> + +#include <gtest/gtest.h> + +#include <log/logger.h> +#include <log/logger_manager.h> +#include <log/log_messages.h> +#include <log/logger_support.h> + +using namespace isc; +using namespace isc::log; +using namespace std; + +class LoggerLevelTest : public ::testing::Test { +protected: + LoggerLevelTest() { + // Logger initialization is done in main(). As logging tests may + // alter the default logging output, it is reset here. + setDefaultLoggingOutput(); + } + ~LoggerLevelTest() { + LoggerManager::reset(); + } +}; + + +// Checks that the logger is named correctly. + +TEST_F(LoggerLevelTest, Creation) { + + // Default + isc::log::Level level1; + EXPECT_EQ(isc::log::DEFAULT, level1.severity); + EXPECT_EQ(isc::log::MIN_DEBUG_LEVEL, level1.dbglevel); + + // Single argument constructor. + isc::log::Level level2(isc::log::FATAL); + EXPECT_EQ(isc::log::FATAL, level2.severity); + EXPECT_EQ(isc::log::MIN_DEBUG_LEVEL, level2.dbglevel); + + // Two-argument constructor + isc::log::Level level3(isc::log::DEBUG, 42); + EXPECT_EQ(isc::log::DEBUG, level3.severity); + EXPECT_EQ(42, level3.dbglevel); +} + +TEST_F(LoggerLevelTest, getSeverity) { + EXPECT_EQ(DEBUG, getSeverity("DEBUG")); + EXPECT_EQ(DEBUG, getSeverity("debug")); + EXPECT_EQ(DEBUG, getSeverity("DeBuG")); + EXPECT_EQ(INFO, getSeverity("INFO")); + EXPECT_EQ(INFO, getSeverity("info")); + EXPECT_EQ(INFO, getSeverity("iNfO")); + EXPECT_EQ(WARN, getSeverity("WARN")); + EXPECT_EQ(WARN, getSeverity("warn")); + EXPECT_EQ(WARN, getSeverity("wARn")); + EXPECT_EQ(ERROR, getSeverity("ERROR")); + EXPECT_EQ(ERROR, getSeverity("error")); + EXPECT_EQ(ERROR, getSeverity("ERRoR")); + EXPECT_EQ(FATAL, getSeverity("FATAL")); + EXPECT_EQ(FATAL, getSeverity("fatal")); + EXPECT_EQ(FATAL, getSeverity("FAtaL")); + + // bad values should default to stdout + EXPECT_EQ(INFO, getSeverity("some bad value")); + EXPECT_EQ(INFO, getSeverity("")); + + LoggerManager::reset(); +} diff --git a/src/lib/log/tests/logger_lock_test.cc b/src/lib/log/tests/logger_lock_test.cc new file mode 100644 index 0000000..9908800 --- /dev/null +++ b/src/lib/log/tests/logger_lock_test.cc @@ -0,0 +1,101 @@ +// Copyright (C) 2012-2019 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/macros.h> +#include <log/logger_support.h> +#include <log/logger_manager.h> +#include <log/log_messages.h> +#include <log/interprocess/interprocess_sync.h> +#include <log/tests/log_test_messages.h> + +#include <mutex> +#include <iostream> + +#include <boost/noncopyable.hpp> + +using namespace std; +using namespace isc::log; + +/// \brief RAII safe mutex checker. +class CheckMutex : boost::noncopyable { +public: + /// \brief Exception thrown when the mutex is already locked. + struct AlreadyLocked : public isc::InvalidParameter { + AlreadyLocked(const char* file, size_t line, const char* what) : + isc::InvalidParameter(file, line, what) + {} + }; + + /// \brief Constructor. + /// + /// \throw AlreadyLocked if the mutex is already locked. + CheckMutex(mutex& mutex) : mutex_(mutex) { + if (!mutex.try_lock()) { + isc_throw(AlreadyLocked, "The mutex is already locked"); + } + } + + /// \brief Destructor. + /// + /// Unlocks the mutex. + ~CheckMutex() { + mutex_.unlock(); + } + +private: + mutex& mutex_; +}; + +class MockLoggingSync : public isc::log::interprocess::InterprocessSync { +public: + /// \brief Constructor + MockLoggingSync(const std::string& component_name) : + InterprocessSync(component_name) + {} + +protected: + virtual bool lock() { + // We first check if the logger acquired a lock on the + // LoggerManager mutex. + try { + CheckMutex check(LoggerManager::getMutex()); + } catch (const CheckMutex::AlreadyLocked&) { + cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: MUTEXLOCK\n"; + } + + cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: LOCK\n"; + return (true); + } + + virtual bool tryLock() { + cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: TRYLOCK\n"; + return (true); + } + + virtual bool unlock() { + cout << "FIELD1 FIELD2 LOGGER_LOCK_TEST: UNLOCK\n"; + return (true); + } +}; + +/// \brief Test logger lock sequence +/// +/// A program used in testing the logger. It verifies that (1) an +/// interprocess sync lock is first acquired by the logger, (2) the +/// message is logged by the logger, and (3) the lock is released in +/// that sequence. +int +main(int, char**) { + initLogger(); + Logger logger("log"); + logger.setInterprocessSync(new MockLoggingSync("log")); + + LOG_INFO(logger, LOG_LOCK_TEST_MESSAGE); + + return (0); +} diff --git a/src/lib/log/tests/logger_lock_test.sh.in b/src/lib/log/tests/logger_lock_test.sh.in new file mode 100644 index 0000000..2cea0f0 --- /dev/null +++ b/src/lib/log/tests/logger_lock_test.sh.in @@ -0,0 +1,38 @@ +#!/bin/sh + +# Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that the locker interprocess sync locks are acquired and +# released correctly. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/logger_lock_test_tempfile_$$" +destfile="@abs_builddir@/logger_lock_test_destfile_$$" + +test_start 'logger_lock' +cat > $tempfile << . +LOGGER_LOCK_TEST: MUTEXLOCK +LOGGER_LOCK_TEST: LOCK +INFO [kea.log] LOG_LOCK_TEST_MESSAGE this is a test message. +LOGGER_LOCK_TEST: UNLOCK +. +rm -f $destfile +KEA_LOGGER_SEVERITY=INFO KEA_LOGGER_DESTINATION=stdout ./logger_lock_test | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' > $destfile +cut -d' ' -f3- $destfile | diff $tempfile - +test_finish $? + +# Tidy up. +rm -f $tempfile $destfile diff --git a/src/lib/log/tests/logger_manager_unittest.cc b/src/lib/log/tests/logger_manager_unittest.cc new file mode 100644 index 0000000..6bde1db --- /dev/null +++ b/src/lib/log/tests/logger_manager_unittest.cc @@ -0,0 +1,511 @@ +// Copyright (C) 2011-2022 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <stdio.h> +#include <unistd.h> + +#include <fstream> +#include <iostream> +#include <string> + +#include <gtest/gtest.h> + +#include <boost/scoped_array.hpp> +#include <boost/lexical_cast.hpp> + +#include <exceptions/exceptions.h> + +#include <log/macros.h> +#include <log/log_messages.h> +#include <log/logger.h> +#include <log/logger_level.h> +#include <log/logger_manager.h> +#include <log/logger_name.h> +#include <log/logger_specification.h> +#include <log/message_initializer.h> +#include <log/output_option.h> +#include <log/tests/tempdir.h> +#include <testutils/gtest_utils.h> + +#include <sys/types.h> +#include <regex.h> + +using namespace isc; +using namespace isc::log; +using namespace std; + +/// \brief LoggerManager Test +class LoggerManagerTest : public ::testing::Test { +public: + LoggerManagerTest() { + // Initialization of logging is done in main() + } + + ~LoggerManagerTest() { + LoggerManager::reset(); + } +}; + +// Convenience class to create the specification for the logger "filelogger", +// which, as the name suggests, logs to a file. It remembers the file name and +// deletes the file when instance of the class is destroyed. +class SpecificationForFileLogger { +public: + + // Constructor - allocate file and create the specification object + SpecificationForFileLogger() : spec_(), name_(createTempFilename()), + logname_("filelogger") { + + // Set the output to a temporary file. + OutputOption option; + option.destination = OutputOption::DEST_FILE; + option.filename = name_; + + // Set target output to the file logger. The defaults indicate + // INFO severity. + spec_.setName(logname_); + spec_.addOutputOption(option); + } + + // Destructor, remove the file. This is only a test, so ignore failures + ~SpecificationForFileLogger() { + if (! name_.empty()) { + static_cast<void>(remove(name_.c_str())); + + // Depending on the log4cplus version, a lock file may also be + // created. + static_cast<void>(remove((name_ + ".lock").c_str())); + } + } + + // Return reference to the logging specification for this loggger + LoggerSpecification& getSpecification() { + return spec_; + } + + // Return name of the logger + string getLoggerName() const { + return logname_; + } + + // Return name of the file + string getFileName() const { + return name_; + } + + // Create temporary filename + // + // The compiler warns against tmpnam() and suggests mkstemp instead. + // Unfortunately, this creates the filename and opens it. So we need to + // close and delete the file before returning the name. Also, the name + // is based on the template supplied and the name of the temporary + // directory may vary between systems. So translate TMPDIR and if that + // does not exist, use /tmp. + // + // \return Temporary file name + static std::string createTempFilename() { + string filename = TEMP_DIR + "/kea_logger_manager_test_XXXXXX"; + + // Copy into writable storage for the call to mkstemp + boost::scoped_array<char> tname(new char[filename.size() + 1]); + strcpy(tname.get(), filename.c_str()); + + // Create file, close and delete it, and store the name for later. + // There is still a race condition here, albeit a small one. + int filenum = mkstemp(tname.get()); + if (filenum == -1) { + isc_throw(Exception, "Unable to obtain unique filename"); + } + close(filenum); + + return (string(tname.get())); + } + + +private: + LoggerSpecification spec_; // Specification for this file logger + string name_; // Name of the output file + string logname_; // Name of this logger +}; + +// Convenience function to read an output log file and check that each line +// contains the expected message ID +// +// \param filename Name of the file to check +// \param start Iterator pointing to first expected message ID +// \param finish Iterator pointing to last expected message ID +template <typename T> +void checkFileContents(const std::string& filename, T start, T finish) { + + // Access the file for input + ifstream infile(filename.c_str()); + if (! infile.good()) { + FAIL() << "Unable to open the logging file " << filename; + } + + // Iterate round the expected message IDs and check that they appear in + // the string. + string line; // Line read from the file + + T i = start; // Iterator + getline(infile, line); + int lineno = 1; + + while ((i != finish) && (infile.good())) { + + // Check that the message ID appears in the line. + EXPECT_TRUE(line.find(string(*i)) != string::npos) + << "Expected to find " << string(*i) << " on line " << lineno + << " of logging file " << filename; + + // Go for the next line + ++i; + getline(infile, line); + ++lineno; + } + + // Why did the loop end? + EXPECT_TRUE(i == finish) << "Did not reach the end of the message ID list"; + EXPECT_TRUE(infile.eof()) << "Did not reach the end of the logging file"; + + // File will close when the instream is deleted at the end of this + // function. +} + +// Check that the logger correctly creates something logging to a file. +TEST_F(LoggerManagerTest, FileLogger) { + + // Create a specification for the file logger and use the manager to + // connect the "filelogger" logger to it. + SpecificationForFileLogger file_spec; + + // For the first test, we want to check that the file is created + // if it does not already exist. So delete the temporary file before + // logging the first message. + static_cast<void>(remove(file_spec.getFileName().c_str())); + + // Set up the file appenders. + LoggerManager manager; + manager.process(file_spec.getSpecification()); + + // Try logging to the file. Local scope is set to ensure that the logger + // is destroyed before we reset the global logging. We record what we + // put in the file for a later comparison. + vector<MessageID> ids; + { + + // Scope-limit the logger to ensure it is destroyed after the brief + // check. This adds weight to the idea that the logger will not + // keep the file open. + Logger logger(file_spec.getLoggerName().c_str()); + + LOG_FATAL(logger, LOG_DUPLICATE_MESSAGE_ID).arg("test"); + ids.push_back(LOG_DUPLICATE_MESSAGE_ID); + + LOG_FATAL(logger, LOG_DUPLICATE_NAMESPACE).arg("test"); + ids.push_back(LOG_DUPLICATE_NAMESPACE); + } + LoggerManager::reset(); + + // At this point, the output file should contain two lines with messages + // LOG_DUPLICATE_MESSAGE_ID and LOG_DUPLICATE_NAMESPACE messages - test this. + checkFileContents(file_spec.getFileName(), ids.begin(), ids.end()); + + // Re-open the file (we have to assume that it was closed when we + // reset the logger - there is no easy way to check) and check that + // new messages are appended to it. We use the alternative + // invocation of process() here to check it works. + vector<LoggerSpecification> spec(1, file_spec.getSpecification()); + manager.process(spec.begin(), spec.end()); + + // Create a new instance of the logger and log three more messages. + Logger logger(file_spec.getLoggerName().c_str()); + + LOG_FATAL(logger, LOG_NO_SUCH_MESSAGE).arg("test"); + ids.push_back(LOG_NO_SUCH_MESSAGE); + + LOG_FATAL(logger, LOG_INVALID_MESSAGE_ID).arg("test").arg("test2"); + ids.push_back(LOG_INVALID_MESSAGE_ID); + + LOG_FATAL(logger, LOG_NO_MESSAGE_ID).arg("42"); + ids.push_back(LOG_NO_MESSAGE_ID); + + // Close the file and check again + LoggerManager::reset(); + checkFileContents(file_spec.getFileName(), ids.begin(), ids.end()); +} + +// Check if the file rolls over when it gets above a certain size. +TEST_F(LoggerManagerTest, FileSizeRollover) { + // Set to a suitable minimum that log4cplus can cope with. + static const size_t SIZE_LIMIT = 204800; + + // Set up the name of the file. + SpecificationForFileLogger file_spec; + LoggerSpecification& spec = file_spec.getSpecification(); + + // Expand the option to ensure that a maximum version size is set. + LoggerSpecification::iterator opt = spec.begin(); + EXPECT_TRUE(opt != spec.end()); + opt->maxsize = SIZE_LIMIT; // Bytes + opt->maxver = 2; + + // The current output file does not exist (the creation of file_spec + // ensures that. Check that previous versions don't either. + vector<string> prev_name; + for (int i = 0; i < 3; ++i) { + prev_name.push_back(file_spec.getFileName() + "." + + boost::lexical_cast<string>(i + 1)); + (void) remove(prev_name[i].c_str()); + } + + // Generate an argument for a message that ensures that the message when + // logged will be over that size. + string big_arg(SIZE_LIMIT, 'x'); + + // Set up the file logger + LoggerManager manager; + manager.process(spec); + + // Log the message twice using different message IDs. This should generate + // three files as for the log4cplus implementation, the files appear to + // be rolled after the message is logged. + { + Logger logger(file_spec.getLoggerName().c_str()); + LOG_FATAL(logger, LOG_NO_SUCH_MESSAGE).arg(big_arg); + LOG_FATAL(logger, LOG_DUPLICATE_NAMESPACE).arg(big_arg); + } + + // Check them. + LoggerManager::reset(); // Ensure files are closed + + vector<MessageID> ids; + ids.push_back(LOG_NO_SUCH_MESSAGE); + checkFileContents(prev_name[1], ids.begin(), ids.end()); + + ids.clear(); + ids.push_back(LOG_DUPLICATE_NAMESPACE); + checkFileContents(prev_name[0], ids.begin(), ids.end()); + + // Log another message and check that the files have rotated and that + // a .3 version does not exist. + manager.process(spec); + { + Logger logger(file_spec.getLoggerName().c_str()); + LOG_FATAL(logger, LOG_NO_MESSAGE_TEXT).arg("42").arg(big_arg); + } + + LoggerManager::reset(); // Ensure files are closed + + // Check that the files have moved. + ids.clear(); + ids.push_back(LOG_DUPLICATE_NAMESPACE); + checkFileContents(prev_name[1], ids.begin(), ids.end()); + + ids.clear(); + ids.push_back(LOG_NO_MESSAGE_TEXT); + checkFileContents(prev_name[0], ids.begin(), ids.end()); + + // ... and check that the .3 version does not exist. + ifstream file3(prev_name[2].c_str(), ifstream::in); + EXPECT_FALSE(file3.good()); + + // Tidy up + for (vector<string>::size_type i = 0; i < prev_name.size(); ++i) { + (void) remove(prev_name[i].c_str()); + } +} + +// Check if an exception is thrown if maxsize is too large. +TEST_F(LoggerManagerTest, TooLargeMaxsize) { + // Set up the name of the file. + SpecificationForFileLogger file_spec; + LoggerSpecification& spec(file_spec.getSpecification()); + + // UINT64_MAX should be large enough. + LoggerSpecification::iterator opt = spec.begin(); + EXPECT_TRUE(opt != spec.end()); + opt->maxsize = std::numeric_limits<uint64_t>::max(); // bytes + + // Set up the file logger. + LoggerManager manager; + EXPECT_THROW_MSG(manager.process(spec), BadValue, + "expected maxsize < 2147483647MB, but instead got " + "18446744073709MB"); + + opt->maxsize = 1000000LL * (std::numeric_limits<int32_t>::max() + 1LL); // bytes + EXPECT_THROW_MSG(manager.process(spec), BadValue, + "expected maxsize < 2147483647MB, but instead got " + "2147483648MB"); +} + +namespace { // begin unnamed namespace + +// When we begin to use C++11, we could replace use of POSIX API with +// <regex>. + +class RegexHolder { +public: + RegexHolder(const char* expr, const int flags = REG_EXTENDED) { + const int rc = regcomp(®ex_, expr, flags); + if (rc) { + regfree(®ex_); + throw; + } + } + + ~RegexHolder() { + regfree(®ex_); + } + + regex_t* operator*() { + return (®ex_); + } + +private: + regex_t regex_; +}; + +} // end of unnamed namespace + +// Check that the logger correctly outputs the full formatted layout +// pattern. +TEST_F(LoggerManagerTest, checkLayoutPattern) { + // Create a specification for the file logger and use the manager to + // connect the "filelogger" logger to it. + SpecificationForFileLogger file_spec; + + // For the first test, we want to check that the file is created + // if it does not already exist. So delete the temporary file before + // logging the first message. + static_cast<void>(remove(file_spec.getFileName().c_str())); + + // Set up the file appenders. + LoggerManager manager; + manager.process(file_spec.getSpecification()); + + // Try logging to the file. Local scope is set to ensure that the logger + // is destroyed before we reset the global logging. + { + Logger logger(file_spec.getLoggerName().c_str()); + LOG_FATAL(logger, LOG_DUPLICATE_MESSAGE_ID).arg("test"); + } + + LoggerManager::reset(); + + // Access the file for input + const std::string& filename = file_spec.getFileName(); + ifstream infile(filename.c_str()); + if (! infile.good()) { + FAIL() << "Unable to open the logging file " << filename; + } + + std::string line; + std::getline(infile, line); + + RegexHolder regex(// %D{%Y-%m-%d %H:%M:%S.%q} + "^[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}[[:space:]]" + "[[:digit:]]{2}:[[:digit:]]{2}:[[:digit:]]{2}\\.[[:digit:]]+[[:space:]]" + // %-5p + "[[:alpha:]]{1,5}[[:space:]]" + // [%c/%i/%t] + "\\[[[:alnum:]\\-\\.]+/[[:digit:]]+\\.(0x)?[[:xdigit:]]+\\][[:space:]]" + ); + + const int re = regexec(*regex, line.c_str(), 0, NULL, 0); + ASSERT_EQ(0, re) + << "Logged message does not match expected layout pattern"; +} + +// Check that after calling the logDuplicatedMessages, the duplicated +// messages are removed. +TEST_F(LoggerManagerTest, logDuplicatedMessages) { + // Original set should not have duplicates. + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); + + // This just defines 1, but we'll add it a number of times. + const char* dupe[] = { + "DUPE", "dupe", + NULL + }; + const MessageInitializer init_message_initializer_1(dupe); + const MessageInitializer init_message_initializer_2(dupe); + + MessageInitializer::loadDictionary(); + // Should have a duplicate now. + ASSERT_EQ(1, MessageInitializer::getDuplicates().size()); + + // The logDuplicatedMessages, besides logging, should also remove the + // duplicates. + LoggerManager::logDuplicatedMessages(); + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); +} + +// Check that output options can be inherited. +TEST_F(LoggerManagerTest, outputOptionsInheritance) { + LoggerManager manager; + SpecificationForFileLogger file_spec; + vector<LoggerSpecification> specs; + + // Create the root logger configuration with a file output option. + string root_name(getRootLoggerName()); + LoggerSpecification root_spec(root_name); + OutputOption root_option; + root_option.destination = OutputOption::DEST_FILE; + root_option.filename = file_spec.getFileName(); + root_option.pattern = "%p %m\n"; + root_spec.addOutputOption(root_option); + specs.push_back(root_spec); + + // Create a child logger configuration without any output options. + // It should inherit the output option from the root logger. + string foo_name(root_name + ".foo"); + LoggerSpecification foo_spec(foo_name); + specs.push_back(foo_spec); + + // Create another child logger configuration with a console output option. + string bar_name(root_name + ".bar"); + LoggerSpecification bar_spec(bar_name); + OutputOption bar_option; + bar_option.destination = OutputOption::DEST_CONSOLE; + bar_option.pattern = "%p %m\n"; + bar_spec.addOutputOption(bar_option); + specs.push_back(bar_spec); + + // Check the number of output options for each specification. + EXPECT_EQ(root_spec.optionCount(), 1); + EXPECT_EQ(foo_spec.optionCount(), 0); + EXPECT_EQ(bar_spec.optionCount(), 1); + + // Process all the specifications. + manager.process(specs.begin(), specs.end()); + + // Log two messages each. + Logger root_logger(root_name.c_str()); + Logger foo_logger(foo_name.c_str()); + Logger bar_logger(bar_name.c_str()); + LOG_INFO(root_logger, "from root logger 1"); + LOG_INFO(foo_logger, "from foo logger 1"); + LOG_INFO(bar_logger, "from bar logger 1"); + LOG_INFO(root_logger, "from root logger 2"); + LOG_INFO(foo_logger, "from foo logger 2"); + LOG_INFO(bar_logger, "from bar logger 2"); + + // Check that root and foo were logged to file and that bar which + // had an explicit console configuration did not. + std::ifstream ifs(file_spec.getFileName()); + std::stringstream s; + s << ifs.rdbuf(); + std::string const result(s.str()); + EXPECT_NE(result.find("INFO from root logger 1"), string::npos); + EXPECT_NE(result.find("INFO from foo logger 1"), string::npos); + EXPECT_EQ(result.find("INFO from bar logger 1"), string::npos); + EXPECT_NE(result.find("INFO from root logger 2"), string::npos); + EXPECT_NE(result.find("INFO from foo logger 2"), string::npos); + EXPECT_EQ(result.find("INFO from bar logger 2"), string::npos); +} diff --git a/src/lib/log/tests/logger_name_unittest.cc b/src/lib/log/tests/logger_name_unittest.cc new file mode 100644 index 0000000..9048bf2 --- /dev/null +++ b/src/lib/log/tests/logger_name_unittest.cc @@ -0,0 +1,76 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <string> + +#include <gtest/gtest.h> + +#include <log/logger_name.h> + +using namespace isc; +using namespace isc::log; + +// Test class. To avoid disturbing the root logger configuration in other +// tests in the suite, the root logger name is saved in the constructor and +// restored in the destructor. However, this is a bit chicken and egg, as the +// functions used to do the save and restore are those being tested... +// +// Note that the root name is originally set by the initialization of the +// logging configuration done in main(). + +class LoggerNameTest : public ::testing::Test { +public: + LoggerNameTest() : + name_(getRootLoggerName()) + {} + ~LoggerNameTest() { + setRootLoggerName(name_); + } + +private: + std::string name_; ///< Saved name +}; + +// Check setting and getting of root name + +TEST_F(LoggerNameTest, RootNameSetGet) { + const std::string name1 = "test1"; + const std::string name2 = "test2"; + + // Check that Set/Get works + setRootLoggerName(name1); + EXPECT_EQ(name1, getRootLoggerName()); + + // We could not test that the root logger name is initialized + // correctly (as there is one instance of it and we don't know + // when this test will be run) so to check that setName() actually + // does change the name, run the test again with a different name. + // + // (There was always the outside chance that the root logger name + // was initialized with name1 and that setName() has no effect.) + setRootLoggerName(name2); + EXPECT_EQ(name2, getRootLoggerName()); +} + +// Check expansion of name + +TEST_F(LoggerNameTest, ExpandLoggerName) { + const std::string ROOT = "example"; + const std::string NAME = "something"; + const std::string FULL_NAME = ROOT + "." + NAME; + + setRootLoggerName(ROOT); + EXPECT_EQ(ROOT, expandLoggerName(ROOT)); + EXPECT_EQ(FULL_NAME, expandLoggerName(NAME)); + EXPECT_EQ(FULL_NAME, expandLoggerName(FULL_NAME)); +} + +// Checks that the default logger name is returned properly. +TEST_F(LoggerNameTest, default) { + EXPECT_EQ("kea", getDefaultRootLoggerName()); +} diff --git a/src/lib/log/tests/logger_specification_unittest.cc b/src/lib/log/tests/logger_specification_unittest.cc new file mode 100644 index 0000000..be9da6e --- /dev/null +++ b/src/lib/log/tests/logger_specification_unittest.cc @@ -0,0 +1,90 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <string> + +#include <gtest/gtest.h> + +#include <log/logger_specification.h> +#include <log/output_option.h> + +using namespace isc::log; +using namespace std; + +// Check default initialization. +TEST(LoggerSpecificationTest, DefaultInitialization) { + LoggerSpecification spec; + + EXPECT_EQ(string(""), spec.getName()); + EXPECT_EQ(isc::log::INFO, spec.getSeverity()); + EXPECT_EQ(0, spec.getDbglevel()); + EXPECT_FALSE(spec.getAdditive()); + EXPECT_EQ(0, spec.optionCount()); +} + +// Non-default initialization +TEST(LoggerSpecificationTest, Initialization) { + LoggerSpecification spec("alpha", isc::log::ERROR, 42, true); + + EXPECT_EQ(string("alpha"), spec.getName()); + EXPECT_EQ(isc::log::ERROR, spec.getSeverity()); + EXPECT_EQ(42, spec.getDbglevel()); + EXPECT_TRUE(spec.getAdditive()); + EXPECT_EQ(0, spec.optionCount()); +} + +// Get/Set tests +TEST(LoggerSpecificationTest, SetGet) { + LoggerSpecification spec; + + spec.setName("gamma"); + EXPECT_EQ(string("gamma"), spec.getName()); + + spec.setSeverity(isc::log::FATAL); + EXPECT_EQ(isc::log::FATAL, spec.getSeverity()); + + spec.setDbglevel(7); + EXPECT_EQ(7, spec.getDbglevel()); + + spec.setAdditive(true); + EXPECT_TRUE(spec.getAdditive()); + + // Should not affect option count + EXPECT_EQ(0, spec.optionCount()); +} + +// Check option setting +TEST(LoggerSpecificationTest, AddOption) { + OutputOption option1; + option1.destination = OutputOption::DEST_FILE; + option1.filename = "/tmp/example.log"; + option1.maxsize = 123456; + + OutputOption option2; + option2.destination = OutputOption::DEST_SYSLOG; + option2.facility = "LOCAL7"; + + LoggerSpecification spec; + spec.addOutputOption(option1); + spec.addOutputOption(option2); + EXPECT_EQ(2, spec.optionCount()); + + // Iterate through them + LoggerSpecification::const_iterator i = spec.begin(); + + EXPECT_EQ(OutputOption::DEST_FILE, i->destination); + EXPECT_EQ(string("/tmp/example.log"), i->filename); + EXPECT_EQ(123456, i->maxsize); + + ++i; + EXPECT_EQ(OutputOption::DEST_SYSLOG, i->destination); + EXPECT_EQ(string("LOCAL7"), i->facility); + + ++i; + EXPECT_TRUE(i == spec.end()); +} diff --git a/src/lib/log/tests/logger_support_unittest.cc b/src/lib/log/tests/logger_support_unittest.cc new file mode 100644 index 0000000..3f2943c --- /dev/null +++ b/src/lib/log/tests/logger_support_unittest.cc @@ -0,0 +1,77 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <gtest/gtest.h> +#include <log/logger_support.h> +#include <log/log_messages.h> + +using namespace isc::log; + +class LoggerSupportTest : public ::testing::Test { +protected: + LoggerSupportTest() { + // Logger initialization is done in main(). As logging tests may + // alter the default logging output, it is reset here. + setDefaultLoggingOutput(); + } + ~LoggerSupportTest() { + } +}; + +// Check that the initialized flag can be manipulated. This is a bit chicken- +// -and-egg: we want to reset to the flag to the original value at the end +// of the test, so use the functions to do that. But we are trying to check +// that these functions in fact work. + +TEST_F(LoggerSupportTest, InitializedFlag) { + bool current_flag = isLoggingInitialized(); + + // check we can flip the flag. + setLoggingInitialized(!current_flag); + EXPECT_NE(current_flag, isLoggingInitialized()); + setLoggingInitialized(!isLoggingInitialized()); + EXPECT_EQ(current_flag, isLoggingInitialized()); + + // Check we can set it to explicit values (tests that a call to the "set" + // function does not just flip the flag). + setLoggingInitialized(false); + EXPECT_FALSE(isLoggingInitialized()); + setLoggingInitialized(false); + EXPECT_FALSE(isLoggingInitialized()); + + setLoggingInitialized(true); + EXPECT_TRUE(isLoggingInitialized()); + setLoggingInitialized(true); + EXPECT_TRUE(isLoggingInitialized()); + + // Reset to original value + setLoggingInitialized(current_flag); +} + +// Check that a logger will throw an exception if logging has not been +// initialized. + +TEST_F(LoggerSupportTest, LoggingInitializationCheck) { + + // Assert that logging has been initialized (it should be in main()). + bool current_flag = isLoggingInitialized(); + EXPECT_TRUE(current_flag); + + // Flag that it has not been initialized and declare a logger. Any logging + // operation should then throw. + setLoggingInitialized(false); + isc::log::Logger test_logger("test"); + + EXPECT_THROW(test_logger.isDebugEnabled(), LoggingNotInitialized); + EXPECT_THROW(test_logger.info(LOG_INPUT_OPEN_FAIL), LoggingNotInitialized); + + // ... and check that they work when logging is initialized. + setLoggingInitialized(true); + EXPECT_NO_THROW(test_logger.isDebugEnabled()); + EXPECT_NO_THROW(test_logger.info(LOG_INPUT_OPEN_FAIL).arg("foo").arg("bar")); +} diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc new file mode 100644 index 0000000..cc2fb95 --- /dev/null +++ b/src/lib/log/tests/logger_unittest.cc @@ -0,0 +1,508 @@ +// Copyright (C) 2011-2022 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <gtest/gtest.h> + +#include <util/unittests/resource.h> +#include <util/unittests/check_valgrind.h> + +#include <log/logger.h> +#include <log/logger_manager.h> +#include <log/logger_name.h> +#include <log/logger_support.h> +#include <log/log_messages.h> +#include <log/interprocess/interprocess_sync_file.h> +#include <log/output_option.h> +#include <log/tests/log_test_messages.h> + +#include <iostream> +#include <string> + +using namespace isc; +using namespace isc::log; +using namespace std; + +/// \brief Logger Test +/// +/// As the logger is only a shell around the implementation, this tests also +/// checks the logger implementation class as well. + +class LoggerTest : public ::testing::Test { +public: + LoggerTest() { + // Initialize logging before each test, even if it is already done in main(). + isc::log::initLogger(); + } + ~LoggerTest() { + LoggerManager::reset(); + } +}; + +// Check version + +TEST_F(LoggerTest, Version) { + EXPECT_NO_THROW(Logger::getVersion()); +} + +// Checks that the logger is named correctly. + +TEST_F(LoggerTest, Name) { + + // Create a logger + Logger logger("alpha"); + + // ... and check the name + EXPECT_EQ(getRootLoggerName() + string(".alpha"), logger.getName()); +} + +// This test attempts to get two instances of a logger with the same name +// and checks that they are in fact the same logger. + +TEST_F(LoggerTest, GetLogger) { + + const char* name1 = "alpha"; + const char* name2 = "beta"; + + // Instantiate two loggers that should be the same + Logger logger1(name1); + Logger logger2(name1); + // And check they equal + EXPECT_TRUE(logger1 == logger2); + + // Instantiate another logger with another name and check that it + // is different to the previously instantiated ones. + Logger logger3(name2); + EXPECT_FALSE(logger1 == logger3); +} + +// Check that the logger levels are get set properly. + +TEST_F(LoggerTest, Severity) { + + // Create a logger + Logger logger("alpha"); + + // Now check the levels + logger.setSeverity(isc::log::NONE); + EXPECT_EQ(isc::log::NONE, logger.getSeverity()); + + logger.setSeverity(isc::log::FATAL); + EXPECT_EQ(isc::log::FATAL, logger.getSeverity()); + + logger.setSeverity(isc::log::ERROR); + EXPECT_EQ(isc::log::ERROR, logger.getSeverity()); + + logger.setSeverity(isc::log::WARN); + EXPECT_EQ(isc::log::WARN, logger.getSeverity()); + + logger.setSeverity(isc::log::INFO); + EXPECT_EQ(isc::log::INFO, logger.getSeverity()); + + logger.setSeverity(isc::log::DEBUG); + EXPECT_EQ(isc::log::DEBUG, logger.getSeverity()); + + logger.setSeverity(isc::log::DEFAULT); + EXPECT_EQ(isc::log::DEFAULT, logger.getSeverity()); +} + +// Check that the debug level is set correctly. + +TEST_F(LoggerTest, DebugLevels) { + + // Create a logger + Logger logger("alpha"); + + // Debug level should be 0 if not at debug severity + logger.setSeverity(isc::log::NONE, 20); + EXPECT_EQ(0, logger.getDebugLevel()); + + logger.setSeverity(isc::log::INFO, 42); + EXPECT_EQ(0, logger.getDebugLevel()); + + // Should be the value set if the severity is set to DEBUG though. + logger.setSeverity(isc::log::DEBUG, 32); + EXPECT_EQ(32, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 97); + EXPECT_EQ(97, logger.getDebugLevel()); + + // Try the limits + logger.setSeverity(isc::log::DEBUG, -1); + EXPECT_EQ(0, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 0); + EXPECT_EQ(0, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 1); + EXPECT_EQ(1, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 98); + EXPECT_EQ(98, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 99); + EXPECT_EQ(99, logger.getDebugLevel()); + + logger.setSeverity(isc::log::DEBUG, 100); + EXPECT_EQ(99, logger.getDebugLevel()); +} + +// Check that changing the parent and child severity does not affect the +// other. + +TEST_F(LoggerTest, SeverityInheritance) { + + // Create two loggers. We cheat here as we know that the underlying + // implementation will set a parent-child relationship if the loggers + // are named <parent> and <parent>.<child>. + Logger parent("alpha"); + Logger child("alpha.beta"); + + // By default, newly created loggers should have a level of DEFAULT + // (i.e. default to parent) + EXPECT_EQ(isc::log::DEFAULT, parent.getSeverity()); + EXPECT_EQ(isc::log::DEFAULT, child.getSeverity()); + + // Set the severity of the parent to debug and check what is + // reported by the child. + parent.setSeverity(isc::log::DEBUG, 42); + EXPECT_EQ(42, parent.getDebugLevel()); + EXPECT_EQ(0, child.getDebugLevel()); + EXPECT_EQ(42, child.getEffectiveDebugLevel()); + + // Setting the child to DEBUG severity should set its own + // debug level. + child.setSeverity(isc::log::DEBUG, 53); + EXPECT_EQ(53, child.getDebugLevel()); + EXPECT_EQ(53, child.getEffectiveDebugLevel()); + + // If the child severity is set to something other than DEBUG, + // the debug level should be reported as 0. + child.setSeverity(isc::log::ERROR); + EXPECT_EQ(0, child.getDebugLevel()); + EXPECT_EQ(0, child.getEffectiveDebugLevel()); +} + +// Check that changing the parent and child debug level does not affect +// the other. + +TEST_F(LoggerTest, DebugLevelInheritance) { + + // Create two loggers. We cheat here as we know that the underlying + // implementation will set a parent-child relationship if the loggers + // are named <parent> and <parent>.<child>. + Logger parent("alpha"); + Logger child("alpha.beta"); + + // By default, newly created loggers should have a level of DEFAULT + // (i.e. default to parent) + EXPECT_EQ(isc::log::DEFAULT, parent.getSeverity()); + EXPECT_EQ(isc::log::DEFAULT, child.getSeverity()); + + // Set the severity of the child to something other than the default - + // check it changes and that of the parent does not. + child.setSeverity(isc::log::INFO); + EXPECT_EQ(isc::log::DEFAULT, parent.getSeverity()); + EXPECT_EQ(isc::log::INFO, child.getSeverity()); + + // Reset the child severity and set that of the parent + child.setSeverity(isc::log::DEFAULT); + EXPECT_EQ(isc::log::DEFAULT, parent.getSeverity()); + EXPECT_EQ(isc::log::DEFAULT, child.getSeverity()); + parent.setSeverity(isc::log::WARN); + EXPECT_EQ(isc::log::WARN, parent.getSeverity()); + EXPECT_EQ(isc::log::DEFAULT, child.getSeverity()); +} + +// Check that severity is inherited. + +TEST_F(LoggerTest, EffectiveSeverityInheritance) { + + // Create two loggers. We cheat here as we know that the underlying + // implementation will set a parent-child relationship if the loggers + // are named <parent> and <parent>.<child>. + Logger parent("test6"); + Logger child("test6.beta"); + + // By default, newly created loggers should have a level of DEFAULT + // (i.e. default to parent) and the root should have a default severity + // of INFO. However, the latter is only enforced when created by the + // RootLogger class, so explicitly set it for the parent for now. + parent.setSeverity(isc::log::INFO); + EXPECT_EQ(isc::log::INFO, parent.getEffectiveSeverity()); + + EXPECT_EQ(isc::log::DEFAULT, child.getSeverity()); + EXPECT_EQ(isc::log::INFO, child.getEffectiveSeverity()); + + // Set the severity of the child to something other than the default - + // check it changes and that of the parent does not. + child.setSeverity(isc::log::FATAL); + EXPECT_EQ(isc::log::INFO, parent.getEffectiveSeverity()); + EXPECT_EQ(isc::log::FATAL, child.getEffectiveSeverity()); + + // Reset the child severity and check again. + child.setSeverity(isc::log::DEFAULT); + EXPECT_EQ(isc::log::INFO, parent.getEffectiveSeverity()); + EXPECT_EQ(isc::log::INFO, child.getEffectiveSeverity()); + + // Change the parent's severity and check it is reflects in the child. + parent.setSeverity(isc::log::WARN); + EXPECT_EQ(isc::log::WARN, parent.getEffectiveSeverity()); + EXPECT_EQ(isc::log::WARN, child.getEffectiveSeverity()); +} + +// Test the isXxxxEnabled methods. + +TEST_F(LoggerTest, IsXxxEnabled) { + + Logger logger("test7"); + + logger.setSeverity(isc::log::INFO); + EXPECT_FALSE(logger.isDebugEnabled()); + EXPECT_TRUE(logger.isInfoEnabled()); + EXPECT_TRUE(logger.isWarnEnabled()); + EXPECT_TRUE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + logger.setSeverity(isc::log::WARN); + EXPECT_FALSE(logger.isDebugEnabled()); + EXPECT_FALSE(logger.isInfoEnabled()); + EXPECT_TRUE(logger.isWarnEnabled()); + EXPECT_TRUE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + logger.setSeverity(isc::log::ERROR); + EXPECT_FALSE(logger.isDebugEnabled()); + EXPECT_FALSE(logger.isInfoEnabled()); + EXPECT_FALSE(logger.isWarnEnabled()); + EXPECT_TRUE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + logger.setSeverity(isc::log::FATAL); + EXPECT_FALSE(logger.isDebugEnabled()); + EXPECT_FALSE(logger.isInfoEnabled()); + EXPECT_FALSE(logger.isWarnEnabled()); + EXPECT_FALSE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + // Check various debug levels + + logger.setSeverity(isc::log::DEBUG); + EXPECT_TRUE(logger.isDebugEnabled()); + EXPECT_TRUE(logger.isInfoEnabled()); + EXPECT_TRUE(logger.isWarnEnabled()); + EXPECT_TRUE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + logger.setSeverity(isc::log::DEBUG, 45); + EXPECT_TRUE(logger.isDebugEnabled()); + EXPECT_TRUE(logger.isInfoEnabled()); + EXPECT_TRUE(logger.isWarnEnabled()); + EXPECT_TRUE(logger.isErrorEnabled()); + EXPECT_TRUE(logger.isFatalEnabled()); + + // Create a child logger with no severity set, and check that it reflects + // the severity of the parent logger. + + Logger child("test7.child"); + logger.setSeverity(isc::log::FATAL); + EXPECT_FALSE(child.isDebugEnabled()); + EXPECT_FALSE(child.isInfoEnabled()); + EXPECT_FALSE(child.isWarnEnabled()); + EXPECT_FALSE(child.isErrorEnabled()); + EXPECT_TRUE(child.isFatalEnabled()); + + logger.setSeverity(isc::log::INFO); + EXPECT_FALSE(child.isDebugEnabled()); + EXPECT_TRUE(child.isInfoEnabled()); + EXPECT_TRUE(child.isWarnEnabled()); + EXPECT_TRUE(child.isErrorEnabled()); + EXPECT_TRUE(child.isFatalEnabled()); +} + +// Within the Debug level there are 100 debug levels. Test that we know +// when to issue a debug message. + +TEST_F(LoggerTest, IsDebugEnabledLevel) { + + Logger logger("test8"); + + int MID_LEVEL = (MIN_DEBUG_LEVEL + MAX_DEBUG_LEVEL) / 2; + + logger.setSeverity(isc::log::DEBUG); + EXPECT_TRUE(logger.isDebugEnabled(MIN_DEBUG_LEVEL)); + EXPECT_FALSE(logger.isDebugEnabled(MID_LEVEL)); + EXPECT_FALSE(logger.isDebugEnabled(MAX_DEBUG_LEVEL)); + + logger.setSeverity(isc::log::DEBUG, MIN_DEBUG_LEVEL); + EXPECT_TRUE(logger.isDebugEnabled(MIN_DEBUG_LEVEL)); + EXPECT_FALSE(logger.isDebugEnabled(MID_LEVEL)); + EXPECT_FALSE(logger.isDebugEnabled(MAX_DEBUG_LEVEL)); + + logger.setSeverity(isc::log::DEBUG, MID_LEVEL); + EXPECT_TRUE(logger.isDebugEnabled(MIN_DEBUG_LEVEL)); + EXPECT_TRUE(logger.isDebugEnabled(MID_LEVEL - 1)); + EXPECT_TRUE(logger.isDebugEnabled(MID_LEVEL)); + EXPECT_FALSE(logger.isDebugEnabled(MID_LEVEL + 1)); + EXPECT_FALSE(logger.isDebugEnabled(MAX_DEBUG_LEVEL)); + + logger.setSeverity(isc::log::DEBUG, MAX_DEBUG_LEVEL); + EXPECT_TRUE(logger.isDebugEnabled(MIN_DEBUG_LEVEL)); + EXPECT_TRUE(logger.isDebugEnabled(MID_LEVEL)); + EXPECT_TRUE(logger.isDebugEnabled(MAX_DEBUG_LEVEL)); +} + +// Check that loggers with invalid names give an error. + +TEST_F(LoggerTest, LoggerNameLength) { + // Null name + EXPECT_THROW(Logger(NULL), LoggerNameNull); + + // Declare space for the logger name. The length of names checked + // will range from 0 through MAX_LOGGER_NAME_SIZE + 1: to allow for + // the trailing null, at least one more byte than the longest name size + // must be reserved. + char name[Logger::MAX_LOGGER_NAME_SIZE + 2]; + + // Zero-length name should throw an exception + name[0] = '\0'; + EXPECT_THROW({ + Logger dummy(name); + }, LoggerNameError); + + // Work through all valid names. + for (size_t i = 0; i < Logger::MAX_LOGGER_NAME_SIZE; ++i) { + + // Append a character to the name and check that a logger with that + // name can be created without throwing an exception. + name[i] = 'X'; + name[i + 1] = '\0'; + EXPECT_NO_THROW({ + Logger dummy(name); + }) << "Size of logger name is " << (i + 1); + } + + // ... and check that an overly long name throws an exception. + name[Logger::MAX_LOGGER_NAME_SIZE] = 'X'; + name[Logger::MAX_LOGGER_NAME_SIZE + 1] = '\0'; + EXPECT_THROW({ + Logger dummy(name); + }, LoggerNameError); + +} + +TEST_F(LoggerTest, setInterprocessSync) { + // Create a logger + Logger logger("alpha"); + + EXPECT_THROW(logger.setInterprocessSync(NULL), BadInterprocessSync); +} + +class MockSync : public isc::log::interprocess::InterprocessSync { +public: + /// \brief Constructor + MockSync(const std::string& component_name) : + InterprocessSync(component_name), was_locked_(false), + was_unlocked_(false) + {} + + bool wasLocked() const { + return (was_locked_); + } + + bool wasUnlocked() const { + return (was_unlocked_); + } + +protected: + bool lock() { + was_locked_ = true; + return (true); + } + + bool tryLock() { + return (true); + } + + bool unlock() { + was_unlocked_ = true; + return (true); + } + +private: + bool was_locked_; + bool was_unlocked_; +}; + +// Checks that the logger logs exclusively and other Kea components +// are locked out. + +TEST_F(LoggerTest, Lock) { + // Create a logger + Logger logger("alpha"); + + // Setup our own mock sync object so that we can intercept the lock + // call and check if a lock has been taken. + MockSync* sync = new MockSync("logger"); + logger.setInterprocessSync(sync); + + // Log a message and put things into play. + logger.setSeverity(isc::log::INFO, 100); + logger.info(LOG_LOCK_TEST_MESSAGE); + + EXPECT_TRUE(sync->wasLocked()); + EXPECT_TRUE(sync->wasUnlocked()); +} + +// Checks that hasAppender() reports +TEST_F(LoggerTest, HasAppender) { + // Create a logger. + Logger logger("logger"); + + // By default, loggers have a file appender to /dev/null. + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_CONSOLE)); + EXPECT_TRUE(logger.hasAppender(OutputOption::DEST_FILE)); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_SYSLOG)); + + // -- Create some specifications. -- + + OutputOption console; + console.destination = OutputOption::DEST_CONSOLE; + LoggerSpecification spec_console("logger"); + spec_console.addOutputOption(console); + + OutputOption file; + file.destination = OutputOption::DEST_FILE; + file.filename = "/dev/null"; + LoggerSpecification spec_file("logger"); + spec_file.addOutputOption(file); + + OutputOption syslog; + syslog.destination = OutputOption::DEST_SYSLOG; + LoggerSpecification spec_syslog("logger"); + spec_syslog.addOutputOption(syslog); + + LoggerManager manager; + + // Check console. + manager.process(spec_console); + EXPECT_TRUE(logger.hasAppender(OutputOption::DEST_CONSOLE)); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_FILE)); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_SYSLOG)); + + // Check file. + manager.process(spec_file); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_CONSOLE)); + EXPECT_TRUE(logger.hasAppender(OutputOption::DEST_FILE)); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_SYSLOG)); + + // Check syslog. + manager.process(spec_syslog); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_CONSOLE)); + EXPECT_FALSE(logger.hasAppender(OutputOption::DEST_FILE)); + EXPECT_TRUE(logger.hasAppender(OutputOption::DEST_SYSLOG)); +} diff --git a/src/lib/log/tests/message_dictionary_unittest.cc b/src/lib/log/tests/message_dictionary_unittest.cc new file mode 100644 index 0000000..8613393 --- /dev/null +++ b/src/lib/log/tests/message_dictionary_unittest.cc @@ -0,0 +1,219 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <cstddef> +#include <string> +#include <gtest/gtest.h> +#include <log/message_dictionary.h> +#include <log/message_initializer.h> +#include <log/message_types.h> + +using namespace isc; +using namespace isc::log; +using namespace std; + +// set up another message initializer. This will add a symbol found in the +// logging library and a symbol not found in the logging library. When the +// global dictionary is loaded, the former should be marked as a duplicate +// and the latter should be present. + +namespace { +const char* values[] = { + // This message for DUPLICATE_NAMESPACE must be copied from + // ../log_messages.mes; otherwise logger check might fail. + "LOG_DUPLICATE_NAMESPACE", "line %1: duplicate $NAMESPACE directive found", + "NEWSYM", "new symbol added", + NULL +}; + +MessageInitializer init(values); +} + +class MessageDictionaryTest : public ::testing::Test { +protected: + MessageDictionaryTest() : + alpha_id("ALPHA"), alpha_text("This is alpha"), + beta_id("BETA"), beta_text("This is beta"), + gamma_id("GAMMA"), gamma_text("This is gamma") + { + } + + MessageID alpha_id; + std::string alpha_text; + MessageID beta_id; + std::string beta_text; + MessageID gamma_id; + std::string gamma_text; + +}; + +// Check that adding messages works + +TEST_F(MessageDictionaryTest, Add) { + MessageDictionary dictionary; + EXPECT_EQ(0, dictionary.size()); + + // Add a few messages and check that we can look them up and that there is + // nothing in the overflow vector. + EXPECT_TRUE(dictionary.add(alpha_id, alpha_text)); + EXPECT_TRUE(dictionary.add(beta_id, beta_text)); + EXPECT_EQ(2, dictionary.size()); + + EXPECT_EQ(alpha_text, dictionary.getText(alpha_id)); + EXPECT_EQ(beta_text, dictionary.getText(beta_id)); + EXPECT_EQ(string(""), dictionary.getText(gamma_id)); + + // Try adding a duplicate with different text. It should not replace the + // current text and the ID should be in the overflow section. + EXPECT_FALSE(dictionary.add(alpha_id, gamma_text)); + EXPECT_EQ(2, dictionary.size()); +} + +// Check that replacing messages works. + +TEST_F(MessageDictionaryTest, Replace) { + MessageDictionary dictionary; + EXPECT_EQ(0, dictionary.size()); + + // Try to replace a non-existent message + EXPECT_FALSE(dictionary.replace(alpha_id, alpha_text)); + EXPECT_EQ(0, dictionary.size()); + + // Add a couple of messages. + EXPECT_TRUE(dictionary.add(alpha_id, alpha_text)); + EXPECT_TRUE(dictionary.add(beta_id, beta_text)); + EXPECT_EQ(2, dictionary.size()); + + // Replace an existing message + EXPECT_TRUE(dictionary.replace(alpha_id, gamma_text)); + EXPECT_EQ(2, dictionary.size()); + EXPECT_EQ(gamma_text, dictionary.getText(alpha_id)); + + // ... and replace non-existent message (but now the dictionary has some + // items in it). + EXPECT_FALSE(dictionary.replace(gamma_id, alpha_text)); + EXPECT_EQ(2, dictionary.size()); + EXPECT_EQ(string(""), dictionary.getText(gamma_id)); +} + +// Check that removing message works. + +TEST_F(MessageDictionaryTest, erase) { + MessageDictionary dictionary; + ASSERT_NO_THROW(dictionary.erase(alpha_id, alpha_text)); + ASSERT_EQ(0, dictionary.size()); + + // Add a couple of messages. + EXPECT_TRUE(dictionary.add(alpha_id, alpha_text)); + EXPECT_TRUE(dictionary.add(beta_id, beta_text)); + // There is no sense to continue if messages haven't been added. + ASSERT_EQ(2, dictionary.size()); + + // Remove one with the existing ID, but non-matching text. It + // should not remove any message. + EXPECT_FALSE(dictionary.erase(beta_id, alpha_text)); + + // Now, remove the message with matching ID and text. + EXPECT_TRUE(dictionary.erase(beta_id, beta_text)); + EXPECT_EQ(1, dictionary.size()); + // The other entry should still exist. + EXPECT_EQ(alpha_text, dictionary.getText(alpha_id)); + + // And remove the other message. + EXPECT_TRUE(dictionary.erase(alpha_id, alpha_text)); + EXPECT_EQ(0, dictionary.size()); +} + +// Load test + +TEST_F(MessageDictionaryTest, LoadTest) { + static const char* data1[] = { + "ALPHA", "This is alpha", + "BETA", "This is beta", + "GAMMA", "This is gamma", + NULL + }; + + static const char* data2[] = { + "DELTA", "This is delta", + "EPSILON", "This is epsilon", + "ETA", NULL + }; + + MessageDictionary dictionary1; + EXPECT_EQ(0, dictionary1.size()); + + // Load a dictionary1. + vector<string> duplicates = dictionary1.load(data1); + EXPECT_EQ(3, dictionary1.size()); + EXPECT_EQ(string(data1[1]), dictionary1.getText(data1[0])); + EXPECT_EQ(string(data1[3]), dictionary1.getText(data1[2])); + EXPECT_EQ(string(data1[5]), dictionary1.getText(data1[4])); + EXPECT_EQ(0, duplicates.size()); + + // Attempt an overwrite + duplicates = dictionary1.load(data1); + EXPECT_EQ(3, dictionary1.size()); + EXPECT_EQ(3, duplicates.size()); + + // Try a new dictionary but with an incorrect number of elements + MessageDictionary dictionary2; + EXPECT_EQ(0, dictionary2.size()); + + duplicates = dictionary2.load(data2); + EXPECT_EQ(2, dictionary2.size()); + EXPECT_EQ(string(data2[1]), dictionary2.getText(data2[0])); + EXPECT_EQ(string(data2[3]), dictionary2.getText(data2[2])); + EXPECT_EQ(string(""), dictionary2.getText(data2[4])); + EXPECT_EQ(0, duplicates.size()); +} + +// Check for some non-existent items + +TEST_F(MessageDictionaryTest, Lookups) { + static const char* data[] = { + "ALPHA", "This is alpha", + "BETA", "This is beta", + "GAMMA", "This is gamma", + NULL + }; + + MessageDictionary dictionary; + vector<string> duplicates = dictionary.load(data); + EXPECT_EQ(3, dictionary.size()); + EXPECT_EQ(0, duplicates.size()); + + // Valid lookups + EXPECT_EQ(string("This is alpha"), dictionary.getText("ALPHA")); + EXPECT_EQ(string("This is beta"), dictionary.getText("BETA")); + EXPECT_EQ(string("This is gamma"), dictionary.getText("GAMMA")); + + // ... and invalid ones + EXPECT_EQ(string(""), dictionary.getText("XYZZY")); + EXPECT_EQ(string(""), dictionary.getText("")); + EXPECT_EQ(string(""), dictionary.getText("\n\n\n")); +} + +// Check that the global dictionary is a singleton. + +TEST_F(MessageDictionaryTest, GlobalTest) { + const MessageDictionaryPtr& global = MessageDictionary::globalDictionary(); + const MessageDictionaryPtr& global2 = MessageDictionary::globalDictionary(); + EXPECT_TRUE(global2 == global); +} + +// Check that the global dictionary has detected the duplicate and the +// new symbol. + +TEST_F(MessageDictionaryTest, GlobalLoadTest) { + // There were duplicates but the vector should be cleared in init() now + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); + + string text = MessageDictionary::globalDictionary()->getText("NEWSYM"); + EXPECT_EQ(string("new symbol added"), text); +} diff --git a/src/lib/log/tests/message_initializer_1_unittest.cc b/src/lib/log/tests/message_initializer_1_unittest.cc new file mode 100644 index 0000000..c34139a --- /dev/null +++ b/src/lib/log/tests/message_initializer_1_unittest.cc @@ -0,0 +1,251 @@ +// Copyright (C) 2012-2020 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <log/message_dictionary.h> +#include <log/message_initializer.h> +#include <boost/lexical_cast.hpp> +#include <boost/scoped_ptr.hpp> +#include <gtest/gtest.h> +#include <string> + +using namespace isc; +using namespace isc::log; +using namespace std; + +// Declare a set of messages to go into the global dictionary. + +namespace { +const char* values1[] = { + "GLOBAL1", "global message one", + "GLOBAL2", "global message two", + NULL +}; + +const char* values2[] = { + "GLOBAL3", "global message three", + "GLOBAL4", "global message four", + NULL +}; + +const char* values3[] = { + "GLOBAL7", "global message seven", + "GLOBAL8", "global message eight", + NULL +}; + +const char* values4[] = { + "GLOBAL8", "global message eight", + "GLOBAL9", "global message nine", + NULL +}; + +/// @brief Scoped pointer to the @c MessageInitializer object. +typedef boost::scoped_ptr<MessageInitializer> MessageInitializerPtr; + +} + +// Statically initialize the global dictionary with those messages. Three sets +// are used to check that the declaration of separate initializer objects +// really does combine the messages. (The third set - declaring message IDs +// GLOBAL5 and GLOBAL6) is declared in the separately-compiled file, +// message_identifier_initializer_1a_unittest.cc.) + +const MessageInitializer init_message_initializer_unittest_1(values1); +const MessageInitializer init_message_initializer_unittest_2(values2); + +// Check that the global dictionary is initialized with the specified +// messages. + +namespace { +void +messageTest() { + static bool done = false; + + // Execute once. + if (done) { + return; + } else { + done = true; + } + + const MessageDictionaryPtr& global = MessageDictionary::globalDictionary(); + + // Pointers to the message arrays should have been stored, but none of the + // messages should yet be in the dictionary. + for (int i = 1; i <= 6; ++i) { + string symbol = string("GLOBAL") + boost::lexical_cast<std::string>(i); + EXPECT_EQ(string(""), global->getText(symbol)); + } + + // Load the dictionary - this should clear the message array pending count. + // (N.B. We do not check for a known value before the call, only that the + // value is not zero. This is because libraries against which the test + // is linked may have registered their own message arrays.) + EXPECT_NE(0, MessageInitializer::getPendingCount()); + MessageInitializer::loadDictionary(); + EXPECT_EQ(0, MessageInitializer::getPendingCount()); + + // ... and check the messages loaded. + EXPECT_EQ(string("global message one"), global->getText("GLOBAL1")); + EXPECT_EQ(string("global message two"), global->getText("GLOBAL2")); + EXPECT_EQ(string("global message three"), global->getText("GLOBAL3")); + EXPECT_EQ(string("global message four"), global->getText("GLOBAL4")); + EXPECT_EQ(string("global message five"), global->getText("GLOBAL5")); + EXPECT_EQ(string("global message six"), global->getText("GLOBAL6")); +} +} + +// Check that destroying the MessageInitializer causes the relevant +// messages to be removed from the dictionary. + +TEST(MessageInitializerTest1, dynamicLoadUnload) { + // Try first messageTest. + messageTest(); + + // Obtain the instance of the global dictionary. + const MessageDictionaryPtr& global = MessageDictionary::globalDictionary(); + + // Dynamically create the first initializer. + MessageInitializerPtr init1(new MessageInitializer(values3)); + EXPECT_EQ(1, MessageInitializer::getPendingCount()); + + // Dynamically create the second initializer. + MessageInitializerPtr init2(new MessageInitializer(values4)); + EXPECT_EQ(2, MessageInitializer::getPendingCount()); + + // Load messages from both initializers to the global dictionary. + MessageInitializer::loadDictionary(); + // There should be no pending messages. + EXPECT_EQ(0, MessageInitializer::getPendingCount()); + + // Make sure that the messages have been loaded. + EXPECT_EQ("global message seven", global->getText("GLOBAL7")); + EXPECT_EQ("global message eight", global->getText("GLOBAL8")); + EXPECT_EQ("global message nine", global->getText("GLOBAL9")); + + // Destroy the first initializer. The first message should be removed. + // The second message should not be removed because it is also held + // by another object. + init1.reset(); + EXPECT_TRUE(global->getText("GLOBAL7").empty()); + EXPECT_EQ("global message eight", global->getText("GLOBAL8")); + EXPECT_EQ("global message nine", global->getText("GLOBAL9")); + + // Destroy the second initializer. Now, all messages should be + // unregistered. + init2.reset(); + EXPECT_TRUE(global->getText("GLOBAL7").empty()); + EXPECT_TRUE(global->getText("GLOBAL8").empty()); + EXPECT_TRUE(global->getText("GLOBAL9").empty()); +} + +// Check that destroying the MessageInitializer removes pending messages. + +TEST(MessageInitializerTest1, dynamicUnloadPending) { + // Try first messageTest. + messageTest(); + + // Obtain the instance of the global dictionary. + const MessageDictionaryPtr& global = MessageDictionary::globalDictionary(); + + // Dynamically create the first initializer. + MessageInitializerPtr init1(new MessageInitializer(values3)); + ASSERT_EQ(1, MessageInitializer::getPendingCount()); + + // Create second initializer without committing the first set + // of messages to the dictionary. + MessageInitializerPtr init2(new MessageInitializer(values4)); + ASSERT_EQ(2, MessageInitializer::getPendingCount()); + + // Destroy the first initializer and make sure that the number of + // pending message sets drops to 1. + init1.reset(); + ASSERT_EQ(1, MessageInitializer::getPendingCount()); + + // Now destroy the second initializer and make sure that there are + // no pending messages. + init2.reset(); + ASSERT_EQ(0, MessageInitializer::getPendingCount()); + + init1.reset(new MessageInitializer(values3)); + ASSERT_EQ(1, MessageInitializer::getPendingCount()); + + // Load the messages to the dictionary and make sure there are no pending + // messages. + MessageInitializer::loadDictionary(); + EXPECT_EQ(0, MessageInitializer::getPendingCount()); + + // Create the second initializer. There should be one pending set of + // messages. + init2.reset(new MessageInitializer(values4)); + ASSERT_EQ(1, MessageInitializer::getPendingCount()); + + // Make sure that the messages defined by the first initializer + // are in the dictionary. + ASSERT_EQ("global message seven", global->getText("GLOBAL7")); + ASSERT_EQ("global message eight", global->getText("GLOBAL8")); + ASSERT_TRUE(global->getText("GLOBAL9").empty()); + + // Destroy the second initializer. There should be no pending messages + // now. + init2.reset(); + ASSERT_EQ(0, MessageInitializer::getPendingCount()); + + // Loading the messages should be no-op. + MessageInitializer::loadDictionary(); + ASSERT_EQ(0, MessageInitializer::getPendingCount()); + + // Make sure that the messages loaded from the first initializer + // are not affected. + ASSERT_EQ("global message seven", global->getText("GLOBAL7")); + ASSERT_EQ("global message eight", global->getText("GLOBAL8")); + ASSERT_TRUE(global->getText("GLOBAL9").empty()); + + // And remove them. + init1.reset(); + EXPECT_TRUE(global->getText("GLOBAL7").empty()); + EXPECT_TRUE(global->getText("GLOBAL8").empty()); + EXPECT_TRUE(global->getText("GLOBAL9").empty()); +} + +TEST(MessageInitializerTest1, duplicates) { + // Try first messageTest. + messageTest(); + + // Original set should not have dupes + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); + + // This just defines 1, but we'll add it a number of times + const char* dupe[] = { + "DUPE", "dupe", + NULL + }; + const MessageInitializer init_message_initializer_unittest_1(dupe); + const MessageInitializer init_message_initializer_unittest_2(dupe); + + MessageInitializer::loadDictionary(); + // Should be a dupe now + ASSERT_EQ(1, MessageInitializer::getDuplicates().size()); + + // clear them + MessageInitializer::clearDuplicates(); + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); + + // Do it again to make sure, let's explicitly provide false now + const MessageInitializer init_message_initializer_unittest_3(dupe); + MessageInitializer::loadDictionary(false); + ASSERT_EQ(1, MessageInitializer::getDuplicates().size()); + + // Loading with ignore_duplicates=true should result in no (reported) + // dupes + MessageInitializer::clearDuplicates(); + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); + const MessageInitializer init_message_initializer_unittest_4(dupe); + MessageInitializer::loadDictionary(true); + ASSERT_EQ(0, MessageInitializer::getDuplicates().size()); +} diff --git a/src/lib/log/tests/message_initializer_1a_unittest.cc b/src/lib/log/tests/message_initializer_1a_unittest.cc new file mode 100644 index 0000000..3e2b86b --- /dev/null +++ b/src/lib/log/tests/message_initializer_1a_unittest.cc @@ -0,0 +1,31 @@ +// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// The sole purpose of this file is to provide a set of message definitions +// in a separate compilation unit from the one in which their presence is +// checked. This tests that merely declaring the MessageInitializer object +// is enough to include the definitions in the global dictionary. + +#include <config.h> + +#include <log/message_initializer.h> + +using namespace isc::log; + +// Declare a set of messages to go into the global dictionary. + +namespace { + +const char* values3[] = { + "GLOBAL5", "global message five", + "GLOBAL6", "global message six", + NULL +}; + +} + +// Register the messages for loading into the global dictionary +const MessageInitializer init_message_initializer_unittest_3(values3); diff --git a/src/lib/log/tests/message_reader_unittest.cc b/src/lib/log/tests/message_reader_unittest.cc new file mode 100644 index 0000000..4dd6435 --- /dev/null +++ b/src/lib/log/tests/message_reader_unittest.cc @@ -0,0 +1,269 @@ +// Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <algorithm> +#include <string> +#include <gtest/gtest.h> + +#include <log/log_messages.h> +#include <log/message_dictionary.h> +#include <log/message_exception.h> +#include <log/message_reader.h> + +using namespace isc; +using namespace isc::log; +using namespace std; + +class MessageReaderTest : public ::testing::Test { +protected: + MessageReaderTest() : dictionary_(), reader_() + { + dictionary_ = new MessageDictionary(); + reader_.setDictionary(dictionary_); + } + + ~MessageReaderTest() { + delete dictionary_; + } + + MessageDictionary* dictionary_; // Dictionary to add messages to + MessageReader reader_; // Default reader object +}; + + +// Check the get/set dictionary calls (using a local reader and dictionary). + +TEST_F(MessageReaderTest, GetSetDictionary) { + MessageReader reader; + EXPECT_TRUE(reader.getDictionary() == NULL); + + MessageDictionary dictionary; + reader.setDictionary(&dictionary); + EXPECT_EQ(&dictionary, reader.getDictionary()); +} + +// Check for parsing blank lines and comments. These should not add to the +// dictionary and each parse should return success. + +TEST_F(MessageReaderTest, BlanksAndComments) { + + // Ensure that the dictionary is empty. + EXPECT_EQ(0, dictionary_->size()); + + // Add a number of blank lines and comments and check that (a) they are + // parsed successfully ... + EXPECT_NO_THROW(reader_.processLine("")); + EXPECT_NO_THROW(reader_.processLine(" ")); + EXPECT_NO_THROW(reader_.processLine(" \n ")); + EXPECT_NO_THROW(reader_.processLine("# This is a comment")); + EXPECT_NO_THROW(reader_.processLine("\t\t # Another comment")); + EXPECT_NO_THROW(reader_.processLine(" A description line")); + EXPECT_NO_THROW(reader_.processLine("# A comment")); + EXPECT_NO_THROW(reader_.processLine(" +# A description line")); + + // ... and (b) nothing gets added to either the map or the not-added section. + EXPECT_EQ(0, dictionary_->size()); + vector<string> not_added = reader_.getNotAdded(); + EXPECT_EQ(0, not_added.size()); +} + + +// Local test to check that processLine generates the right exception. + +void +processLineException(MessageReader& reader, const char* what, + const MessageID& expected) { + + try { + reader.processLine(what); + FAIL() << "MessageReader::processLine() should throw an exception " << + " with message ID " << expected << " for '" << what << "'\n"; + } catch (const MessageException& e) { + EXPECT_EQ(boost::lexical_cast<string>(expected), + boost::lexical_cast<string>(e.id())); + } catch (...) { + FAIL() << "Unknown exception thrown by MessageReader::processLine()\n"; + } +} + +// Check that it recognizes invalid directives + +TEST_F(MessageReaderTest, InvalidDirectives) { + + // Check that a "$" with nothing else generates an error + processLineException(reader_, "$", LOG_UNRECOGNIZED_DIRECTIVE); + processLineException(reader_, "$xyz", LOG_UNRECOGNIZED_DIRECTIVE); +} + +// Check that it can parse a prefix + +TEST_F(MessageReaderTest, Prefix) { + + // Check that no $PREFIX is present + EXPECT_EQ(string(""), reader_.getPrefix()); + + // Check that a $PREFIX directive with no argument is OK + EXPECT_NO_THROW(reader_.processLine("$PREFIX")); + + // Check a $PREFIX with multiple arguments is invalid + processLineException(reader_, "$prefix A B", LOG_PREFIX_EXTRA_ARGS); + + // Prefixes should be alphanumeric (with underscores) and not start + // with a number. + processLineException(reader_, "$prefix ab[cd", LOG_PREFIX_INVALID_ARG); + processLineException(reader_, "$prefix 123", LOG_PREFIX_INVALID_ARG); + processLineException(reader_, "$prefix 1ABC", LOG_PREFIX_INVALID_ARG); + + // A valid prefix should be accepted + EXPECT_NO_THROW(reader_.processLine("$PREFIX dlm__")); + EXPECT_EQ(string("dlm__"), reader_.getPrefix()); + + // And check that the parser fails on invalid prefixes... + processLineException(reader_, "$prefix 1ABC", LOG_PREFIX_INVALID_ARG); + + // Check that we can clear the prefix as well + reader_.clearPrefix(); + EXPECT_EQ(string(""), reader_.getPrefix()); + + EXPECT_NO_THROW(reader_.processLine("$PREFIX dlm__")); + EXPECT_EQ(string("dlm__"), reader_.getPrefix()); + EXPECT_NO_THROW(reader_.processLine("$PREFIX")); + EXPECT_EQ(string(""), reader_.getPrefix()); +} + +// Check that it can parse a namespace + +TEST_F(MessageReaderTest, Namespace) { + + // Check that no $NAMESPACE is present + EXPECT_EQ(string(""), reader_.getNamespace()); + + // Check that a $NAMESPACE directive with no argument generates an error. + processLineException(reader_, "$NAMESPACE", LOG_NAMESPACE_NO_ARGS); + + // Check a $NAMESPACE with multiple arguments is invalid + processLineException(reader_, "$namespace A B", LOG_NAMESPACE_EXTRA_ARGS); + + // Namespaces should be alphanumeric (with underscores and colons) + processLineException(reader_, "$namespace ab[cd", LOG_NAMESPACE_INVALID_ARG); + + // A valid $NAMESPACE should be accepted + EXPECT_NO_THROW(reader_.processLine("$NAMESPACE isc")); + EXPECT_EQ(string("isc"), reader_.getNamespace()); + + // (Check that we can clear the namespace) + reader_.clearNamespace(); + EXPECT_EQ(string(""), reader_.getNamespace()); + + // Check that a valid namespace can include colons + EXPECT_NO_THROW(reader_.processLine("$NAMESPACE isc::log")); + EXPECT_EQ(string("isc::log"), reader_.getNamespace()); + + // Check that the indication of the anonymous namespace will be recognized. + reader_.clearNamespace(); + EXPECT_NO_THROW(reader_.processLine("$NAMESPACE ::")); + EXPECT_EQ(string("::"), reader_.getNamespace()); + + // ... and that another $NAMESPACE is rejected + processLineException(reader_, "$NAMESPACE ABC", LOG_DUPLICATE_NAMESPACE); +} + +// Check that it can parse a line + +TEST_F(MessageReaderTest, ValidMessageAddDefault) { + + // Add a couple of valid messages + reader_.processLine("% GLOBAL1\t\tthis is message global one\n"); + reader_.processLine("%GLOBAL2 this is message global two"); + + // ... and check them + EXPECT_EQ(string("this is message global one"), + dictionary_->getText("GLOBAL1")); + EXPECT_EQ(string("this is message global two"), + dictionary_->getText("GLOBAL2")); + EXPECT_EQ(2, dictionary_->size()); + + // ... and ensure no messages were not added + vector<string> not_added = reader_.getNotAdded(); + EXPECT_EQ(0, not_added.size()); +} + +TEST_F(MessageReaderTest, ValidMessageAdd) { + + // Add a couple of valid messages + reader_.processLine("%GLOBAL1\t\tthis is message global one\n", + MessageReader::ADD); + reader_.processLine("% GLOBAL2 this is message global two", + MessageReader::ADD); + + // ... and check them + EXPECT_EQ(string("this is message global one"), + dictionary_->getText("GLOBAL1")); + EXPECT_EQ(string("this is message global two"), + dictionary_->getText("GLOBAL2")); + EXPECT_EQ(2, dictionary_->size()); + + // ... and ensure no messages were not added + vector<string> not_added = reader_.getNotAdded(); + EXPECT_EQ(0, not_added.size()); +} + +TEST_F(MessageReaderTest, ValidMessageReplace) { + + dictionary_->add("GLOBAL1", "original global1 message"); + dictionary_->add("GLOBAL2", "original global2 message"); + + // Replace a couple of valid messages + reader_.processLine("% GLOBAL1\t\tthis is message global one\n", + MessageReader::REPLACE); + reader_.processLine("% GLOBAL2 this is message global two", + MessageReader::REPLACE); + + // ... and check them + EXPECT_EQ(string("this is message global one"), + dictionary_->getText("GLOBAL1")); + EXPECT_EQ(string("this is message global two"), + dictionary_->getText("GLOBAL2")); + EXPECT_EQ(2, dictionary_->size()); + + // ... and ensure no messages were not added + vector<string> not_added = reader_.getNotAdded(); + EXPECT_EQ(0, not_added.size()); +} + +// Do checks on overflows, although this essentially duplicates the checks +// in MessageDictionary. + +TEST_F(MessageReaderTest, Overflows) { + + // Add a couple of valid messages + reader_.processLine("% GLOBAL1\t\tthis is message global one\n"); + reader_.processLine("% GLOBAL2 this is message global two"); + + // Add a duplicate in ADD mode. + reader_.processLine("% GLOBAL1\t\tthis is a replacement for global one"); + + // Replace a non-existent one in REPLACE mode + reader_.processLine("% LOCAL\t\tthis is a new message", + MessageReader::REPLACE); + + // Check what is in the dictionary. + EXPECT_EQ(string("this is message global one"), + dictionary_->getText("GLOBAL1")); + EXPECT_EQ(string("this is message global two"), + dictionary_->getText("GLOBAL2")); + EXPECT_EQ(2, dictionary_->size()); + + // ... and ensure no overflows + vector<string> not_added = reader_.getNotAdded(); + ASSERT_EQ(2, not_added.size()); + + sort(not_added.begin(), not_added.end()); + EXPECT_EQ(string("GLOBAL1"), not_added[0]); + EXPECT_EQ(string("LOCAL"), not_added[1]); +} diff --git a/src/lib/log/tests/output_option_unittest.cc b/src/lib/log/tests/output_option_unittest.cc new file mode 100644 index 0000000..bf922a9 --- /dev/null +++ b/src/lib/log/tests/output_option_unittest.cc @@ -0,0 +1,60 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <string> + +#include <gtest/gtest.h> + +#include <log/output_option.h> + +using namespace isc::log; +using namespace std; + +// As OutputOption is a struct, the only meaningful test is to check that it +// initializes correctly. + +TEST(OutputOptionTest, Initialization) { + OutputOption option; + + EXPECT_EQ(OutputOption::DEST_CONSOLE, option.destination); + EXPECT_EQ(OutputOption::STR_STDERR, option.stream); + EXPECT_TRUE(option.flush); + EXPECT_EQ(string("LOCAL0"), option.facility); + EXPECT_EQ(string(""), option.filename); + EXPECT_EQ(0, option.maxsize); + EXPECT_EQ(0, option.maxver); +} + +TEST(OutputOption, getDestination) { + EXPECT_EQ(OutputOption::DEST_CONSOLE, getDestination("console")); + EXPECT_EQ(OutputOption::DEST_CONSOLE, getDestination("CONSOLE")); + EXPECT_EQ(OutputOption::DEST_CONSOLE, getDestination("CoNSoLE")); + EXPECT_EQ(OutputOption::DEST_FILE, getDestination("file")); + EXPECT_EQ(OutputOption::DEST_FILE, getDestination("FILE")); + EXPECT_EQ(OutputOption::DEST_FILE, getDestination("fIlE")); + EXPECT_EQ(OutputOption::DEST_SYSLOG, getDestination("syslog")); + EXPECT_EQ(OutputOption::DEST_SYSLOG, getDestination("SYSLOG")); + EXPECT_EQ(OutputOption::DEST_SYSLOG, getDestination("SYSlog")); + + // bad values should default to DEST_CONSOLE + EXPECT_EQ(OutputOption::DEST_CONSOLE, getDestination("SOME_BAD_VALUE")); +} + +TEST(OutputOption, getStream) { + EXPECT_EQ(OutputOption::STR_STDOUT, getStream("stdout")); + EXPECT_EQ(OutputOption::STR_STDOUT, getStream("STDOUT")); + EXPECT_EQ(OutputOption::STR_STDOUT, getStream("STdouT")); + EXPECT_EQ(OutputOption::STR_STDERR, getStream("stderr")); + EXPECT_EQ(OutputOption::STR_STDERR, getStream("STDERR")); + EXPECT_EQ(OutputOption::STR_STDERR, getStream("StDeRR")); + + // bad values should default to stdout + EXPECT_EQ(OutputOption::STR_STDOUT, getStream("some bad value")); + EXPECT_EQ(OutputOption::STR_STDOUT, getStream("")); +} + diff --git a/src/lib/log/tests/run_initializer_unittests.cc b/src/lib/log/tests/run_initializer_unittests.cc new file mode 100644 index 0000000..7765c14 --- /dev/null +++ b/src/lib/log/tests/run_initializer_unittests.cc @@ -0,0 +1,19 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <stdlib.h> +#include <gtest/gtest.h> +#include <util/unittests/run_all.h> + +#include <log/logger_support.h> + +int +main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + return (isc::util::unittests::run_all()); +} diff --git a/src/lib/log/tests/run_unittests.cc b/src/lib/log/tests/run_unittests.cc new file mode 100644 index 0000000..2753b0b --- /dev/null +++ b/src/lib/log/tests/run_unittests.cc @@ -0,0 +1,20 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include <config.h> + +#include <stdlib.h> +#include <gtest/gtest.h> +#include <util/unittests/run_all.h> + +#include <log/logger_support.h> + +int +main(int argc, char* argv[]) { + ::testing::InitGoogleTest(&argc, argv); + isc::log::initLogger(); + return (isc::util::unittests::run_all()); +} diff --git a/src/lib/log/tests/severity_test.sh.in b/src/lib/log/tests/severity_test.sh.in new file mode 100644 index 0000000..02376f8 --- /dev/null +++ b/src/lib/log/tests/severity_test.sh.in @@ -0,0 +1,74 @@ +#!/bin/sh + +# Copyright (C) 2011-2020 Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# Checks that the logger will limit the output of messages less severe than +# the severity/debug setting. + +# Exit with error if commands exit with non-zero and if undefined variables are +# used. +set -eu + +# Include common test library. +# shellcheck disable=SC1091 +# SC1091: Not following: ... was not specified as input (see shellcheck -x). +. "@abs_top_builddir@/src/lib/testutils/dhcp_test_lib.sh" + +tempfile="@abs_builddir@/severity_test_tempfile_$$" + +test_start 'severity.default-parameters' +cat > $tempfile << . +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +WARN [example] LOG_BAD_STREAM bad log console output stream: example +WARN [example.alpha] LOG_READ_ERROR error reading from message file a.txt: dummy reason +INFO [example.alpha] LOG_INPUT_OPEN_FAIL unable to open message file example.msg for input: dummy reason +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +WARN [example.beta] LOG_BAD_STREAM bad log console output stream: beta_warn +INFO [example.beta] LOG_READ_ERROR error reading from message file beta: info +. +./logger_example -c stdout | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +test_start 'severity.filter' +cat > $tempfile << . +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +. +./logger_example -c stdout -s error | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +test_start 'severity.debug-level' +cat > $tempfile << . +FATAL [example] LOG_WRITE_ERROR error writing to test1: 42 +ERROR [example] LOG_READING_LOCAL_FILE reading local message file dummy/file +WARN [example] LOG_BAD_STREAM bad log console output stream: example +WARN [example.alpha] LOG_READ_ERROR error reading from message file a.txt: dummy reason +INFO [example.alpha] LOG_INPUT_OPEN_FAIL unable to open message file example.msg for input: dummy reason +DEBUG [example] LOG_READING_LOCAL_FILE reading local message file example/0 +DEBUG [example] LOG_READING_LOCAL_FILE reading local message file example/24 +DEBUG [example] LOG_READING_LOCAL_FILE reading local message file example/25 +FATAL [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta_fatal +ERROR [example.beta] LOG_BAD_DESTINATION unrecognized log destination: beta_error +WARN [example.beta] LOG_BAD_STREAM bad log console output stream: beta_warn +INFO [example.beta] LOG_READ_ERROR error reading from message file beta: info +DEBUG [example.beta] LOG_BAD_SEVERITY unrecognized log severity: beta/25 +. +./logger_example -c stdout -s debug -d 25 | \ + sed -e 's/\[\([a-z0-9\.]\{1,\}\)\/\([0-9]\{1,\}\)\.\(0x\)\{0,1\}\([0-9A-Fa-f]\{1,\}\)\]/[\1]/' | \ + cut -d' ' -f3- | diff $tempfile - +test_finish $? + +# Tidy up +rm -f $tempfile diff --git a/src/lib/log/tests/tempdir.h.in b/src/lib/log/tests/tempdir.h.in new file mode 100644 index 0000000..c805844 --- /dev/null +++ b/src/lib/log/tests/tempdir.h.in @@ -0,0 +1,21 @@ +// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC") +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef TEMPDIR_H +#define TEMPDIR_H + +/// \brief Define temporary directory +/// +/// Defines the temporary directory in which temporary files used by the +/// unit tests are created. + +#include <string> + +namespace { +std::string TEMP_DIR("@builddir@"); +} + +#endif // TEMPDIR_H |