oeqa/runtime: fix race-condition in minidebuginfo test
PATCH v3 1/1 oeqa/runtime: fix race-condition in minidebuginfo test
From: Etienne Cordonnier <[email protected]>
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 [email protected] unit is running, output may be incomplete. ```
--- meta/lib/oeqa/runtime/cases/systemd.py | 7 +++++++ 1 file changed, 7 insertions(+)
meta/lib/oeqa/runtime/cases/systemd.py +7 -0
@@ -155,6 +155,13 @@ 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 [email protected] 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 + 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,
Signature · 1 line
2.36.1.vfs.0.0
Quoted 22 lines · Etienne Cordonnier via lists.openembedded.org
From: Etienne Cordonnier <[email protected]>
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 [email protected] unit is running, output may be incomplete. ```Signed-off-by Etienne Cordonnier <[email protected]>---
meta/lib/oeqa/runtime/cases/systemd.py| 7 +++++++1 file changed, 7 insertions(+)meta/lib/oeqa/runtime/cases/systemd.py +0
-0@@ -155,6 +155,13 @@ class SystemdServiceTests(SystemdTest): self.target.run('kill -SEGV %s' % output)
meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 165
Quoted 10 lines
meta/lib/oeqa/runtime/cases/systemd.py +7
-0self.assertEqual(status, 0, msg = 'Not able to find process that runs sleep, output : %s' % output) + # Give some time to [email protected] 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 + time.sleep(1) + (status, output) = self.target.run('coredumpctl info')
As someone who spent too long staring at mysterious failures in the debuginfod tests, I recommend you add an ‘else’ case to that loop so that you can explicitly fail if the timeout expires without breaking out.
Also it feels like the test could be made more reliably by using matches instead of just asking it to list all crashes and expecting it to be one (what if something else crashed?), and assuming the latest crash is the one we’re after. If you use matches then the exit code is set to non-zero if the match isn’t found, so you could combine the retry loop and the actual test into one.
Ross
Hi Ross,
OK, I addressed your feedback. On a side note, coredumpctl matches based on process names are really confusing when used with symlinks. I used a match based on pid to avoid the confusion:
"
# coredumpctl list TIME PID UID GID SIG COREFILE EXE SIZE Tue 2024-05-21 05:36:50 GMT 3442 0 0 SIGSEGV present /usr/bin/coreutils 109.0K
# coredumpctl list coreutils No coredumps found.
# coredumpctl list sleep TIME PID UID GID SIG COREFILE EXE SIZE Tue 2024-05-21 05:36:50 GMT 3442 0 0 SIGSEGV present /usr/bin/coreutils 109.0K "
Quoted 53 lines · Ross Burton
Quoted 4 lines · Etienne Cordonnier via lists.openembedded.org
From: Etienne Cordonnier <[email protected]>
Fix this error where 'coredumpctl info' warns that the coredump is still
being
Quoted 5 lines
processed:
```
AssertionError: 1 != 0 : MiniDebugInfo Test failed: No match found. -- Notice: 1 [email protected] unit is running, output may beincomplete.
Review
Quoted 8 lines
```
Signed-off-by Etienne Cordonnier <[email protected]>---
meta/lib/oeqa/runtime/cases/systemd.py| 7 +++++++1 file changed, 7 insertions(+)(quoted diff) +0
-0
b/meta/lib/oeqa/runtime/cases/systemd.pymeta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 156
Quoted 6 lines
index
80fdae240a..aed230708e100644meta/lib/oeqa/runtime/cases/systemd.py +0
-0@@ -155,6 +155,13 @@ class SystemdServiceTests(SystemdTest): self.target.run('kill -SEGV %s' % output) self.assertEqual(status, 0, msg = 'Not able to find process thatruns sleep, output : %s' % output)
meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 157
Quoted 2 lines
meta/lib/oeqa/runtime/cases/systemd.py +1
-0+ # Give some time to [email protected] to process thecoredump
meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 159
Quoted 2 lines
meta/lib/oeqa/runtime/cases/systemd.py +2
-0+ for x in range(20): + status, output = self.target.run('coredumpctl --quiet--no-pager --no-legend | wc -l')
meta/lib/oeqa/runtime/cases/systemd.py class SystemdServiceTests(SystemdTest): · line 165
Quoted 5 lines
meta/lib/oeqa/runtime/cases/systemd.py +4
-0+ if output == "1": + break + time.sleep(1) + (status, output) = self.target.run('coredumpctl info')As someone who spent too long staring at mysterious failures in the debuginfod tests, I recommend you add an ‘else’ case to that loop so that you can explicitly fail if the timeout expires without breaking out.
Also it feels like the test could be made more reliably by using matches instead of just asking it to list all crashes and expecting it to be one (what if something else crashed?), and assuming the latest crash is the one
we’re after. If you use matches then the exit code is set to non-zero if
the match isn’t found, so you could combine the retry loop and the actual test into one.Ross