tests: make inline warning behave like a normal part of log 58/242158/5
authorAdrian Szyndela <adrian.s@samsung.com>
Mon, 24 Aug 2020 13:56:59 +0000 (15:56 +0200)
committerMateusz Majewski <m.majewski2@samsung.com>
Fri, 28 Aug 2020 06:19:47 +0000 (08:19 +0200)
Inline warning is added to a log if timestamps are incorrect.
However, such warning is sometimes printed as a separate line,
with all metadata added, and sometimes printed as if it was
part of log lines.

This commit makes the tests conforming to the change in the printing
function: warning printing is now consistent with the printing
format. That is, if new lines get metadata, then warning also gets metadata,
and if new lines don't get metadata, then warning also doesn't get it.

Change-Id: I186330adb7728a715bc4bc85a386edfd2204c2ff

src/tests/logprint.c

index 6f5e727..ed87f57 100644 (file)
@@ -163,6 +163,7 @@ void check_logprint_testcases(struct dlogutil_entry_with_msg *entry, const struc
                        .format = tests[i].format,
                        .color = tests[i].color_enabled,
                }, 0, &entry->header) > 0);
+               fprintf(stderr, "format=%d, expected %s<, got %s<", tests[i].format, tests[i].result, buffer);
                assert(!strcmp(tests[i].result, buffer));
        }
 
@@ -432,12 +433,12 @@ void check_log_print_log_line()
        static const struct logprint_test_case tests_fixup_pipe[] = {
                // formats using the SENT timestamp (nominally)
                {FORMAT_TIME         , DLOG_INFO, false, "02-01 00:05:17.734+0000 I/BASIC TAG(    0): Basic message.\n"
-                                                        "02-01 00:05:17.734+0000 I/BASIC TAG(    0): [dlog inline warning: modified invalid timestamp]\n"              },
+                                                        "[dlog inline warning: modified invalid timestamp]\n"              },
                {FORMAT_LONG         , DLOG_INFO, false, "[ 02-01 00:05:17.734 I/BASIC TAG P    0, T    0]\n"
                                                         "Basic message.\n"
                                                         "[dlog inline warning: modified invalid timestamp]\n\n"                                                        },
                {FORMAT_THREADTIME   , DLOG_INFO, false, "02-01 00:05:17.734+0000 I/BASIC TAG(P    0, T    0): Basic message.\n"
-                                                        "02-01 00:05:17.734+0000 I/BASIC TAG(P    0, T    0): [dlog inline warning: modified invalid timestamp]\n"     },
+                                                        "[dlog inline warning: modified invalid timestamp]\n"     },
                {FORMAT_KERNELTIME   , DLOG_INFO, false, "365467.346 I/BASIC TAG(P    0, T    0): Basic message.\n"
                                                         "365467.346 I/BASIC TAG(P    0, T    0): [dlog inline warning: modified invalid timestamp]\n"                  },
 
@@ -445,17 +446,17 @@ void check_log_print_log_line()
                {FORMAT_RECV_REALTIME, DLOG_INFO, false, "02-01 00:05:17.734 I/BASIC TAG(P    0, T    0): Basic message.\n"
                                                         "02-01 00:05:17.734 I/BASIC TAG(P    0, T    0): [dlog inline warning: modified invalid timestamp]\n"          },
                {FORMAT_RWTIME       , DLOG_INFO, false, "02-01 00:05:17 [365467.346] I/BASIC TAG(P    0, T    0): Basic message.\n"
-                                                        "02-01 00:05:17 [365467.346] I/BASIC TAG(P    0, T    0): [dlog inline warning: modified invalid timestamp]\n" },
+                                                        "[dlog inline warning: modified invalid timestamp]\n" },
 
                // formats without a timestamp
                {FORMAT_BRIEF        , DLOG_INFO, false, "I/BASIC TAG(    0): Basic message.\n"
-                                                        "I/BASIC TAG(    0): [dlog inline warning: modified invalid timestamp]\n"                                      },
+                                                        "[dlog inline warning: modified invalid timestamp]\n"                                      },
                {FORMAT_PROCESS      , DLOG_INFO, false, "I(    0) Basic message.  (BASIC TAG)\n"
                                                         "I(    0) [dlog inline warning: modified invalid timestamp]  (BASIC TAG)\n"                                    },
                {FORMAT_TAG          , DLOG_INFO, false, "I/BASIC TAG: Basic message.\n"
-                                                        "I/BASIC TAG: [dlog inline warning: modified invalid timestamp]\n"                                             },
+                                                        "[dlog inline warning: modified invalid timestamp]\n"                                             },
                {FORMAT_THREAD       , DLOG_INFO, false, "I(P    0, T    0) Basic message.\n"
-                                                        "I(P    0, T    0) [dlog inline warning: modified invalid timestamp]\n"                                        },
+                                                        "[dlog inline warning: modified invalid timestamp]\n"                                        },
                {FORMAT_RAW          , DLOG_INFO, false, "Basic message.\n"
                                                         "[dlog inline warning: modified invalid timestamp]\n"                                                          },
                // JSON