summaryrefslogtreecommitdiffstats
path: root/bin/convwatch.py
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-04-25 14:23:42 +0200
committerMichael Stahl <mstahl@redhat.com>2016-04-27 15:52:41 +0200
commit61e8275de6043bbb888feea02ea8c7bea3e6abe8 (patch)
tree152cf36bd160d4a0f54ed1d4e413c98a43f88257 /bin/convwatch.py
parentconvwatch: add a watchdog for the layout loops :( (diff)
downloadcore-61e8275de6043bbb888feea02ea8c7bea3e6abe8.tar.gz
core-61e8275de6043bbb888feea02ea8c7bea3e6abe8.zip
convwatch: don't generate images for documents that failed to print
Change-Id: I2dba6ccbb7cbfb3719c2169dc74204014caf2e84
Diffstat (limited to 'bin/convwatch.py')
-rw-r--r--bin/convwatch.py27
1 files changed, 21 insertions, 6 deletions
diff --git a/bin/convwatch.py b/bin/convwatch.py
index 8fd145190cf8..4175c2f14a96 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: