From: Stefan Metzmacher Date: Thu, 5 Nov 2020 12:46:27 +0000 (+0100) Subject: SambaToolCmdTest: let assertCmdSuccess() escape ']\n' lines X-Git-Tag: samba-4.14.0rc1~636 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b3ffc61e2fe3011b8447af33fc4a1d095ed05884;p=thirdparty%2Fsamba.git SambaToolCmdTest: let assertCmdSuccess() escape ']\n' lines This gives a much higher chance to see the actual problem without having them filtered by various 'filter-subunit' invocations. Signed-off-by: Stefan Metzmacher Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/samba_tool/base.py b/python/samba/tests/samba_tool/base.py index 00e742e7c5b..ff6f9fcc5d3 100644 --- a/python/samba/tests/samba_tool/base.py +++ b/python/samba/tests/samba_tool/base.py @@ -105,8 +105,11 @@ class SambaToolCmdTest(samba.tests.BlackboxTestCase): return (result, cmd.outf.getvalue(), cmd.errf.getvalue()) def assertCmdSuccess(self, exit, out, err, msg=""): - self.assertIsNone(exit, msg="exit[%s] stdout[%s] stderr[%s]: %s" % ( - exit, out, err, msg)) + # Make sure we allow '\n]\n' in stdout and stderr + # without causing problems with the subunit protocol. + # We just inject a space... + msg = "exit[%s] stdout[%s] stderr[%s]: %s" % (exit, out, err, msg) + self.assertIsNone(exit, msg=msg.replace("\n]\n", "\n] \n")) def assertCmdFail(self, val, msg=""): self.assertIsNotNone(val, msg)