[Libreoffice-commits] .: 2 commits - test-bugzilla-files/test-bugzilla-files.py
test-bugzilla-files/test-bugzilla-files.py | 46 + 1 file changed, 28 insertions(+), 18 deletions(-) New commits: commit 5ab748ed8492bdab166706d175144100e338eb3f Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Thu Feb 21 21:00:24 2013 +0100 lets differentiate between DisposedException and UnkownPropertyException diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index 32fa3c2..cd41795 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -281,10 +281,12 @@ def loadFromURL(xContext, url): if xListener: xGEB.removeDocumentEventListener(xListener) -def handleCrash(file): +def handleCrash(file, disposed): print(File: + file + crashed) crashLog = open(crashlog.txt, a) -crashLog.write('Crash:' + file + '\n') +crashLog.write('Crash:' + file + ' ') +if disposed == 1: +crashLog.write('through disposed\n') crashLog.close() #crashed_files.append(file) # add here the remaining handling code for crashed files @@ -315,8 +317,8 @@ class LoadFileTest: self.state.timeoutFiles.append(self.file) else: t.cancel() -handleCrash(self.file) -self.state.badFiles.append(self.file) +handleCrash(self.file, 0) +self.state.badPropertyFiles.append(self.file) connection.tearDown() connection.setUp() except pyuno.getClass(com.sun.star.lang.DisposedException): @@ -326,8 +328,8 @@ class LoadFileTest: self.state.timeoutFiles.append(self.file) else: t.cancel() -handleCrash(self.file) -self.state.badFiles.append(self.file) +handleCrash(self.file, 1) +self.state.badDisposedFiles.append(self.file) connection.tearDown() connection.setUp() finally: @@ -338,12 +340,12 @@ class LoadFileTest: xDoc.close(True) except pyuno.getClass(com.sun.star.beans.UnknownPropertyException): print(caught UnknownPropertyException while closing) -self.state.badFiles.append(self.file) +self.state.badPropertyFiles.append(self.file) connection.tearDown() connection.setUp() except pyuno.getClass(com.sun.star.lang.DisposedException): print(caught DisposedException while closing) -self.state.badFiles.append(self.file) +self.state.badDisposedFiles.append(self.file) connection.tearDown() connection.setUp() print(...done with: + self.file) @@ -351,7 +353,8 @@ class LoadFileTest: class State: def __init__(self): self.goodFiles = [] -self.badFiles = [] +self.badDisposedFiles = [] +self.badPropertyFiles = [] self.timeoutFiles = [] @@ -363,13 +366,20 @@ def writeReport(state, startTime): goodFiles.write(file) goodFiles.write(\n) goodFiles.close() -badFiles = open(badFiles.log, w) -badFiles.write(All files tested which crashed:\n) -badFiles.write(Starttime: + startTime.isoformat() + \n) -for file in state.badFiles: -badFiles.write(file) -badFiles.write(\n) -badFiles.close() +badDisposedFiles = open(badDisposedFiles.log, w) +badDisposedFiles.write(All files tested which crashed:\n) +badDisposedFiles.write(Starttime: + startTime.isoformat() + \n) +for file in state.badDisposedFiles: +badDisposedFiles.write(file) +badDisposedFiles.write(\n) +badDisposedFiles.close() +badPropertyFiles = open(badPropertyFiles.log, w) +badPropertyFiles.write(All files tested which crashed:\n) +badPropertyFiles.write(Starttime: + startTime.isoformat() + \n) +for file in state.badPropertyFiles: +badPropertyFiles.write(file) +badPropertyFiles.write(\n) +badPropertyFiles.close() timeoutFiles = open(timeoutFiles.log, w) timeoutFiles.write(All files tested which timed out:\n) timeoutFiles.write(Starttime: + startTime.isoformat() + \n) commit 04c423912ebc63ba2923e91a9580bf526fc490e1 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Feb 19 03:42:44 2013 +0100 remove unused parameter diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index 7a12dc2..32fa3c2 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -245,7 +245,7 @@ def mkPropertyValue(name, value): ### tests ### -def loadFromURL(xContext, url, connection): +def loadFromURL(xContext, url): xDesktop = xContext.ServiceManager.createInstanceWithContext(
[Libreoffice-commits] .: 2 commits - test-bugzilla-files/test-bugzilla-files.py
test-bugzilla-files/test-bugzilla-files.py | 36 ++--- 1 file changed, 13 insertions(+), 23 deletions(-) New commits: commit 010acaf43fb399afc3197a11c71cd1dcd139a89c Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Feb 19 00:46:07 2013 +0100 handle crash during closing gracefully diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index b69ca49..0eb6074 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -332,8 +332,19 @@ class LoadFileTest: finally: if t.is_alive(): t.cancel() -if xDoc: -xDoc.close(True) +try: +if xDoc: +xDoc.close(True) +except pyuno.getClass(com.sun.star.beans.UnknownPropertyException): +print(caught UnknownPropertyException while closing) +self.state.badFiles.append(self.file) +connection.tearDown() +connection.setUp() +except pyuno.getClass(com.sun.star.lang.DisposedException): +print(caught DisposedException while closing) +self.state.badFiles.append(self.file) +connection.tearDown() +connection.setUp() print(...done with: + self.file) class State: commit 2937c3994112eb0afb3306f22a554f3e98516d60 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Tue Feb 19 00:40:15 2013 +0100 remove unused PerTestConnection diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index c8690b2..b69ca49 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -171,27 +171,6 @@ class OfficeConnection: print(command) os.system(command) -class PerTestConnection: -def __init__(self, args): -self.args = args -self.connection = None -def getContext(self): -return self.connection.xContext -def setUp(self): -assert(not(self.connection)) -def preTest(self): -conn = OfficeConnection(self.args) -conn.setUp() -self.connection = conn -def postTest(self): -if self.connection: -try: -self.connection.tearDown() -finally: -self.connection = None -def tearDown(self): -assert(not(self.connection)) - class PersistentConnection: def __init__(self, args): self.args = args ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] .: 2 commits - test-bugzilla-files/test-bugzilla-files.py
test-bugzilla-files/test-bugzilla-files.py | 88 +++-- 1 file changed, 46 insertions(+), 42 deletions(-) New commits: commit f77e09c7faed8cb244e4a5c5373041652a4fb8d3 Author: jorendc joren.libreoff...@telenet.be Date: Sun Dec 30 02:50:18 2012 +0100 add Class State which creates 3 lists that we need to compare later Conflicts: test-bugzilla-files/test-bugzilla-files.py diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index 62122a5..f66a5e7 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -149,12 +149,10 @@ class OfficeConnection: print(...done) #except com.sun.star.lang.DisposedException: except pyuno.getClass(com.sun.star.beans.UnknownPropertyException): -print(caught UnknownPropertyException) -print(crashed) +print(caught UnknownPropertyException while TearDown) pass # ignore, also means disposed except pyuno.getClass(com.sun.star.lang.DisposedException): -print(caught DisposedException) -print(crashed) +print(caught DisposedException while TearDown) pass # ignore else: self.soffice.terminate() @@ -292,12 +290,12 @@ def loadFromURL(xContext, url, connection): if xListener: xGEB.removeDocumentEventListener(xListener) -def handleCrash(file, crashed_files): +def handleCrash(file): print(File: + file + crashed) crashLog = open(crashlog.txt, a) crashLog.write('Crash:' + file + '\n') crashLog.close() -crashed_files.append(file) +#crashed_files.append(file) # add here the remaining handling code for crashed files class Alarm(Exception): @@ -307,9 +305,9 @@ def alarm_handler(): os.system(killall -9 soffice.bin) class LoadFileTest: -def __init__(self, file, crashed_files): +def __init__(self, file, stateNew): self.file = file -self.crashed_files = crashed_files +self.stateNew = stateNew def run(self, xContext, connection): print(Loading document: + self.file) t = None @@ -325,7 +323,8 @@ class LoadFileTest: t.cancel() print(TIMEOUT!) t.cancel() -handleCrash(self.file, self.crashed_files) +handleCrash(self.file) +self.stateNew.badFiles.append(self.file) connection.setUp() except pyuno.getClass(com.sun.star.lang.DisposedException): print(caught DisposedException + self.file) @@ -333,7 +332,8 @@ class LoadFileTest: print(TIMEOUT!) else: t.cancel() -handleCrash(self.file, self.crashed_files) +handleCrash(self.file) +self.stateNew.badFiles.append(self.file) connection.tearDown() connection.setUp() finally: @@ -342,6 +342,13 @@ class LoadFileTest: if xDoc: xDoc.close(True) print(...done with: + self.file) + +class State: +def __init__(self): +self.goodFiles = [] +self.badFiles = [] +self.unknown = [] + validFileExtensions = [ .docx , .rtf, .odt, .doc ] @@ -350,13 +357,14 @@ def runLoadFileTests(opts, dirs): for suffix in validFileExtensions: files.extend(getFiles(dirs, suffix)) files.sort() -crashed_files = [] -tests = (LoadFileTest(file, crashed_files) for file in files) +stateNew = State() #create stateNew instance +tests = (LoadFileTest(file, stateNew) for file in files) connection = PersistentConnection(opts) -#connection = PerTestConnection(opts) runConnectionTests(connection, simpleInvoke, tests) connection.tearDown() -print(crashed_files) +print(stateNew.goodFiles) +print(stateNew.badFiles) +print(stateNew.unknown) def parseArgs(argv): (optlist,args) = getopt.getopt(argv[1:], hr, commit 482bb1ae3cf7fdc7a3dfc30bfd371c95f09b8a65 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Feb 17 18:01:57 2013 +0100 get the timeout working diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index 7bf87d1..62122a5 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -33,6 +33,7 @@ import time import uuid import signal +import threading try: from urllib.parse import quote except ImportError: @@ -164,8 +165,6 @@ class OfficeConnection: if ret != 0: raise Exception(Exit status indicates failure: + str(ret)) #return ret -def kill(self): -os.system(killall -9 soffice.bin) class
[Libreoffice-commits] .: 2 commits - test-bugzilla-files/test-bugzilla-files.py
test-bugzilla-files/test-bugzilla-files.py | 82 +++-- 1 file changed, 55 insertions(+), 27 deletions(-) New commits: commit f6a935d7b779ecb0938de5056ddaea0d05be9b44 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Feb 17 23:20:20 2013 +0100 make the soffice window hidden again diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index bcd33fc..2d2b387 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -118,7 +118,7 @@ class OfficeConnection: argv = [ soffice, --accept= + socket + ;urp, -env:UserInstallation= + userdir, --quickstart=no, --nofirststartwizard, ---norestore, --nologo ] +--norestore, --nologo, --headless ] if --valgrind in self.args: argv.append(--valgrind) self.pro = subprocess.Popen(argv) commit 39ec29e0432b4a16f66aae71457807a6386096f2 Author: Markus Mohrhard markus.mohrh...@googlemail.com Date: Sun Feb 17 23:16:18 2013 +0100 fix some problems with test-bugzilla-files script diff --git a/test-bugzilla-files/test-bugzilla-files.py b/test-bugzilla-files/test-bugzilla-files.py index f66a5e7..bcd33fc 100644 --- a/test-bugzilla-files/test-bugzilla-files.py +++ b/test-bugzilla-files/test-bugzilla-files.py @@ -31,6 +31,7 @@ import subprocess import sys import time import uuid +import datetime import signal import threading @@ -267,11 +268,12 @@ def loadFromURL(xContext, url, connection): try: xDoc = None xDoc = xDesktop.loadComponentFromURL(url, _blank, 0, loadProps) -while True: +time_ = 0 +while time_ 30: if xListener.layoutFinished: -t.cancel() return xDoc print(delaying...) +time_ += 1 time.sleep(1) except pyuno.getClass(com.sun.star.beans.UnknownPropertyException): xListener = None @@ -298,42 +300,42 @@ def handleCrash(file): #crashed_files.append(file) # add here the remaining handling code for crashed files -class Alarm(Exception): -pass - def alarm_handler(): os.system(killall -9 soffice.bin) class LoadFileTest: -def __init__(self, file, stateNew): +def __init__(self, file, state): self.file = file -self.stateNew = stateNew +self.state = state def run(self, xContext, connection): print(Loading document: + self.file) t = None try: url = file:// + quote(self.file) xDoc = None -t = threading.Timer(5, alarm_handler) +t = threading.Timer(40, alarm_handler) t.start() xDoc = loadFromURL(xContext, url, connection) +self.state.goodFiles.append(self.file) except pyuno.getClass(com.sun.star.beans.UnknownPropertyException): print(caught UnknownPropertyException + self.file) if not t.is_alive(): -t.cancel() print(TIMEOUT!) -t.cancel() -handleCrash(self.file) -self.stateNew.badFiles.append(self.file) +self.state.timeoutFiles.append(self.file) +else: +t.cancel() +handleCrash(self.file) +self.state.badFiles.append(self.file) connection.setUp() except pyuno.getClass(com.sun.star.lang.DisposedException): print(caught DisposedException + self.file) if not t.is_alive(): print(TIMEOUT!) +self.state.timeoutFiles.append(self.file) else: t.cancel() handleCrash(self.file) -self.stateNew.badFiles.append(self.file) +self.state.badFiles.append(self.file) connection.tearDown() connection.setUp() finally: @@ -347,24 +349,50 @@ class State: def __init__(self): self.goodFiles = [] self.badFiles = [] -self.unknown = [] +self.timeoutFiles = [] validFileExtensions = [ .docx , .rtf, .odt, .doc ] +def writeReport(state, startTime): +goodFiles = open(goodFiles.log, w) +goodFiles.write(All files tested which opened perfectly:\n) +goodFiles.write(Starttime: + startTime.isoformat() +\n) +for file in state.goodFiles: +goodFiles.write(file) +goodFiles.write(\n) +goodFiles.close() +badFiles = open(badFiles.log, w) +badFiles.write(All files tested which crashed:\n) +badFiles.write(Starttime: + startTime.isoformat() + \n) +for file in state.badFiles: +badFiles.write(file) +badFiles.write(\n) +badFiles.close() +timeoutFiles = open(timeoutFiles.log, w) +timeoutFiles.write(All files tested which timed out:\n) +