[libgxps] regtest: Update references also for tests that no longer crash
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgxps] regtest: Update references also for tests that no longer crash
- Date: Tue, 23 Jun 2015 17:25:31 +0000 (UTC)
commit da79d9106d706aeea01db3fb1f32c27e147ba7d4
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue Jun 23 19:05:50 2015 +0200
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.
regtest/Test.py | 24 ++++++++++++++++++++++++
regtest/TestRun.py | 2 ++
2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/regtest/Test.py b/regtest/Test.py
index c442ddb..2e42215 100644
--- a/regtest/Test.py
+++ b/regtest/Test.py
@@ -118,6 +118,30 @@ class Test:
return retval
+ def update_results(self, refs_path, out_path):
+ if not self.has_md5(refs_path):
+ path = os.path.join(refs_path, 'md5')
+ md5_file = open(path, '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, ref)
+ ref_path = os.path.join(refs_path, 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, 'md5')
diff --git a/regtest/TestRun.py b/regtest/TestRun.py
index c1f24e6..8362f56 100644
--- a/regtest/TestRun.py
+++ b/regtest/TestRun.py
@@ -77,6 +77,8 @@ class TestRun:
test_passed = False
if ref_has_md5 and test_has_md5:
test_passed = self._test.compare_checksums(refs_path, test_path, not self.config.keep_results,
self.config.create_diffs, self.config.update_refs)
+ elif self.config.update_refs:
+ self._test.update_results(refs_path, test_path)
with self._lock:
self._n_tests += 1
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]