From: Karel Zak <kzak@redhat.com>
To: Sami Kerola <kerolasa@iki.fi>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 3/8] tests: add test_logger helper command
Date: Mon, 16 Mar 2015 11:57:07 +0100 [thread overview]
Message-ID: <20150316105707.GI28925@ws.net.home> (raw)
In-Reply-To: <1426424094-25451-4-git-send-email-kerolasa@iki.fi>
On Sun, Mar 15, 2015 at 12:54:49PM +0000, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
> 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@redhat.com>
http://karelzak.blogspot.com
next prev parent reply other threads:[~2015-03-16 10:57 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-15 12:54 [PATCH 0/8] pull: logger: add tests and fix couple issues Sami Kerola
2015-03-15 12:54 ` [PATCH 1/8] logger: tidy few indentation issues Sami Kerola
2015-03-16 10:52 ` Karel Zak
2015-03-16 11:22 ` Rainer Gerhards
2015-03-16 11:50 ` Karel Zak
2015-03-15 12:54 ` [PATCH 2/8] logger: check xgethostname() return value Sami Kerola
2015-03-16 10:53 ` Karel Zak
2015-03-15 12:54 ` [PATCH 3/8] tests: add test_logger helper command Sami Kerola
2015-03-16 10:57 ` Karel Zak [this message]
2015-03-16 13:19 ` Karel Zak
2015-03-15 12:54 ` [PATCH 4/8] tests: add logger(1) command line options tests Sami Kerola
2015-03-15 12:54 ` [PATCH 5/8] logger: fix rfc5424 format crash Sami Kerola
2015-03-16 10:49 ` Karel Zak
2015-03-16 10:55 ` Rainer Gerhards
2015-03-16 11:13 ` Karel Zak
2015-03-16 10:57 ` Rainer Gerhards
2015-03-15 12:54 ` [PATCH 6/8] tests: add logger(1) message format tests Sami Kerola
2015-03-15 12:54 ` [PATCH 7/8] logger: use errx() when checking user input Sami Kerola
2015-03-16 10:54 ` Karel Zak
2015-03-15 12:54 ` [PATCH 8/8] tests: add logger(1) error condition tests Sami Kerola
2015-03-16 11:28 ` [PATCH 0/8] pull: logger: add tests and fix couple issues Rainer Gerhards
2015-03-16 12:06 ` Karel Zak
2015-03-16 23:55 ` Sami Kerola
2015-03-17 9:06 ` Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150316105707.GI28925@ws.net.home \
--to=kzak@redhat.com \
--cc=kerolasa@iki.fi \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox