Commit 51e7c29c authored by Carlos Garcia Campos's avatar Carlos Garcia Campos Committed by Carlos Garcia Campos

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.
parent d2059089
......@@ -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
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment