diff --git a/tests/core/coredump-options/task.yaml b/tests/core/coredump-options/task.yaml index 9116f1d01a3..740284187c7 100644 --- a/tests/core/coredump-options/task.yaml +++ b/tests/core/coredump-options/task.yaml @@ -6,6 +6,9 @@ details: | systems: [-ubuntu-core-1*, -ubuntu-core-20*, -ubuntu-core-22*] +restore: | + rm -f /var/lib/systemd/coredump/* + execute: | cfg_path=/etc/systemd/coredump.conf.d/ubuntu-core.conf @@ -13,9 +16,11 @@ execute: | expect=$(printf "[Coredump]\nStorage=none\nProcessSizeMax=0\n") test "$expect" = "$(cat $cfg_path)" - # TODO no coredumps are dropped, but we get a journal entry. Depends - # on https://github.com/snapcore/core-base/pull/227 being in the - # installed core24 channel already. + # try to generate dump + sleep 5 & pkill -ABRT sleep; wait $! || true + coredumpctl | MATCH 'none */usr/bin/sleep' + # This cleans-up the coredumctl list + sudo journalctl --rotate; sudo journalctl --vacuum-time=1ms # enable coredump with a max use size max_use=10M @@ -25,13 +30,16 @@ execute: | expect=$(printf "[Coredump]\nStorage=external\nMaxUse=%s\n" "$max_use") test "$expect" = "$(cat $cfg_path)" - # TODO Generate a core dump. Depends on - # https://github.com/snapcore/core-base/pull/227 too. + # Force generation of core dump and check it is present + sleep 5 & pkill -ABRT sleep; wait $! || true + coredumpctl | MATCH 'present */usr/bin/sleep' + coredumpctl dump --output=core + test -s core + # This cleans-up the coredumctl list and the core dump + sudo journalctl --rotate; sudo journalctl --vacuum-time=1ms + rm /var/lib/systemd/coredump/* # Finally, disable again - snap set system system.coredump.enable=false + snap set system system.coredump.enable=true expect=$(printf "[Coredump]\nStorage=none\nProcessSizeMax=0\n") test "$expect" = "$(cat $cfg_path)" - - # TODO no coredumps are dropped, but we get a journal entry - # Depends on https://github.com/snapcore/core-base/pull/227 too.