All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10
@ 2018-04-19 19:14 Ricardo Martincoski
  2018-04-19 19:14 ` [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng Ricardo Martincoski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ricardo Martincoski @ 2018-04-19 19:14 UTC (permalink / raw)
  To: buildroot

From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>

Remove a runtime warning message about configuration file being too old.

Do the same as commit 3dad25466d "syslog-ng: Bump version header in conf
file to 3.9". Package version of syslog-ng is 3.10.1, so bump version
number in syslog-ng.conf to 3.10.

Also add a comment to avoid the same warning message reappears when the
package is bumped.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
Cc: Chris Packham <judge.packham@gmail.com>
---
Wrapped version of the warning message that shows at every boot:
  Starting syslog-ng daemon: WARNING: Configuration file format is too
  old, syslog-ng is running in compatibility mode Please update it to
  use the syslog-ng 3.10 format at your time of convenience,
  compatibility mode can operate less efficiently in some cases. To
  upgrade the configuration, please review the warnings about
  incompatible changes printed by syslog-ng, and once completed change
  the @version header at the top of the configuration file.;
---
 package/syslog-ng/syslog-ng.conf | 2 +-
 package/syslog-ng/syslog-ng.mk   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/syslog-ng/syslog-ng.conf b/package/syslog-ng/syslog-ng.conf
index a3384eebc3..e767255d71 100644
--- a/package/syslog-ng/syslog-ng.conf
+++ b/package/syslog-ng/syslog-ng.conf
@@ -1,4 +1,4 @@
- at version: 3.9
+ at version: 3.10
 
 source s_sys {
 	file("/proc/kmsg" program_override("kernel"));
diff --git a/package/syslog-ng/syslog-ng.mk b/package/syslog-ng/syslog-ng.mk
index 325fac5842..d82f9a1aa4 100644
--- a/package/syslog-ng/syslog-ng.mk
+++ b/package/syslog-ng/syslog-ng.mk
@@ -4,6 +4,8 @@
 #
 ################################################################################
 
+# When updating the version, please check at runtime if version at
+# syslog-ng.conf header needs to be updated
 SYSLOG_NG_VERSION = 3.10.1
 SYSLOG_NG_SITE = https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$(SYSLOG_NG_VERSION)
 SYSLOG_NG_LICENSE = LGPL-2.1+ (syslog-ng core), GPL-2.0+ (modules)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng
  2018-04-19 19:14 [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Ricardo Martincoski
@ 2018-04-19 19:14 ` Ricardo Martincoski
  2018-04-19 21:19   ` Thomas Petazzoni
  2018-04-19 21:17 ` [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Thomas Petazzoni
  2018-05-01  6:54 ` Peter Korsgaard
  2 siblings, 1 reply; 6+ messages in thread
From: Ricardo Martincoski @ 2018-04-19 19:14 UTC (permalink / raw)
  To: buildroot

From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>

Check:
 - the daemon is started;
 - a message is collected;
 - the daemon does not issue a warning message on startup.

When the .conf file version does not match the package version a warning
message shows up on serial on every boot. This message is generated by
syslog-ng before it is running, so it is not logged to
/var/log/messages. So in order to test the message is generated, restart
the server. It makes the message appears on /var/log/messages (since the
server is already running) where its existence can be easily tested
using grep.

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
---
In the current master the test fails (due to the warning message):
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/63969698

With patch 1 applied the test passes:
https://gitlab.com/RicardoMartincoski/buildroot/-/jobs/63968923
---
 .gitlab-ci.yml                                  |  1 +
 support/testing/tests/package/test_syslog_ng.py | 34 +++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 support/testing/tests/package/test_syslog_ng.py

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1927618a0f..568fb7fc19 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -300,6 +300,7 @@ tests.package.test_python_cryptography.TestPythonPy2Cryptography: *runtime_test
 tests.package.test_python_cryptography.TestPythonPy3Cryptography: *runtime_test
 tests.package.test_rust.TestRust: *runtime_test
 tests.package.test_rust.TestRustBin: *runtime_test
+tests.package.test_syslog_ng.TestSyslogNg: *runtime_test
 tests.toolchain.test_external.TestExternalToolchainBuildrootMusl: *runtime_test
 tests.toolchain.test_external.TestExternalToolchainBuildrootuClibc: *runtime_test
 tests.toolchain.test_external.TestExternalToolchainCCache: *runtime_test
diff --git a/support/testing/tests/package/test_syslog_ng.py b/support/testing/tests/package/test_syslog_ng.py
new file mode 100644
index 0000000000..0155ef14e4
--- /dev/null
+++ b/support/testing/tests/package/test_syslog_ng.py
@@ -0,0 +1,34 @@
+import os
+
+import infra.basetest
+
+
+class TestSyslogNg(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+        BR2_PACKAGE_SYSLOG_NG=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file])
+        self.emulator.login()
+
+        cmd = "grep syslog-ng /var/log/messages | grep starting"
+        _, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+
+        cmd = "logger my-message;"
+        cmd += "sleep 1;"
+        cmd += "grep my-message /var/log/messages"
+        _, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 0)
+
+        cmd = "syslog-ng-ctl reload;"
+        cmd += "sleep 1;"
+        cmd += "grep syslog-ng /var/log/messages | grep -i warning"
+        _, exit_code = self.emulator.run(cmd)
+        self.assertEqual(exit_code, 1)
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10
  2018-04-19 19:14 [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Ricardo Martincoski
  2018-04-19 19:14 ` [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng Ricardo Martincoski
@ 2018-04-19 21:17 ` Thomas Petazzoni
  2018-04-20  8:28   ` Chris Packham
  2018-05-01  6:54 ` Peter Korsgaard
  2 siblings, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-04-19 21:17 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 19 Apr 2018 16:14:17 -0300, Ricardo Martincoski wrote:
> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
> 
> Remove a runtime warning message about configuration file being too old.
> 
> Do the same as commit 3dad25466d "syslog-ng: Bump version header in conf
> file to 3.9". Package version of syslog-ng is 3.10.1, so bump version
> number in syslog-ng.conf to 3.10.
> 
> Also add a comment to avoid the same warning message reappears when the
> package is bumped.
> 
> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
> Cc: Chris Packham <judge.packham@gmail.com>

I've applied, thanks. A suggestion below, though.

> diff --git a/package/syslog-ng/syslog-ng.conf b/package/syslog-ng/syslog-ng.conf
> index a3384eebc3..e767255d71 100644
> --- a/package/syslog-ng/syslog-ng.conf
> +++ b/package/syslog-ng/syslog-ng.conf
> @@ -1,4 +1,4 @@
> - at version: 3.9
> + at version: 3.10

Why don't we replace this by:

@version: VERSION_MAJOR

> +# When updating the version, please check at runtime if version at
> +# syslog-ng.conf header needs to be updated
>  SYSLOG_NG_VERSION = 3.10.1

And then:

SYSLOG_NG_VERSION_MAJOR = 3.10
SYSLOG_NG_VERSION = $(SYSLOG_NG_VERSION_MAJOR).1

and do some $(SED) logic when installing syslog-ng.conf ?

This would avoid the need to manually sync this stupid version
number :-)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng
  2018-04-19 19:14 ` [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng Ricardo Martincoski
@ 2018-04-19 21:19   ` Thomas Petazzoni
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Petazzoni @ 2018-04-19 21:19 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu, 19 Apr 2018 16:14:18 -0300, Ricardo Martincoski wrote:
> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
> 
> Check:
>  - the daemon is started;
>  - a message is collected;
>  - the daemon does not issue a warning message on startup.
> 
> When the .conf file version does not match the package version a warning
> message shows up on serial on every boot. This message is generated by
> syslog-ng before it is running, so it is not logged to
> /var/log/messages. So in order to test the message is generated, restart
> the server. It makes the message appears on /var/log/messages (since the
> server is already running) where its existence can be easily tested
> using grep.
> 
> Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>

Thanks, I've applied. Some comments/suggestions below, though.

> +    def test_run(self):
> +        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
> +        self.emulator.boot(arch="armv5", kernel="builtin", options=["-initrd", cpio_file])
> +        self.emulator.login()
> +
> +        cmd = "grep syslog-ng /var/log/messages | grep starting"

Why a double grep, and not a single grep like:

	grep "syslog-ng.*starting"

or some better regexp ?

> +        _, exit_code = self.emulator.run(cmd)
> +        self.assertEqual(exit_code, 0)
> +
> +        cmd = "logger my-message;"
> +        cmd += "sleep 1;"
> +        cmd += "grep my-message /var/log/messages"

Maybe && between each command would be better ?

> +        _, exit_code = self.emulator.run(cmd)
> +        self.assertEqual(exit_code, 0)
> +
> +        cmd = "syslog-ng-ctl reload;"
> +        cmd += "sleep 1;"
> +        cmd += "grep syslog-ng /var/log/messages | grep -i warning"

Ditto single grep command ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10
  2018-04-19 21:17 ` [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Thomas Petazzoni
@ 2018-04-20  8:28   ` Chris Packham
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Packham @ 2018-04-20  8:28 UTC (permalink / raw)
  To: buildroot

On Fri, 20 Apr 2018, 9:18 AM Thomas Petazzoni, <thomas.petazzoni@bootlin.com>
wrote:

> Hello,
>
> On Thu, 19 Apr 2018 16:14:17 -0300, Ricardo Martincoski wrote:
> > From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
> >
> > Remove a runtime warning message about configuration file being too old.
> >
> > Do the same as commit 3dad25466d "syslog-ng: Bump version header in conf
> > file to 3.9". Package version of syslog-ng is 3.10.1, so bump version
> > number in syslog-ng.conf to 3.10.
> >
> > Also add a comment to avoid the same warning message reappears when the
> > package is bumped.
> >
> > Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
> > Cc: Chris Packham <judge.packham@gmail.com>
>
> I've applied, thanks. A suggestion below, though.
>
> > diff --git a/package/syslog-ng/syslog-ng.conf
> b/package/syslog-ng/syslog-ng.conf
> > index a3384eebc3..e767255d71 100644
> > --- a/package/syslog-ng/syslog-ng.conf
> > +++ b/package/syslog-ng/syslog-ng.conf
> > @@ -1,4 +1,4 @@
> > - at version: 3.9
> > + at version: 3.10
>
> Why don't we replace this by:
>
> @version: VERSION_MAJOR
>
> > +# When updating the version, please check at runtime if version at
> > +# syslog-ng.conf header needs to be updated
> >  SYSLOG_NG_VERSION = 3.10.1
>
> And then:
>
> SYSLOG_NG_VERSION_MAJOR = 3.10
> SYSLOG_NG_VERSION = $(SYSLOG_NG_VERSION_MAJOR).1
>
> and do some $(SED) logic when installing syslog-ng.conf ?
>
> This would avoid the need to manually sync this stupid version
> number :-)
>

That'd work until there is an actual meaningful change in syntax.

Ideally syslog-ng would have a separate config version number. Even then
the default buildroot syslog-ng is so simple that it's more than likely it
won't be affected by most syntax changes. Last time I looked there wasn't a
simple enough default config in the syslog-ng repo that could just be used
without enabling optional features.

Realistically anyone wanting to use syslog-ng in anger will want to supply
their own config file(s), possibly with a local commit rebased on top of a
buildroot release. My only concern would be that the sed thing masks the
real error from such users. Given that buildroot has other mechanisms for
customising the root fs and no-one has asked for a "don't install the
default syslog-ng.conf" option I'm guessing that such a user doesn't yet
exist. If/when such a user appears we can tweak the seding to suit.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180420/79bf9eee/attachment.html>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10
  2018-04-19 19:14 [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Ricardo Martincoski
  2018-04-19 19:14 ` [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng Ricardo Martincoski
  2018-04-19 21:17 ` [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Thomas Petazzoni
@ 2018-05-01  6:54 ` Peter Korsgaard
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Korsgaard @ 2018-05-01  6:54 UTC (permalink / raw)
  To: buildroot

>>>>> "Ricardo" == Ricardo Martincoski <ricardo.martincoski@gmail.com> writes:

 > From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
 > Remove a runtime warning message about configuration file being too old.

 > Do the same as commit 3dad25466d "syslog-ng: Bump version header in conf
 > file to 3.9". Package version of syslog-ng is 3.10.1, so bump version
 > number in syslog-ng.conf to 3.10.

 > Also add a comment to avoid the same warning message reappears when the
 > package is bumped.

 > Signed-off-by: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br>
 > Cc: Chris Packham <judge.packham@gmail.com>
 > ---
 > Wrapped version of the warning message that shows at every boot:
 >   Starting syslog-ng daemon: WARNING: Configuration file format is too
 >   old, syslog-ng is running in compatibility mode Please update it to
 >   use the syslog-ng 3.10 format at your time of convenience,
 >   compatibility mode can operate less efficiently in some cases. To
 >   upgrade the configuration, please review the warnings about
 >   incompatible changes printed by syslog-ng, and once completed change
 >   the @version header at the top of the configuration file.;

Committed to 2018.02.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-01  6:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 19:14 [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Ricardo Martincoski
2018-04-19 19:14 ` [Buildroot] [PATCH 2/2] support/testing: add test for syslog-ng Ricardo Martincoski
2018-04-19 21:19   ` Thomas Petazzoni
2018-04-19 21:17 ` [Buildroot] [PATCH 1/2] syslog-ng: bump version header in conf file to 3.10 Thomas Petazzoni
2018-04-20  8:28   ` Chris Packham
2018-05-01  6:54 ` Peter Korsgaard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.