From 3c8ac241b852effb2e342c36a1ca413bb57c059c Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Fri, 30 Jul 2021 22:36:07 +0200 Subject: [PATCH] tests: Try to show backtrace when killed by SIGTERM This means that we may manage to show a backtrace if meson kills the test process due to a timeout. --- tests/fprintd.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/fprintd.py b/tests/fprintd.py index 1f8faee..8719e53 100644 --- a/tests/fprintd.py +++ b/tests/fprintd.py @@ -38,6 +38,7 @@ gi.require_version('FPrint', '2.0') from gi.repository import GLib, Gio, FPrint from output_checker import OutputChecker import cairo +import signal try: from subprocess import DEVNULL @@ -164,6 +165,11 @@ class FPrintdTest(dbusmock.DBusTestCase): @classmethod def setUpClass(cls): + # Try to generate backtrace if meson kills as with SIGTERM + def r(*args): + raise KeyboardInterrupt() + signal.signal(signal.SIGTERM, r) + super().setUpClass() fprintd = None cls._polkitd = None