bin/convwatch.py | 118 +++++++++++++++++++++++++------------- editeng/source/items/frmitems.cxx | 1 logerrit | 13 ---- svx/source/dialog/rulritem.cxx | 1 4 files changed, 82 insertions(+), 51 deletions(-)
New commits: commit 4ec71284708bbeb0c4eb92c49a8a3e41de137b13 Author: Michael Stahl <mst...@redhat.com> Date: Tue Apr 26 16:00:16 2016 +0200 convwatch: use PerTestConnection by default It's more robust to restart soffice after every file, even if it takes more time, overall it's better than having to prune all the files that are invalid or cause loops before running convwatch. Change-Id: I7f7155f71bb2522ae48182aa1b5ca61fc47ae4d5 diff --git a/bin/convwatch.py b/bin/convwatch.py index abc88ad..dacf037 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -335,8 +335,8 @@ def runLoadPrintFileTests(opts, dirs, suffix, reference): prtsuffix = ".pdf" files = getFiles(dirs, suffix) tests = (LoadPrintFileTest(file, prtsuffix) for file in files) - connection = PersistentConnection(opts) -# connection = PerTestConnection(opts) +# connection = PersistentConnection(opts) + connection = PerTestConnection(opts) failed = runConnectionTests(connection, simpleInvoke, tests) print("all printed: FAILURES: " + str(len(failed))) for fail in failed: commit 66f769feb25f62042ac101132ce73043e6bcd135 Author: Michael Stahl <mst...@redhat.com> Date: Tue Apr 26 15:59:26 2016 +0200 convwatch: logExceptionInvoke is kind of pointless now ... that runLoadPrintFileTests catches the exceptions anyway. Change-Id: I6441551558e057427a9732451415f4c449a3609a diff --git a/bin/convwatch.py b/bin/convwatch.py index 4175c2f..abc88ad 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -214,19 +214,6 @@ def simpleInvoke(connection, test): finally: connection.postTest() -def logExceptionInvoke(connection, test): - try: - connection.preTest() - test.run(connection.getContext()) - except KeyboardInterrupt: - raise # Ctrl+C should work - except: - estr = traceback.format_exc() - log("logExceptionInvoke: FAILED with exception:\n" + estr) - raise - finally: - connection.postTest() - def retryInvoke(connection, test): tries = 5 while tries > 0: @@ -255,6 +242,8 @@ def runConnectionTests(connection, invoker, tests): raise # Ctrl+C should work except: failed.append(test.file) + estr = traceback.format_exc() + log("... FAILED with exception:\n" + estr) return failed finally: connection.tearDown() @@ -348,7 +337,7 @@ def runLoadPrintFileTests(opts, dirs, suffix, reference): tests = (LoadPrintFileTest(file, prtsuffix) for file in files) connection = PersistentConnection(opts) # connection = PerTestConnection(opts) - failed = runConnectionTests(connection, logExceptionInvoke, tests) + failed = runConnectionTests(connection, simpleInvoke, tests) print("all printed: FAILURES: " + str(len(failed))) for fail in failed: print(fail) commit 61e8275de6043bbb888feea02ea8c7bea3e6abe8 Author: Michael Stahl <mst...@redhat.com> Date: Mon Apr 25 14:23:42 2016 +0200 convwatch: don't generate images for documents that failed to print Change-Id: I2dba6ccbb7cbfb3719c2169dc74204014caf2e84 diff --git a/bin/convwatch.py b/bin/convwatch.py index 8fd1451..4175c2f 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -223,6 +223,7 @@ def logExceptionInvoke(connection, test): except: estr = traceback.format_exc() log("logExceptionInvoke: FAILED with exception:\n" + estr) + raise finally: connection.postTest() @@ -246,8 +247,15 @@ def retryInvoke(connection, test): def runConnectionTests(connection, invoker, tests): try: connection.setUp() + failed = [] for test in tests: - invoker(connection, test) + try: + invoker(connection, test) + except KeyboardInterrupt: + raise # Ctrl+C should work + except: + failed.append(test.file) + return failed finally: connection.tearDown() @@ -340,14 +348,18 @@ def runLoadPrintFileTests(opts, dirs, suffix, reference): tests = (LoadPrintFileTest(file, prtsuffix) for file in files) connection = PersistentConnection(opts) # connection = PerTestConnection(opts) - runConnectionTests(connection, logExceptionInvoke, tests) + failed = runConnectionTests(connection, logExceptionInvoke, tests) + print("all printed: FAILURES: " + str(len(failed))) + for fail in failed: + print(fail) + return failed def mkImages(file, resolution): argv = [ "gs", "-r" + resolution, "-sOutputFile=" + file + ".%04d.jpeg", "-dNOPROMPT", "-dNOPAUSE", "-dBATCH", "-sDEVICE=jpeg", file ] ret = subprocess.check_call(argv) -def mkAllImages(dirs, suffix, resolution, reference): +def mkAllImages(dirs, suffix, resolution, reference, failed): if reference: prtsuffix = ".pdf.reference" else: @@ -356,7 +368,10 @@ def mkAllImages(dirs, suffix, resolution, reference): files = filelist(dir, suffix) log(files) for f in files: - mkImages(f + prtsuffix, resolution) + if f in failed: + log("Skipping failed: " + f) + else: + mkImages(f + prtsuffix, resolution) def identify(imagefile): argv = ["identify", "-format", "%k", imagefile] @@ -440,8 +455,8 @@ if __name__ == "__main__": sys.exit() elif "--soffice" in opts: reference = "-r" in opts or "--reference" in opts - runLoadPrintFileTests(opts, args, ".odt", reference) - mkAllImages(args, ".odt", "200", reference) + failed = runLoadPrintFileTests(opts, args, ".odt", reference) + mkAllImages(args, ".odt", "200", reference, failed) if not(reference): compareAllImages(args, ".odt") else: commit 844ca4dcc658843cbada3d5f9e107e2513467659 Author: Michael Stahl <mst...@redhat.com> Date: Mon Apr 25 14:22:25 2016 +0200 convwatch: add a watchdog for the layout loops :( Change-Id: I33996f0d84e1a4b303b6f2cf7afa6cee32665a77 diff --git a/bin/convwatch.py b/bin/convwatch.py index 1b055e1..8fd1451 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -15,6 +15,7 @@ import time import uuid import datetime import traceback +import threading try: from urllib.parse import quote except ImportError: @@ -81,19 +82,19 @@ class OfficeConnection: if sep != ":": raise Exception("soffice parameter does not specify method") if method == "path": - socket = "pipe,name=pytest" + str(uuid.uuid1()) + self.socket = "pipe,name=pytest" + str(uuid.uuid1()) try: userdir = self.args["--userdir"] except KeyError: raise Exception("'path' method requires --userdir") if not(userdir.startswith("file://")): raise Exception("--userdir must be file URL") - self.soffice = self.bootstrap(rest, userdir, socket) + self.soffice = self.bootstrap(rest, userdir, self.socket) elif method == "connect": - socket = rest + self.socket = rest else: raise Exception("unsupported connection method: " + method) - self.xContext = self.connect(socket) + self.xContext = self.connect(self.socket) def bootstrap(self, soffice, userdir, socket): argv = [ soffice, "--accept=" + socket + ";urp", @@ -146,10 +147,25 @@ class OfficeConnection: raise Exception("Exit status indicates failure: " + str(ret)) # return ret +class WatchDog(threading.Thread): + def __init__(self, connection): + threading.Thread.__init__(self, name="WatchDog " + connection.socket) + self.connection = connection + def run(self): + try: + if self.connection.soffice: # not possible for "connect" + self.connection.soffice.wait(timeout=120) # 2 minutes? + except subprocess.TimeoutExpired: + log("WatchDog: TIMEOUT -> killing soffice") + self.connection.soffice.terminate() # actually killing oosplash... + self.connection.xContext = None + log("WatchDog: killed soffice") + class PerTestConnection: def __init__(self, args): self.args = args self.connection = None + self.watchdog = None def getContext(self): return self.connection.xContext def setUp(self): @@ -158,12 +174,15 @@ class PerTestConnection: conn = OfficeConnection(self.args) conn.setUp() self.connection = conn + self.watchdog = WatchDog(self.connection) + self.watchdog.start() def postTest(self): if self.connection: try: self.connection.tearDown() finally: self.connection = None + self.watchdog.join() def tearDown(self): assert(not(self.connection)) commit 32b6b0e934ff3ec08f4fa3bcf8b832cc8bff80a1 Author: Michael Stahl <mst...@redhat.com> Date: Mon Apr 25 11:59:37 2016 +0200 convwatch: if a document fails to load, log that instead of failing Bugzillas have lots of zip-files with wrong mime-types and non-well-formed files. Change-Id: I1238a35da0f222759439316a33b8927a3544a965 diff --git a/bin/convwatch.py b/bin/convwatch.py index fe091f3..1b055e1 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -14,6 +14,7 @@ import sys import time import uuid import datetime +import traceback try: from urllib.parse import quote except ImportError: @@ -194,6 +195,18 @@ def simpleInvoke(connection, test): finally: connection.postTest() +def logExceptionInvoke(connection, test): + try: + connection.preTest() + test.run(connection.getContext()) + except KeyboardInterrupt: + raise # Ctrl+C should work + except: + estr = traceback.format_exc() + log("logExceptionInvoke: FAILED with exception:\n" + estr) + finally: + connection.postTest() + def retryInvoke(connection, test): tries = 5 while tries > 0: @@ -308,7 +321,7 @@ def runLoadPrintFileTests(opts, dirs, suffix, reference): tests = (LoadPrintFileTest(file, prtsuffix) for file in files) connection = PersistentConnection(opts) # connection = PerTestConnection(opts) - runConnectionTests(connection, simpleInvoke, tests) + runConnectionTests(connection, logExceptionInvoke, tests) def mkImages(file, resolution): argv = [ "gs", "-r" + resolution, "-sOutputFile=" + file + ".%04d.jpeg", commit 97d9733b24ce94d0bd5f912706e9547f769788e6 Author: Michael Stahl <mst...@redhat.com> Date: Mon Apr 25 10:57:57 2016 +0200 convwatch: don't buffer stdout logging Change-Id: I0d32b150b65bf6bd30a988c2e028c5d7e05f195e diff --git a/bin/convwatch.py b/bin/convwatch.py index 749bdb3..fe091f3 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -38,6 +38,9 @@ except ImportError: ### utilities ### +def log(*args): + print(*args, flush=True) + def partition(list, pred): left = [] right = [] @@ -54,7 +57,7 @@ def filelist(dir, suffix): if not(dir[-1] == "/"): dir += "/" files = [dir + f for f in os.listdir(dir)] -# print(files) +# log(files) return [f for f in files if os.path.isfile(f) and os.path.splitext(f)[1] == suffix] @@ -105,32 +108,32 @@ class OfficeConnection: xUnoResolver = xLocalContext.ServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xLocalContext) url = "uno:" + socket + ";urp;StarOffice.ComponentContext" - print("OfficeConnection: connecting to: " + url) + log("OfficeConnection: connecting to: " + url) while True: try: xContext = xUnoResolver.resolve(url) return xContext # except com.sun.star.connection.NoConnectException except pyuno.getClass("com.sun.star.connection.NoConnectException"): - print("NoConnectException: sleeping...") + log("NoConnectException: sleeping...") time.sleep(1) def tearDown(self): if self.soffice: if self.xContext: try: - print("tearDown: calling terminate()...") + log("tearDown: calling terminate()...") xMgr = self.xContext.ServiceManager xDesktop = xMgr.createInstanceWithContext( "com.sun.star.frame.Desktop", self.xContext) xDesktop.terminate() - print("...done") + log("...done") # except com.sun.star.lang.DisposedException: except pyuno.getClass("com.sun.star.beans.UnknownPropertyException"): - print("caught UnknownPropertyException") + log("caught UnknownPropertyException") pass # ignore, also means disposed except pyuno.getClass("com.sun.star.lang.DisposedException"): - print("caught DisposedException") + log("caught DisposedException") pass # ignore else: self.soffice.terminate() @@ -205,7 +208,7 @@ def retryInvoke(connection, test): except KeyboardInterrupt: raise # Ctrl+C should work except: - print("retryInvoke: caught exception") + log("retryInvoke: caught exception") raise Exception("FAILED retryInvoke") def runConnectionTests(connection, invoker, tests): @@ -220,7 +223,7 @@ class EventListener(XDocumentEventListener,unohelper.Base): def __init__(self): self.layoutFinished = False def documentEventOccured(self, event): -# print(str(event.EventName)) +# log(str(event.EventName)) if event.EventName == "OnLayoutFinished": self.layoutFinished = True def disposing(event): @@ -250,14 +253,14 @@ def loadFromURL(xContext, url): while time_ < 30: if xListener.layoutFinished: return xDoc - print("delaying...") + log("delaying...") time_ += 1 time.sleep(1) - print("timeout: no OnLayoutFinished received") + log("timeout: no OnLayoutFinished received") return xDoc except: if xDoc: - print("CLOSING") + log("CLOSING") xDoc.close(True) raise finally: @@ -270,13 +273,13 @@ def printDoc(xContext, xDoc, url): uno.invoke(xDoc, "print", (tuple(props),)) # damn, that's a keyword! busy = True while busy: - print("printing...") + log("printing...") time.sleep(1) prt = xDoc.getPrinter() for value in prt: if value.Name == "IsBusy": busy = value.Value - print("...done printing") + log("...done printing") class LoadPrintFileTest: def __init__(self, file, prtsuffix): @@ -284,7 +287,7 @@ class LoadPrintFileTest: self.prtsuffix = prtsuffix def run(self, xContext): start = datetime.datetime.now() - print("Time: " + str(start) + " Loading document: " + self.file) + log("Time: " + str(start) + " Loading document: " + self.file) xDoc = None try: url = "file://" + quote(self.file) @@ -294,7 +297,7 @@ class LoadPrintFileTest: if xDoc: xDoc.close(True) end = datetime.datetime.now() - print("...done with: " + self.file + " in: " + str(end - start)) + log("...done with: " + self.file + " in: " + str(end - start)) def runLoadPrintFileTests(opts, dirs, suffix, reference): if reference: @@ -319,7 +322,7 @@ def mkAllImages(dirs, suffix, resolution, reference): prtsuffix = ".pdf" for dir in dirs: files = filelist(dir, suffix) - print(files) + log(files) for f in files: mkImages(f + prtsuffix, resolution) @@ -330,8 +333,8 @@ def identify(imagefile): if process.wait() != 0: raise Exception("identify failed") if result.partition(b"\n")[0] != b"1": - print("identify result: " + result.decode('utf-8')) - print("DIFFERENCE in " + imagefile) + log("identify result: " + result.decode('utf-8')) + log("DIFFERENCE in " + imagefile) def compose(refimagefile, imagefile, diffimagefile): argv = [ "composite", "-compose", "difference", @@ -343,24 +346,24 @@ def compareImages(file): if f.startswith(file)] # refimages = [f for f in filelist(os.path.dirname(file), ".jpeg") # if f.startswith(file + ".reference")] -# print("compareImages: allimages:" + str(allimages)) +# log("compareImages: allimages:" + str(allimages)) (refimages, images) = partition(sorted(allimages), lambda f: f.startswith(file + ".pdf.reference")) -# print("compareImages: images" + str(images)) +# log("compareImages: images" + str(images)) for (image, refimage) in zip(images, refimages): compose(image, refimage, image + ".diff") identify(image + ".diff") if (len(images) != len(refimages)): - print("DIFFERENT NUMBER OF IMAGES FOR: " + file) + log("DIFFERENT NUMBER OF IMAGES FOR: " + file) def compareAllImages(dirs, suffix): - print("compareAllImages...") + log("compareAllImages...") for dir in dirs: files = filelist(dir, suffix) -# print("compareAllImages:" + str(files)) +# log("compareAllImages:" + str(files)) for f in files: compareImages(f) - print("...compareAllImages done") + log("...compareAllImages done") def parseArgs(argv): commit a1f3f7da8d06671d9b719cc9f83a67cdf2b1c815 Author: Michael Stahl <mst...@redhat.com> Date: Mon Apr 25 10:53:41 2016 +0200 convwatch: let's print some timestamps Change-Id: I455017ad3458362b78d6306886344ccec3c9247b diff --git a/bin/convwatch.py b/bin/convwatch.py index 9d05511..749bdb3 100644 --- a/bin/convwatch.py +++ b/bin/convwatch.py @@ -13,6 +13,7 @@ import subprocess import sys import time import uuid +import datetime try: from urllib.parse import quote except ImportError: @@ -282,7 +283,8 @@ class LoadPrintFileTest: self.file = file self.prtsuffix = prtsuffix def run(self, xContext): - print("Loading document: " + self.file) + start = datetime.datetime.now() + print("Time: " + str(start) + " Loading document: " + self.file) xDoc = None try: url = "file://" + quote(self.file) @@ -291,7 +293,8 @@ class LoadPrintFileTest: finally: if xDoc: xDoc.close(True) - print("...done with: " + self.file) + end = datetime.datetime.now() + print("...done with: " + self.file + " in: " + str(end - start)) def runLoadPrintFileTests(opts, dirs, suffix, reference): if reference: @@ -392,7 +395,7 @@ def checkTools(): sys.exit(1) if __name__ == "__main__": -# checkTools() + checkTools() (opts,args) = parseArgs(sys.argv) if len(args) == 0: usage() commit 7895f7e1a8d12a89b69fe55326fde7b7f5a34b8f Author: Michael Stahl <mst...@redhat.com> Date: Tue Apr 26 17:22:47 2016 +0200 logerrit: disarm the "resubmit" foot-gun Recently some new developers accidentally used "resubmit", intending to upload a new revision of their change, but it actually always creates a new gerrit change. 4e15809a78ea3c6062e20e439cf8df3d06cd8569 claims that "resubmit creates a new Change-Id for the current change and thus allow to submit changes for review on release branches that were already reviewed on master", but that is not actually required with gerrit versions that were in use in the recent years, gerrit is capable of tracking Change-Id per branch. Change-Id: I66eda4dbc6f4ff1e235105b3f55041cda88a6b60 diff --git a/logerrit b/logerrit index a88c56f..6e7338a 100755 --- a/logerrit +++ b/logerrit @@ -45,12 +45,7 @@ case "$1" in echo echo " --- for submitters:" echo " submit [BRANCH] submit your change for review" - echo " resubmit [BRANCH] create a new Change-Id and submit your change for review" - echo " (yes, this modifies your last commit)" echo " submit-draft [BRANCH] submit your change as draft" - echo " resubmit-draft [BRANCH] create a new Change-Id and submit your change as draft" - echo " (yes, this modifies your last commit)" - echo " (yes, this modifies your last commit)" echo " nextchange [BRANCH] reset branch to the remote to start with the next change" echo " testfeature [BRANCH] trigger a test of a feature branch on gerrit" echo "Note: drafts are only visibly to yourself and those that you explicitly add as reviewers." @@ -136,17 +131,9 @@ case "$1" in submit) submit 'for' $2 ;; - resubmit) - git log -1 --pretty=%B | grep -v ^Change-Id: | git commit --amend -F - - submit 'for' $2 - ;; submit-draft) submit drafts $2 ;; - resubmit-draft) - git log -1 --pretty=%B | grep -v ^Change-Id: | git commit --amend -F - - submit drafts $2 - ;; nextchange) if test -n "`git status -s -uno`" then commit 3585cfe5f55f3ac8131a19abc5cbbf857364de9a Author: Michael Stahl <mst...@redhat.com> Date: Fri Apr 22 18:12:03 2016 +0200 todo odd warnings being printed Change-Id: I227ba7063827952525a4b190f864b4c7ffb3a6d8 diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index 62e4a42..d8c56829 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -461,6 +461,7 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const default: bRet = false; + // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have? OSL_FAIL("unknown MemberId"); } return bRet; diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx index 6942da2..88f0c1e 100644 --- a/svx/source/dialog/rulritem.cxx +++ b/svx/source/dialog/rulritem.cxx @@ -520,6 +520,7 @@ bool SvxColumnItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= bTable; break; default: + // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; OSL_FAIL("Wrong MemberId!"); return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits