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

Gülşah Köse (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 12 11:28:38 UTC 2021


 test-bugzilla-files/test-bugzilla-files.py |   31 ++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

New commits:
commit 71d3bfc24a3385351903e1b399e6050150ea5038
Author:     Gülşah Köse <gulsah.kose at collabora.com>
AuthorDate: Tue Aug 10 16:40:06 2021 +0300
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu Aug 12 13:28:17 2021 +0200

    Initial ODFunDiff integration to crash report tool.
    
    Change-Id: I05729cc4abe9d87e549933c9db63133b666cedfb
    Reviewed-on: https://gerrit.libreoffice.org/c/dev-tools/+/120273
    Tested-by: Miklos Vajna <vmiklos at collabora.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index 0d1121c..1b2ade0 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -332,6 +332,13 @@ def handleCrash(file, disposed):
 #    crashed_files.append(file)
 # add here the remaining handling code for crashed files
 
+def handleODFunDiff(file):
+    print("File: " + file + " has differences")
+    diffLog = open("odfundifflog.txt", "a")
+    diffLog.write(file + ' has differences after saving')
+    diffLog.write('\n')
+    diffLog.close()
+
 def alarm_handler(args):
     args.kill()
 
@@ -340,7 +347,7 @@ def writeExportCrash(fileName):
     exportCrash.write(fileName + '\n')
     exportCrash.close()
 
-def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
+def exportDoc(xDoc, filterName, validationCommand, odfundiffCommand, filename, connection, timer):
     props = [ ("FilterName", filterName) ]
     saveProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
     # note: avoid empty path segments in the url!
@@ -385,7 +392,19 @@ def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
                 validLog.close()
         except subprocess.CalledProcessError:
             pass # ignore that exception
-            
+
+    if odfundiffCommand:
+        odfundiffCommandWithURL = odfundiffCommand + " " + filename + " /srv/crashtestdata/current" + filename
+        print(odfundiffCommandWithURL)
+        try:
+            output = str(subprocess.check_output(odfundiffCommandWithURL, shell=True, timeout=600), encoding='utf-8')
+            if "number of differences found" in output:
+                validLog = open(fileURL[7:]+".log.odfundiff", "w")
+                validLog.write(output)
+                validLog.close()
+                handleODFunDiff(filename)
+        except subprocess.CalledProcessError:
+            pass
 
 class ExportFileTest:
     def __init__(self, xDoc, filename, enable_validation, timer):
@@ -415,6 +434,7 @@ class ExportFileTest:
         for format in formats:
             filterName = self.getFilterName(format)
             validation = self.getValidationCommand(filterName)
+            odfundiff = self.getODFunDiffCommand(filterName)
             print(format)
             print(filterName)
             if filterName:
@@ -422,7 +442,7 @@ class ExportFileTest:
                 filename = base + extensions[filterName]
                 self.exportedFiles.append(filename)
 
-                xExportedDoc = exportDoc(self.xDoc, filterName, validation, filename, connection, self.timer)
+                xExportedDoc = exportDoc(self.xDoc, filterName, validation, odfundiff, filename, connection, self.timer)
                 if xExportedDoc:
                     xExportedDoc.close(True)
 
@@ -473,6 +493,11 @@ class ExportFileTest:
             return None
         return validationCommand[filterName]
 
+    def getODFunDiffCommand(self, filterName):
+        if filterName == "writer8":
+            return "/home/buildslave/source/bin/odfundiff-exe"
+        return None
+
     def getFilterName(self, format):
         filterNames = { "ods": "calc8",
                 "xls": "MS Excel 97",


More information about the Libreoffice-commits mailing list