[OE-core] [PATCH v2] oe_syslog.py: Handle syslogd/klogd restart race

Richard Purdie richard.purdie at linuxfoundation.org
Sat Jun 22 08:08:04 UTC 2019


On Fri, 2019-06-21 at 15:27 -0400, Jon Mason wrote:
> syslogd and klogd can occasionally take too long to restart, which
> causes tests to fail by starting before the log daemons are ready.  To
> work around this problem, poll for up to 30 seconds on the processes to
> verify the old ones are killed and the new ones are up and running.
> 
> [YOCTO #13379]
> 
> Signed-off-by: Jon Mason <jdmason at kudzu.us>
> ---
>  meta/lib/oeqa/runtime/cases/oe_syslog.py | 54 +++++++++++++++++++++---
>  1 file changed, 48 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/lib/oeqa/runtime/cases/oe_syslog.py b/meta/lib/oeqa/runtime/cases/oe_syslog.py
> index 0f5f9f43ca..480aadedf9 100644
> --- a/meta/lib/oeqa/runtime/cases/oe_syslog.py
> +++ b/meta/lib/oeqa/runtime/cases/oe_syslog.py
> @@ -6,6 +6,7 @@ from oeqa.runtime.case import OERuntimeTestCase
>  from oeqa.core.decorator.depends import OETestDepends
>  from oeqa.core.decorator.data import skipIfDataVar
>  from oeqa.runtime.decorator.package import OEHasPackage
> +import time
>  
>  class SyslogTest(OERuntimeTestCase):
>  
> @@ -21,6 +22,49 @@ class SyslogTest(OERuntimeTestCase):
>  
>  class SyslogTestConfig(OERuntimeTestCase):
>  
> +    def test_syslog_restart_sanity(self):
> +        status, syslogd_pid = self.target.run('pidof syslogd')
> +        status, klogd_pid = self.target.run('pidof klogd')

FWIW by calling this test_, it will be run as a standalone test. This
may have two issues:

a) it won't work on a systemd image
b) its missing dependency markup (is syslog running?) that the other
tests have

Unless we really want it as a standalone test (I think there is a
similar one already), the fix may be just to rename it something other
than starting with test_.

Cheers,

Richard

> +        status, output = self.target.run('/etc/init.d/syslog restart')
> +
> +        # Always check for an error, most likely a race between shutting down and starting up
> +        timeout = time.time() + 30
> +
> 



More information about the Openembedded-core mailing list