Message ID | 20240610160300.4003823-1-ecordonnier@snap.com |
---|---|
State | New |
Headers | show |
Series | [v2] oeqa/runtime: fix race-condition in minidebuginfo test | expand |
On Mon, 2024-06-10 at 18:03 +0200, Etienne Cordonnier via lists.openembedded.org wrote: > From: Etienne Cordonnier <ecordonnier@snap.com> > > Fix this error where 'coredumpctl info' warns that the coredump is still being > processed: > > ``` > AssertionError: 1 != 0 : MiniDebugInfo Test failed: No match found. > -- Notice: 1 systemd-coredump@.service unit is running, output may be incomplete. > ``` > > Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> > --- > meta/lib/oeqa/runtime/cases/systemd.py | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/meta/lib/oeqa/runtime/cases/systemd.py b/meta/lib/oeqa/runtime/cases/systemd.py > index 80fdae240a..7b3cb53e29 100644 > --- a/meta/lib/oeqa/runtime/cases/systemd.py > +++ b/meta/lib/oeqa/runtime/cases/systemd.py > @@ -155,6 +155,15 @@ class SystemdServiceTests(SystemdTest): > self.target.run('kill -SEGV %s' % output) > self.assertEqual(status, 0, msg = 'Not able to find process that runs sleep, output : %s' % output) > > + # Give some time to systemd-coredump@.service to process the coredump > + for x in range(20): > + status, output = self.target.run('coredumpctl --quiet --no-pager --no-legend | wc -l') > + if output == "1": > + break > + else: > + x += 1 > + time.sleep(1) > + > (status, output) = self.target.run('coredumpctl info') > self.assertEqual(status, 0, msg='MiniDebugInfo Test failed: %s' % output) > self.assertEqual('sleep_for_duration (busybox.nosuid' in output or 'xnanosleep (sleep.coreutils' in output, That looks better, thanks. I suspect you can simplify it a bit further to: for x in range(20): status, output = self.target.run('coredumpctl --quiet --no-pager --no-legend | wc -l') if output == "1": break time.sleep(1) Cheers, Richard
diff --git a/meta/lib/oeqa/runtime/cases/systemd.py b/meta/lib/oeqa/runtime/cases/systemd.py index 80fdae240a..7b3cb53e29 100644 --- a/meta/lib/oeqa/runtime/cases/systemd.py +++ b/meta/lib/oeqa/runtime/cases/systemd.py @@ -155,6 +155,15 @@ class SystemdServiceTests(SystemdTest): self.target.run('kill -SEGV %s' % output) self.assertEqual(status, 0, msg = 'Not able to find process that runs sleep, output : %s' % output) + # Give some time to systemd-coredump@.service to process the coredump + for x in range(20): + status, output = self.target.run('coredumpctl --quiet --no-pager --no-legend | wc -l') + if output == "1": + break + else: + x += 1 + time.sleep(1) + (status, output) = self.target.run('coredumpctl info') self.assertEqual(status, 0, msg='MiniDebugInfo Test failed: %s' % output) self.assertEqual('sleep_for_duration (busybox.nosuid' in output or 'xnanosleep (sleep.coreutils' in output,