From: Zbigniew Jędrzejewski-Szmek Date: Thu, 3 Sep 2020 10:58:30 +0000 (+0200) Subject: test-socket-netlink: print the proper expected string X-Git-Tag: v247-rc1~261^2~12 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=610618ff61a87ae652116d2e0b58fa556b3c66ba;p=thirdparty%2Fsystemd.git test-socket-netlink: print the proper expected string We would use the return value from the tested function to decide what to print as "expected", which is confusing when something is wrong with the tested function. --- diff --git a/src/test/test-socket-netlink.c b/src/test/test-socket-netlink.c index f86f1237827..f03e455d0ee 100644 --- a/src/test/test-socket-netlink.c +++ b/src/test/test-socket-netlink.c @@ -12,11 +12,19 @@ static void test_socket_address_parse_one(const char *in, int ret, int family, c int r; r = socket_address_parse(&a, in); - if (r >= 0) - assert_se(socket_address_print(&a, &out) >= 0); + if (r >= 0) { + r = socket_address_print(&a, &out); + if (r < 0) + log_error_errno(r, "Printing failed for \"%s\": %m", in); + assert(r >= 0); + } - log_info("\"%s\" → %s → \"%s\" (expect \"%s\")", in, - r >= 0 ? "✓" : "✗", empty_to_dash(out), r >= 0 ? expected ?: in : "-"); + log_info("\"%s\" → %s %d → \"%s\" (expect %d / \"%s\")", + in, + r >= 0 ? "✓" : "✗", r, + empty_to_dash(out), + ret, + ret >= 0 ? expected ?: in : "-"); assert_se(r == ret); if (r >= 0) { assert_se(a.sockaddr.sa.sa_family == family);