diff --git a/test/subset/run-repack-tests.py b/test/subset/run-repack-tests.py index 69751f0c3..a0389e5aa 100755 --- a/test/subset/run-repack-tests.py +++ b/test/subset/run-repack-tests.py @@ -51,7 +51,7 @@ def fail_test(test, cli_args, message): def run_test(test, should_check_ots): - out_file = os.path.join(tempfile.mkdtemp(), test.font_name + "-subset.ttf") + out_file = os.path.join(out_dir, test.font_name + "-subset.ttf") cli_args = [ "--font-file=" + test.font_path(), "--output-file=" + out_file, @@ -117,12 +117,15 @@ path = args[0] if not path.endswith(".tests"): sys.exit("Not a valid test case path.") +out_dir = tempfile.mkdtemp() + with open(path, mode="r", encoding="utf-8") as f: # TODO(garretrieger): re-enable OTS checking. fails += run_test(RepackTest(path, f.read()), False) if fails != 0: - sys.exit("%d test(s) failed." % fails) + sys.exit("%d test(s) failed; output left in %s" % (fails, out_dir)) else: print("All tests passed.") + shutil.rmtree(out_dir) diff --git a/test/subset/run-tests.py b/test/subset/run-tests.py index 4aeed407e..e9b08fdba 100755 --- a/test/subset/run-tests.py +++ b/test/subset/run-tests.py @@ -59,7 +59,7 @@ def fail_test(test, cli_args, message): def run_test(test, should_check_ots, preprocess): out_file = os.path.join( - tempfile.mkdtemp(), test.get_font_name() + "-subset" + test.get_font_extension() + out_dir, test.get_font_name() + "-subset" + test.get_font_extension() ) cli_args = [ "--font-file=" + test.font_path, @@ -187,6 +187,7 @@ def open_subset_batch_process(): subset_process = open_subset_batch_process() +out_dir = tempfile.mkdtemp() fails = 0 for path in args: @@ -200,6 +201,7 @@ for path in args: fails += run_test(test, has_ots, True) if fails != 0: - sys.exit("%d test(s) failed." % fails) + sys.exit("%d test(s) failed; output left in %s" % (fails, out_dir)) else: print("All tests passed.") + shutil.rmtree(out_dir)