[Libreoffice-commits] dev-tools.git: test-bugzilla-files/test-bugzilla-files.py
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 24 16:19:35 UTC 2020
test-bugzilla-files/test-bugzilla-files.py | 63 +++++++++++------------------
1 file changed, 24 insertions(+), 39 deletions(-)
New commits:
commit c3217424495e7818aef184541273806b9a39f443
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Apr 24 18:18:12 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Apr 24 18:18:12 2020 +0200
Revert "test-bugzilla-files: test the roundtripped files are still opening"
This reverts commit 1e23126c1a20eb08c30772e75f4bd4868153e8a5.
I wanted to submit it to gerrit. Instead, I pushed it to master
diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py
index b226718..8dd8e72 100644
--- a/test-bugzilla-files/test-bugzilla-files.py
+++ b/test-bugzilla-files/test-bugzilla-files.py
@@ -336,6 +336,22 @@ def writeExportCrash(fileName):
def exportDoc(xDoc, filterName, validationCommand, filename, connection, timer):
props = [ ("FilterName", filterName) ]
saveProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
+ extensions = { "calc8": ".ods",
+ "MS Excel 97": ".xls",
+ "Calc Office Open XML": ".xlsx",
+ "writer8": ".odt",
+ "Office Open XML Text": ".docx",
+ "Rich Text Format": ".rtf",
+ "MS Word 97": ".doc",
+ "impress8": ".odp",
+ "draw8": ".odg",
+ "Impress Office Open XML": ".pptx",
+ "MS PowerPoint 97": ".ppt",
+ "math8": ".odf",
+ "StarOffice XML (Base)": ".odb"
+ }
+ base = os.path.splitext(filename)[0]
+ filename = base + extensions[filterName]
# note: avoid empty path segments in the url!
fileURL = "file://" + os.path.normpath(os.environ["CRASHTESTDATA"] + "/current/" + filename)
t = None
@@ -384,36 +400,17 @@ class ExportFileTest:
self.filename = filename
self.enable_validation = enable_validation
self.timer = timer
- self.exportedFiles = []
def run(self, connection):
formats = self.getExportFormats()
print(formats)
- extensions = { "calc8": ".ods",
- "MS Excel 97": ".xls",
- "Calc Office Open XML": ".xlsx",
- "writer8": ".odt",
- "Office Open XML Text": ".docx",
- "Rich Text Format": ".rtf",
- "MS Word 97": ".doc",
- "impress8": ".odp",
- "draw8": ".odg",
- "Impress Office Open XML": ".pptx",
- "MS PowerPoint 97": ".ppt",
- "math8": ".odf",
- "StarOffice XML (Base)": ".odb"
- }
for format in formats:
filterName = self.getFilterName(format)
validation = self.getValidationCommand(filterName)
print(format)
print(filterName)
if filterName:
- base = os.path.splitext(self.filename)[0]
- filename = base + extensions[filterName]
- self.exportedFiles.append(filename)
-
- xExportedDoc = exportDoc(self.xDoc, filterName, validation, filename, connection, self.timer)
+ xExportedDoc = exportDoc(self.xDoc, filterName, validation, self.filename, connection, self.timer)
if xExportedDoc:
xExportedDoc.close(True)
@@ -482,12 +479,10 @@ class ExportFileTest:
return filterNames[format]
class LoadFileTest:
- def __init__(self, file, enable_validation, timer, doExport):
+ def __init__(self, file, enable_validation, timer):
self.file = file
self.enable_validation = enable_validation
self.timer = timer
- self.doExport = doExport
- self.exportedFiles = []
def run(self, xContext, connection):
print("Loading document: " + self.file)
@@ -505,11 +500,9 @@ class LoadFileTest:
xDoc = loadFromURL(xContext, url, t)
print("doc loaded")
t.cancel()
- if xDoc and self.doExport:
+ if xDoc:
exportTest = ExportFileTest(xDoc, self.file, self.enable_validation, self.timer)
exportTest.run(connection)
- self.exportedFiles = exportTest.exportedFiles
-
except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"):
print("caught UnknownPropertyException " + self.file)
if not t.is_alive():
@@ -577,13 +570,14 @@ class AsanTimer:
return 900
-def runLoadFileTests(opts, files, doExport):
+def runLoadFileTests(opts, file_list_name):
startTime = datetime.datetime.now()
connection = PersistentConnection(opts)
- exportedFiles = []
try:
tests = []
# print("before map")
+ files = []
+ files.extend(getFiles(file_list_name[0]))
files.sort()
asan = "--asan" in opts
print(asan)
@@ -593,15 +587,11 @@ def runLoadFileTests(opts, files, doExport):
else:
timer = NormalTimer()
- tests.extend( (LoadFileTest(file, not asan, timer, doExport) for file in files) )
+ tests.extend( (LoadFileTest(file, not asan, timer) for file in files) )
runConnectionTests(connection, simpleInvoke, tests)
-
- exportedFiles = [item for sublist in tests for item in sublist.exportedFiles]
finally:
connection.kill()
- return exportedFiles
-
def parseArgs(argv):
(optlist,args) = getopt.getopt(argv[1:], "hr",
["help", "soffice=", "userdir=", "valgrind", "asan"])
@@ -632,12 +622,7 @@ if __name__ == "__main__":
usage()
sys.exit()
elif "--soffice" in opts:
- files = []
- files.extend(getFiles(args[0]))
- exportedFiles = runLoadFileTests(opts, files, True)
-
- # Check the roundtripped files doesn't crash at import time
- runLoadFileTests(opts, exportedFiles, False)
+ runLoadFileTests(opts, args)
else:
usage()
sys.exit(1)
More information about the Libreoffice-commits
mailing list