Mercurial > hg-stable
changeset 32999:02bca6dc5f41
run-tests: update .t reference output after reading the test
The .t file is both test input and reference output. They should always
match. However we have different code paths to read reference output
(Test.__init__ -> Test.readrefout) and test input (TTest._run) so they might
be inconsistent if somethings change the file between those two functions.
This patch assigns "lines" read by "_run" back to "_refout" if "_refout" is
not None (with --debug, see Test.readrefout) so reference output and test
input will always match.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 21 Jun 2017 01:12:31 -0700 |
parents | 8dc62c97a665 |
children | 573baab2a797 |
files | tests/run-tests.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/run-tests.py Wed Jun 21 01:05:20 2017 -0700 +++ b/tests/run-tests.py Wed Jun 21 01:12:31 2017 -0700 @@ -1090,6 +1090,12 @@ lines = f.readlines() f.close() + # .t file is both reference output and the test input, keep reference + # output updated with the the test input. This avoids some race + # conditions where the reference output does not match the actual test. + if self._refout is not None: + self._refout = lines + salt, script, after, expected = self._parsetest(lines) # Write out the generated script.