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

Jon Mason jdmason at kudzu.us
Sat Jun 22 20:10:18 UTC 2019


On Sat, Jun 22, 2019 at 4:08 AM Richard Purdie
<richard.purdie at linuxfoundation.org> wrote:
>
> 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

I didn't know that was something desired.  I can modify it to try and
cover that use case, as it does make sense to try and cover all of
them.

> b) its missing dependency markup (is syslog running?) that the other
> tests have

I assumed that the dependencies on the calling functions would filter
down.  I'll add a similar limit as the other functions present.

> 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_.

I can change that.

>
> 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