On Sun, Mar 15, 2015 at 12:54:49PM +0000, Sami Kerola wrote: > Signed-off-by: Sami Kerola <kerolasa@xxxxxx> > --- > misc-utils/Makemodule.am | 4 ++++ > misc-utils/logger.c | 36 ++++++++++++++++++++++++++++++++++++ > tests/commands.sh | 1 + > 3 files changed, 41 insertions(+) > > diff --git a/misc-utils/Makemodule.am b/misc-utils/Makemodule.am > index f7485c9..309727b 100644 > --- a/misc-utils/Makemodule.am > +++ b/misc-utils/Makemodule.am > @@ -26,6 +26,10 @@ if HAVE_SYSTEMD > logger_LDADD = $(SYSTEMD_LIBS) $(SYSTEMD_DAEMON_LIBS) $(SYSTEMD_JOURNAL_LIBS) > logger_CFLAGS = $(SYSTEMD_CFLAGS) $(SYSTEMD_DAEMON_CFLAGS) $(SYSTEMD_JOURNAL_CFLAGS) > endif > +check_PROGRAMS += test_logger > +test_logger_SOURCES = $(logger_SOURCES) > +test_logger_LDADD = $(logger_LDADD) > +test_logger_CFLAGS = -DTEST_LOGGER $(logger_CFLAGS) > endif # BUILD_LOGGER > > > diff --git a/misc-utils/logger.c b/misc-utils/logger.c > index 2e37d14..838d225 100644 > --- a/misc-utils/logger.c > +++ b/misc-utils/logger.c > @@ -310,7 +310,12 @@ static const char *rfc3164_current_time(void) > "Sep", "Oct", "Nov", "Dec" > }; > > +#ifndef TEST_LOGGER > gettimeofday(&tv, NULL); > +#else > + tv.tv_sec = 1234567890; > + tv.tv_usec = 123456; > +#endif Hmm... this (many #ifdefs and hardcoded constants) is really not elegant solution. I'll try to implement it in another way. Thanks for the tests. Karel -- Karel Zak <kzak@xxxxxxxxxx> http://karelzak.blogspot.com -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html