On 27/03/2023 13:38, Lennart Poettering wrote:
another idea: can't you just wrap your tests in "systemd-run --scope --user --name=somtestid47110815.scope" or so? we pick up unit names in coredump handling. With that you'd run yur tests inside a scope unit, and can then use that as key in logs+coredump.
Thanks, that looks useful, `systemd-run --scope --user --unit=... ...` and `coredumpctl debug COREDUMP_USER_UNIT=....scope ...`.
* Is it guaranteed for system-run --scope that the wrapped command will run in the surrounding process group? (Because LibreOffice' Jenkins relies on a single process group for a whole `make check` to reliably kill stuck builds. And it looks like systemd-run --scope is just a lightweight wrapper that then exec's the command in the same process, which looks promising.)
* Is there a grammar for those --unit=X resp. COREDUMP_USER_UNIT=X'.scope values? I noticed that at least "/" in X gets replaced with "-" in X'. Is there a length limit?
* Is there a direct way to run `coredumpctl debug COREDUMP_USER_UNIT=....scope ...` on all matching core dumps, not just the most recent one? (I figured I need to prepare a list with `coredumpctl --json=short list COREDUMP_USER_UNIT=....scope | jq -r 'map(select(.corefile="present"))|map(.pid)|join(" ")' first, and then iterate over it with `coredumpctl debug COREDUMP_USER_UNIT=....scope COREDUMP_PID="$i" ...`)