Skip to content

Commit

Permalink
tests: logging: log_output: add cases for timestamps
Browse files Browse the repository at this point in the history
add cases for the different timestamp formats.

Signed-off-by: Fin Maaß <[email protected]>
  • Loading branch information
maass-hamburg authored and mmahadevan108 committed Sep 24, 2024
1 parent 54b2f56 commit 9ab8eee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/subsys/logging/log_output/src/log_output_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,15 @@ ZTEST(test_log_output, test_ts_flag)

ZTEST(test_log_output, test_format_ts)
{
#ifdef CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP
#define TIMESTAMP_STR "[1970-01-01 00:00:01.000,000] "
#elif defined(CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP)
#define TIMESTAMP_STR "[1970-01-01T00:00:01,000000Z] "
#else
#define TIMESTAMP_STR "[00:00:01.000,000] "
#endif
char package[256];
static const char *exp_str =
"[00:00:01.000,000] " DNAME "/" SNAME ": " TEST_STR "\r\n";
static const char *exp_str = TIMESTAMP_STR DNAME "/" SNAME ": " TEST_STR "\r\n";
uint32_t flags = LOG_OUTPUT_FLAG_TIMESTAMP | LOG_OUTPUT_FLAG_FORMAT_TIMESTAMP;
int err;

Expand Down
32 changes: 32 additions & 0 deletions tests/subsys/logging/log_output/testcase.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,38 @@ tests:
- logging
extra_configs:
- CONFIG_LOG_TIMESTAMP_64BIT=y
logging.output.ts64.date:
tags:
- log_output
- logging
extra_configs:
- CONFIG_LOG_TIMESTAMP_64BIT=y
- CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP=y
logging.output.ts64.date.fulllibc:
tags:
- log_output
- logging
extra_configs:
- CONFIG_LOG_TIMESTAMP_64BIT=y
- CONFIG_LOG_OUTPUT_FORMAT_DATE_TIMESTAMP=y
- CONFIG_REQUIRES_FULL_LIBC=y
filter: CONFIG_FULL_LIBC_SUPPORTED
logging.output.ts64.iso8601:
tags:
- log_output
- logging
extra_configs:
- CONFIG_LOG_TIMESTAMP_64BIT=y
- CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP=y
logging.output.ts64.iso8601.fulllibc:
tags:
- log_output
- logging
extra_configs:
- CONFIG_LOG_TIMESTAMP_64BIT=y
- CONFIG_LOG_OUTPUT_FORMAT_ISO8601_TIMESTAMP=y
- CONFIG_REQUIRES_FULL_LIBC=y
filter: CONFIG_FULL_LIBC_SUPPORTED
logging.output.thread_id:
tags:
- log_output
Expand Down

0 comments on commit 9ab8eee

Please sign in to comment.