tests: tweak test output
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 9 Jun 2017 08:55:53 +0000 (10:55 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 9 Jun 2017 08:55:53 +0000 (10:55 +0200)
Tweak the log message header a bit: instead of having a fixed width
of the contents between the brackets in the header, fix the length of
the whole header to 8 characters.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
tests/gpiod-test.c

index 49a8e7f8b4808e40f4e8f55c485989fb2552aa70..10edd2b990109c3544fd9be976c1f274fa738acd 100644 (file)
@@ -126,8 +126,12 @@ static TEST_PRINTF(1, 2) void pr_raw(const char *fmt, ...)
 
 static void print_header(const char *hdr, int color)
 {
+       char buf[9];
+
+       snprintf(buf, sizeof(buf), "[%s]", hdr);
+
        set_color(color);
-       pr_raw("[%-5s] ", hdr);
+       pr_raw("%-8s", buf);
        reset_color();
 }