minicoredumper: Add ptest

Add the demo from minicoredumper - that is intended as a test for it -
as a ptest for minicoredumper.

Result example:

root@qemux86-64:~# ptest-runner minicoredumper
START: ptest-runner
2023-02-02T12:27
BEGIN: /usr/lib/minicoredumper/ptest
minicoredumper_demo
expecting Segmentation fault with core dump ...
[   21.791878] minicoredumper_[330]: segfault at 0 ip 00000000004014f2 sp
00007ffe4271f870 error 4 in minicoredumper_demo[401000+1000] likely on CPU 0
(core 0, socket 0)
[   21.793886] Code: 00 b8 00 00 00 00 e8 7d fb ff ff 83 bd 5c ff ff ff 01 75
2f 48 c7 45 e8 00 00 00 00 bf 58 21 40 00 e8 52 fb ff ff 48 8b 45 e8 <0f> b6
00 0f be c0 89 c6 bf 77 21 40 00 b8 00 00 00 00 e8 47 ff
/usr/lib/minicoredumper/ptest/run-ptest: line 6:   330 Segmentation fault
minicoredumper_demo
minicoredumper
SUCCESS
DURATION: 3
END: /usr/lib/minicoredumper/ptest
2023-02-02T12:28
STOP: ptest-runner
TOTAL: 1 FAIL: 0
root@qemux86-64:~#

Please note the Segmentation fault is intended to provoke a coredump.

Signed-off-by: Simone Weiss <simone.weiss@elektrobit.com>
Signed-off-by: Kai Tomerius <kai.tomerius@elektrobit.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Simone Weiss 2023-02-03 06:44:14 +01:00 committed by Khem Raj
parent a83305a15d
commit 963f55df9e
3 changed files with 18 additions and 1 deletions

View File

@ -982,6 +982,7 @@ RDEPENDS:packagegroup-meta-oe-ptest-packages = "\
libee-ptest \
poco-ptest \
cmocka-ptest \
minicoredumper-ptest \
"
RDEPENDS:packagegroup-meta-oe-ptest-packages:append:x86 = " mcelog-ptest"
RDEPENDS:packagegroup-meta-oe-ptest-packages:append:x86-64 = " mcelog-ptest"

View File

@ -0,0 +1,12 @@
#!/bin/sh
echo minicoredumper_demo
echo expecting Segmentation fault with core dump ...
minicoredumper_demo 6 & sleep 3 && minicoredumper_demo
if ls /var/crash/ | grep minicoredumper; then
echo SUCCESS
else
echo FAIL
fi

View File

@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=71827c617ec7b45a0dd23658347cc1e9 \
"
DEPENDS = "elfutils dbus dbus-glib-native glib-2.0 dbus-glib util-linux json-c"
inherit autotools pkgconfig systemd update-rc.d
inherit autotools pkgconfig ptest systemd update-rc.d
SRCREV = "16a0d44f1725eaa93096eaa0e086f42ef4c2712c"
@ -18,6 +18,7 @@ SRC_URI = "git://github.com/diamon/minicoredumper;protocol=https;branch=master \
file://minicoredumper.service \
file://minicoredumper.init \
file://0001-minicoredumper-retry-elf-parsing-as-long-as-needed.patch \
file://run-ptest \
"
S = "${WORKDIR}/git"
@ -29,6 +30,9 @@ INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME:${PN} = "minicoredumper"
INITSCRIPT_PARAMS:${PN} = "defaults 89"
EXTRA_OECONF:append = " \
${@bb.utils.contains('PTEST_ENABLED', '1', '--with-minicoredumper_demo', '--without-libminicoredumper', d)} \
"
do_install:append() {
rmdir ${D}${localstatedir}/run
install -d ${D}/${sysconfdir}/minicoredumper