Skip to content

Commit 9ab8eee

Browse files
maass-hamburgmmahadevan108
authored andcommitted
tests: logging: log_output: add cases for timestamps
add cases for the different timestamp formats. Signed-off-by: Fin Maaß <[email protected]>
1 parent 54b2f56 commit 9ab8eee

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

tests/subsys/logging/log_output/src/log_output_test.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,15 @@ ZTEST(test_log_output, test_ts_flag)
129129

130130
ZTEST(test_log_output, test_format_ts)
131131
{
132+
#ifdef CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP
133+
#define TIMESTAMP_STR "[1970-01-01 00:00:01.000,000] "
134+
#elif defined(CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP)
135+
#define TIMESTAMP_STR "[1970-01-01T00:00:01,000000Z] "
136+
#else
137+
#define TIMESTAMP_STR "[00:00:01.000,000] "
138+
#endif
132139
char package[256];
133-
static const char *exp_str =
134-
"[00:00:01.000,000] " DNAME "/" SNAME ": " TEST_STR "\r\n";
140+
static const char *exp_str = TIMESTAMP_STR DNAME "/" SNAME ": " TEST_STR "\r\n";
135141
uint32_t flags = LOG_OUTPUT_FLAG_TIMESTAMP | LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
136142
int err;
137143

tests/subsys/logging/log_output/testcase.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@ tests:
1515
- logging
1616
extra_configs:
1717
- CONFIG_LOG_TIMESTAMP_64BIT=y
18+
logging.output.ts64.date:
19+
tags:
20+
- log_output
21+
- logging
22+
extra_configs:
23+
- CONFIG_LOG_TIMESTAMP_64BIT=y
24+
- CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP=y
25+
logging.output.ts64.date.fulllibc:
26+
tags:
27+
- log_output
28+
- logging
29+
extra_configs:
30+
- CONFIG_LOG_TIMESTAMP_64BIT=y
31+
- CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP=y
32+
- CONFIG_REQUIRES_FULL_LIBC=y
33+
filter: CONFIG_FULL_LIBC_SUPPORTED
34+
logging.output.ts64.iso8601:
35+
tags:
36+
- log_output
37+
- logging
38+
extra_configs:
39+
- CONFIG_LOG_TIMESTAMP_64BIT=y
40+
- CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP=y
41+
logging.output.ts64.iso8601.fulllibc:
42+
tags:
43+
- log_output
44+
- logging
45+
extra_configs:
46+
- CONFIG_LOG_TIMESTAMP_64BIT=y
47+
- CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP=y
48+
- CONFIG_REQUIRES_FULL_LIBC=y
49+
filter: CONFIG_FULL_LIBC_SUPPORTED
1850
logging.output.thread_id:
1951
tags:
2052
- log_output

0 commit comments

Comments
 (0)