[systemd-devel] [systemd-commits] src/test

Thomas H.P. Andersen phomes at gmail.com
Fri Feb 8 14:16:21 PST 2013


On Fri, Feb 8, 2013 at 12:08 AM, Thomas H.P. Andersen <phomes at gmail.com> wrote:
> On Thu, Feb 7, 2013 at 10:30 PM, Zbigniew Jędrzejewski-Szmek
> <zbyszek at in.waw.pl> wrote:
>> On Thu, Feb 07, 2013 at 12:15:24PM -0800, Thomas H.P. Andersen wrote:
>>>  src/test/test-env-replace.c |  135 +++++++++++++++++++-------------------------
>>>  1 file changed, 60 insertions(+), 75 deletions(-)
>>>
>>> New commits:
>>> commit 1f28b2deb4e118cd2d2a5138ccb4cc45841c136d
>>> Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>>> Date:   Thu Feb 7 21:10:31 2013 +0100
>>>
>>>     test-env-replace: assert results instead of printing them
>> Hi Thomas,
>> I think that printing of the results is quite useful - when something goes
>> wrong. Whatever is printed goes into the test log anyway, so I think
>> those print statements should be kept.
>
> Hi Zbyszek,
>
> To make sense of the results you will have to look at both the test
> log and the code. I mean, just seeing lines like "BAR BARwaldo" in the
> log is not helpful without also looking at the test code :) With the
> asserts both the input and expected output can be seen directly in the
> code. For the log perhaps it would be okay to only write the expected
> result vs. actual result for failing asserts? Like:
> Assert failed. Expected "BAR BARwaldo" but got "BAR BAR". ?
>
> We could make an assert_eq(char *a, char *b) to handle that without
> cluttering the code with lots of printing.
> Or I can just add the printfs/puts back. It is not something I feel
> strongly about :)

Now that I re-read that I guess I was not very clear. Sorry.

Which way should I go?
a) write only failed asserts to the log (keep the code as it is)
b) write both failed and passed asserts to the log (perhaps handled by
an "assert_eq" helper function)
c) write all/some results to the log (put back the printf's)


More information about the systemd-devel mailing list