From 2ec66c9d3f1b766beabb1d6894fefeb6697196d2 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Mon, 17 Dec 2018 09:14:57 -0800 Subject: [PATCH] test-runner: fixed garbage output in test results When printing test results the line separators were not NULL terminated causing garbage bytes to be printed at the end. --- tools/test-runner.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/test-runner.c b/tools/test-runner.c index cc7cc0c7..ba610746 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -1923,6 +1923,7 @@ static void print_results(struct l_queue *test_stat_queue) char sep_line[80]; memset(sep_line, '_', sizeof(sep_line) - 1); + sep_line[sizeof(sep_line) - 1] = '\0'; l_info("%s\n" CONSOLE_LN_RESET, sep_line); l_info("%27s " CONSOLE_LN_DEFAULT "|" CONSOLE_LN_GREEN " %s " @@ -1932,6 +1933,7 @@ static void print_results(struct l_queue *test_stat_queue) "Configuration cycle", "PASSED", "FAILED", "TIMED OUT"); memset(sep_line, '-', sizeof(sep_line) - 1); + sep_line[sizeof(sep_line) - 1] = '\0'; l_info("%s" CONSOLE_LN_RESET, sep_line); l_queue_foreach(test_stat_queue, print_test_stat, &stat_totals); @@ -1946,6 +1948,7 @@ static void print_results(struct l_queue *test_stat_queue) stat_totals.total_timedout, stat_totals.total_duration); memset(sep_line, '_', sizeof(sep_line) - 1); + sep_line[sizeof(sep_line) - 1] = '\0'; l_info("%s" CONSOLE_LN_RESET, sep_line); }