[Libreoffice-commits] dev-tools.git: test-bugzilla-files/test-bugzilla-files.py

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 14 13:10:59 UTC 2020


 test-bugzilla-files/test-bugzilla-files.py |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

New commits:
commit 8f23d02970e1a5e7d5fc30f5a341d1e807fae9f8
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Oct 14 12:15:46 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Oct 14 15:10:39 2020 +0200

    use an explicit flag that the process was killed by timedOut
    
    instead of using Thread.is_alive
    
    if a document times out and the process killed, that document is recorded as a
    timeout and not a crash, but any other document the process is handling is
    recorded as a crash by its thread
    
    Change-Id: Ia38939814a37322d449371e902fb7e21a6067fe2
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/104284
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index b226718..0d1121c 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -84,6 +84,7 @@ class OfficeConnection:
         self.socket = None
         self.xContext = None
         self.pro = None
+        self.suicided = False
     def setUp(self):
         (method, sep, rest) = self.args["--soffice"].partition(":")
         if sep != ":":
@@ -149,12 +150,14 @@ class OfficeConnection:
                 self.soffice.terminate()
             ret = self.soffice.wait()
             self.xContext = None
+            self.suicided = False
             self.socket = None
             self.soffice = None
             if ret != 0:
                 raise Exception("Exit status indicates failure: " + str(ret))
 #            return ret
     def kill(self):
+        self.suicided = True
         command = "kill " + str(self.pro.pid)
         killFile = open("killFile.log", "a")
         killFile.write(command + "\n")
@@ -187,6 +190,10 @@ class PersistentConnection:
     def kill(self):
         if self.connection:
             self.connection.kill()
+    def suicided(self):
+        if self.connection:
+            return self.connection.suicided
+        return False
 
 def simpleInvoke(connection, test):
     try:
@@ -345,11 +352,13 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
         t.start()      
         xDoc.storeToURL(fileURL, saveProps)
     except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
-        if t.is_alive():
+        print("caught UnknownPropertyException " + filename + " timedOut: " + str(connection.suicided()))
+        if not connection.suicided():
             writeExportCrash(filename)
         raise # means crashed, handle it later
     except pyuno.getClass("com.sun.star.lang.DisposedException"):
-        if t.is_alive():
+        print("caught DisposedException " + filename + " timedOut: " + str(connection.suicided()))
+        if not connection.suicided():
             writeExportCrash(filename)
         raise # means crashed, handle it later
     except pyuno.getClass("com.sun.star.lang.IllegalArgumentException"):
@@ -511,20 +520,16 @@ class LoadFileTest:
                 self.exportedFiles = exportTest.exportedFiles
 
         except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
-            print("caught UnknownPropertyException " + self.file)
-            if not t.is_alive():
-                print("TIMEOUT!")
-            else:
+            print("caught UnknownPropertyException " + self.file + " timedOut: " + str(connection.suicided()))
+            if not connection.suicided():
                 t.cancel()
                 handleCrash(self.file, 0)
             connection.tearDown()
             connection.setUp()
             xDoc = None
         except pyuno.getClass("com.sun.star.lang.DisposedException"):
-            print("caught DisposedException " + self.file)
-            if not t.is_alive():
-                print("TIMEOUT!")
-            else:
+            print("caught DisposedException " + self.file + " timedOut: " + str(connection.suicided()))
+            if not connection.suicided():
                 t.cancel()
                 handleCrash(self.file, 1)
             connection.tearDown()


More information about the Libreoffice-commits mailing list