uitest/uitest/framework.py |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

New commits:
commit e8dd8f9888386eef334bb16ee19a5d335cc810d6
Author:     Neil Roberts <[email protected]>
AuthorDate: Fri Nov 21 13:01:00 2025 +0100
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Nov 22 11:41:32 2025 +0100

    uitest/framework: Throw an exception when a signal is received
    
    When a signal is received such as when the unit test is killed by the
    kill-wrapper, the framework catches the signal and terminates the
    connection to LibreOffice. However it would then continue executing the
    test. This makes it difficult to diagnose problems when the kill-wrapper
    is invoked. This patch makes it instead throw an exception so that the
    build log will have a backtrace. It also changes the resetSignalHandler
    method to set the signal handlers to the DEFAULT rather than IGNORE,
    because ignoring all subsequent signals seems like an unusual thing to
    do and there is no comment explaining it so it seems likely to be a
    mistake.
    
    Change-Id: I8d8283cccd4de1ce55b0a6cd947c1647d28f462f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194321
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins

diff --git a/uitest/uitest/framework.py b/uitest/uitest/framework.py
index 0bb6d3ecdbf7..182ccd4e3535 100644
--- a/uitest/uitest/framework.py
+++ b/uitest/uitest/framework.py
@@ -63,6 +63,8 @@ class UITestCase(unittest.TestCase):
     def signalHandler(self, signum, frame):
         if self.getConnection():
             self.getConnection().kill()
+        self.resetSignalHandler()
+        raise Exception(f"Caught signal {signum}")
 
     def setSignalHandler(self):
         signal.signal(signal.SIGABRT, self.signalHandler)
@@ -71,9 +73,9 @@ class UITestCase(unittest.TestCase):
         signal.signal(signal.SIGILL, self.signalHandler)
 
     def resetSignalHandler(self):
-        signal.signal(signal.SIGABRT, signal.SIG_IGN)
-        signal.signal(signal.SIGSEGV, signal.SIG_IGN)
-        signal.signal(signal.SIGTERM, signal.SIG_IGN)
-        signal.signal(signal.SIGILL, signal.SIG_IGN)
+        signal.signal(signal.SIGABRT, signal.SIG_DFL)
+        signal.signal(signal.SIGSEGV, signal.SIG_DFL)
+        signal.signal(signal.SIGTERM, signal.SIG_DFL)
+        signal.signal(signal.SIGILL, signal.SIG_DFL)
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to