Skip to content

Commit

Permalink
tests/coredump-options: test core dump generation
Browse files Browse the repository at this point in the history
The needed changes in the base are now in edge and beta core24
channels: make sure we are generating the core dumps.
  • Loading branch information
alfonsosanchezbeato committed Sep 27, 2024
1 parent d7f8099 commit 79abb39
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions tests/core/coredump-options/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ 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
# coredumps should be initially disabled
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
Expand All @@ -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.

0 comments on commit 79abb39

Please sign in to comment.