<HTML><BODY><div>LGTM.<br> <blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Понедельник, 30 марта 2020, 17:45 +03:00 от Sergey Bronnikov <sergeyb@tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><style type="text/css"></style><div><div id="style_15855795271423731614_BODY">Thanks for review!<br>I have updated typos in the branch.<br><br>On 17:34 Mon 30 Mar , Alexander Tikhonov wrote:<div class="mail-quote-collapse">><br>> Hi Sergey, thank you for the patch, LGTM, just minor corrections in comments<br>> behaviout → behaviour<br>> automagically → automaically<br>><br>> <br>> >Вторник, 24 марта 2020, 11:01 +03:00 от Sergey Bronnikov <<a href="/compose?To=sergeyb@tarantool.org">sergeyb@tarantool.org</a>>:<br>> > <br>> >In case of test failure test-run.py create a file .reject with actual<br>> >test output and one need to move .reject file to .result manually when<br>> >test has a valid behaviout. With option --update-ref-output test-run.py<br>> >will do it automagically.<br>> ><br>> >Fixes: #4654<br>> ><br>> >GitHub branch: <a href="https://github.com/tarantool/test-run/tree/ligurio/gh-4654-update-ref-output" target="_blank">https://github.com/tarantool/test-run/tree/ligurio/gh-4654-update-ref-output</a><br>> ><br>> >---<br>> > lib/options.py | 8 ++++++++<br>> > lib/test.py | 19 +++++++++++++++----<br>> > 2 files changed, 23 insertions(+), 4 deletions(-)<br>> ><br>> >diff --git a/lib/options.py b/lib/options.py<br>> >index 8bacb4a..174a62f 100644<br>> >--- a/lib/options.py<br>> >+++ b/lib/options.py<br>> >@@ -201,6 +201,14 @@ class Options:<br>> > help="""Run the server under 'luacov'.<br>> > Default: false.""")<br>> > <br>> >+ parser.add_argument(<br>> >+ "--update-ref-output",<br>> >+ dest="update_reference_output",<br>> >+ action="store_true",<br>> >+ default=False,<br>> >+ help="""Update file with reference output (.reject) in case of fail<br>> >+ and set status pass. Default: false.""")<br>> >+<br>> > # XXX: We can use parser.parse_intermixed_args() on<br>> > # Python 3.7 to understand commands like<br>> > # ./test-run.py foo --exclude bar baz<br>> >diff --git a/lib/test.py b/lib/test.py<br>> >index 3e93af3..396bb89 100644<br>> >--- a/lib/test.py<br>> >+++ b/lib/test.py<br>> >@@ -15,6 +15,7 @@ except ImportError:<br>> > from StringIO import StringIO<br>> > <br>> > import lib<br>> >+from lib.options import Options<br>> > from lib.colorer import color_stdout<br>> > from lib.utils import non_empty_valgrind_logs<br>> > from lib.utils import print_tail_n<br>> >@@ -242,23 +243,33 @@ class Test(object):<br>> > color_stdout("[ new ]\n", schema='test_new')<br>> > else:<br>> > has_result = os.path.exists(self.tmp_result)<br>> >+ update_reference = lib.Options().args.update_reference_output<br>> > if has_result:<br>> >- shutil.copy(self.tmp_result, self.reject)<br>> >- short_status = 'fail'<br>> >+ if update_reference:<br>> >+ reject_dest = self.result<br>> >+ else:<br>> >+ reject_dest = self.reject<br>> >+ shutil.copy(self.tmp_result, reject_dest)<br>> >+ if update_reference:<br>> >+ short_status = 'pass'<br>> >+ else:<br>> >+ short_status = 'fail'<br>> > color_stdout("[ fail ]\n", schema='test_fail')<br>> > <br>> > where = ""<br>> > if not self.is_crash_reported and not has_result:<br>> > color_stdout('\nCannot open %s\n' % self.tmp_result,<br>> > schema='error')<br>> >- elif not self.is_crash_reported and not self.is_executed_ok:<br>> >+ elif not self.is_crash_reported and not self.is_executed_ok and \<br>> >+ not update_reference:<br>> > self.print_diagnostics(self.reject,<br>> > "Test failed! Output from reject file "<br>> > "{0}:\n".format(self.reject))<br>> > server.print_log(15)<br>> > where = ": test execution aborted, reason " \<br>> > "'{0}'".format(diagnostics)<br>> >- elif not self.is_crash_reported and not self.is_equal_result:<br>> >+ elif not self.is_crash_reported and not self.is_equal_result and \<br>> >+ not update_reference:<br>> > self.print_unidiff()<br>> > server.print_log(15)<br>> > where = ": wrong test output"<br>> >--<br>> >2.23.0<br>> ><br>> ><br>> >--<br>> >sergeyb@<br>> <br>> <br>> --<br>> Alexander Tikhonov<br>> </div><br>--<br>sergeyb@</div></div></div></div></blockquote> <div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Oleg Piskunov</div></div></div><div> </div></div></BODY></HTML>