[poppler] regtest/backends regtest/TestRun.py
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Fri Nov 7 09:36:24 PST 2014
regtest/TestRun.py | 2 ++
regtest/backends/__init__.py | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+)
New commits:
commit 51e7c29cabedc72e097023e6d8d6d68ed43fa20c
Author: Carlos Garcia Campos <cgarcia at igalia.com>
Date: Fri Nov 7 18:30:36 2014 +0100
regtest: Update references also for tests that no longer crash
We are currently updating the refs only when we have checksums to
compare, but if a test used to crash there's no md5 file in refs.
diff --git a/regtest/TestRun.py b/regtest/TestRun.py
index 2531911..99b23ea 100644
--- a/regtest/TestRun.py
+++ b/regtest/TestRun.py
@@ -84,6 +84,8 @@ class TestRun:
test_passed = False
if ref_has_md5 and test_has_md5:
test_passed = backend.compare_checksums(refs_path, test_path, not self.config.keep_results, self.config.create_diffs, self.config.update_refs)
+ elif self.config.update_refs:
+ backend.update_results(refs_path, test_path)
with self._lock:
self._n_tests += 1
diff --git a/regtest/backends/__init__.py b/regtest/backends/__init__.py
index 89b5755..95de143 100644
--- a/regtest/backends/__init__.py
+++ b/regtest/backends/__init__.py
@@ -145,6 +145,30 @@ class Backend:
return retval
+ def update_results(self, refs_path, out_path):
+ if not self.has_md5(refs_path):
+ path = os.path.join(refs_path, self._name)
+ md5_file = open(path + '.md5', 'w')
+
+ for entry in sorted(os.listdir(out_path)):
+ if not self.__should_have_checksum(entry):
+ continue
+ result_path = os.path.join(out_path, entry)
+ ref_path = os.path.join(refs_path, entry)
+ md5_file.write("%s %s\n" % (self.__md5sum(result_path), ref_path))
+ shutil.copyfile(result_path, ref_path)
+
+ md5_file.close()
+
+ for ref in ('.crashed', '.failed', '.stderr'):
+ result_path = os.path.join(out_path, self._name + ref)
+ ref_path = os.path.join(refs_path, self._name + ref)
+
+ if os.path.exists(result_path):
+ shutil.copyfile(result_path, ref_path)
+ elif os.path.exists(ref_path):
+ os.remove(ref_path)
+
def get_ref_names(self, refs_path):
retval = []
md5_path = os.path.join(refs_path, self._name)
More information about the poppler
mailing list