From 61e8275de6043bbb888feea02ea8c7bea3e6abe8 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 25 Apr 2016 14:23:42 +0200 Subject: convwatch: don't generate images for documents that failed to print Change-Id: I2dba6ccbb7cbfb3719c2169dc74204014caf2e84 --- bin/convwatch.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'bin/convwatch.py') 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: -- cgit