]>
Commit | Line | Data |
---|---|---|
92015767 HS |
1 | // SPDX-License-Identifier: GPL-2.0+ |
2 | /* | |
3 | * Copyright (c) 2020, Heinrich Schuchardt <[email protected]> | |
4 | * | |
5 | * Test continuation of log messages. | |
6 | */ | |
7 | ||
8 | #include <common.h> | |
9 | #include <console.h> | |
401d1c4f | 10 | #include <asm/global_data.h> |
92015767 HS |
11 | #include <test/log.h> |
12 | #include <test/test.h> | |
13 | #include <test/suites.h> | |
14 | #include <test/ut.h> | |
15 | ||
16 | DECLARE_GLOBAL_DATA_PTR; | |
17 | ||
18 | #define BUFFSIZE 64 | |
19 | ||
20 | static int log_test_cont(struct unit_test_state *uts) | |
21 | { | |
22 | int log_fmt; | |
23 | int log_level; | |
24 | ||
25 | log_fmt = gd->log_fmt; | |
26 | log_level = gd->default_log_level; | |
27 | ||
28 | /* Write two messages, the second continuing the first */ | |
29 | gd->log_fmt = (1 << LOGF_CAT) | (1 << LOGF_LEVEL) | (1 << LOGF_MSG); | |
30 | gd->default_log_level = LOGL_INFO; | |
31 | console_record_reset_enable(); | |
32 | log(LOGC_ARCH, LOGL_ERR, "ea%d ", 1); | |
33 | log(LOGC_CONT, LOGL_CONT, "cc%d\n", 2); | |
34 | gd->default_log_level = log_level; | |
35 | gd->log_fmt = log_fmt; | |
36 | gd->flags &= ~GD_FLG_RECORD; | |
37 | ut_assertok(ut_check_console_line(uts, "ERR.arch, ea1 ERR.arch, cc2")); | |
38 | ut_assertok(ut_check_console_end(uts)); | |
39 | ||
40 | /* Write a third message which is not a continuation */ | |
41 | gd->log_fmt = (1 << LOGF_CAT) | (1 << LOGF_LEVEL) | (1 << LOGF_MSG); | |
42 | gd->default_log_level = LOGL_INFO; | |
43 | console_record_reset_enable(); | |
44 | log(LOGC_EFI, LOGL_INFO, "ie%d\n", 3); | |
45 | gd->default_log_level = log_level; | |
46 | gd->log_fmt = log_fmt; | |
47 | gd->flags &= ~GD_FLG_RECORD; | |
48 | ut_assertok(ut_check_console_line(uts, "INFO.efi, ie3")); | |
49 | ut_assertok(ut_check_console_end(uts)); | |
50 | ||
51 | return 0; | |
52 | } | |
53 | LOG_TEST(log_test_cont); |