blob: 6abddf7a11959213486ef3a15bbdfa61dacc1e4b [file] [log] [blame]
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +01001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (c) 2021, Heinrich Schuchardt <xypron.glpk@gmx.de>
4 *
5 * Test continuation of log messages using pr_cont().
6 */
7
8#include <common.h>
9#include <console.h>
10#include <test/log.h>
11#include <test/test.h>
12#include <test/suites.h>
13#include <test/ut.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060014#include <asm/global_data.h>
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010015#include <linux/printk.h>
16
17#define BUFFSIZE 64
18
19#undef CONFIG_LOGLEVEL
20#define CONFIG_LOGLEVEL 4
21
22DECLARE_GLOBAL_DATA_PTR;
23
24static int log_test_pr_cont(struct unit_test_state *uts)
25{
26 int log_fmt;
27 int log_level;
28
29 log_fmt = gd->log_fmt;
30 log_level = gd->default_log_level;
31
32 /* Write two messages, the second continuing the first */
33 gd->log_fmt = BIT(LOGF_MSG);
34 gd->default_log_level = LOGL_INFO;
35 console_record_reset_enable();
36 pr_err("ea%d ", 1);
37 pr_cont("cc%d\n", 2);
38 gd->default_log_level = log_level;
39 gd->log_fmt = log_fmt;
40 gd->flags &= ~GD_FLG_RECORD;
41 ut_assertok(ut_check_console_line(uts, "ea1 cc2"));
42 ut_assertok(ut_check_console_end(uts));
43
44 return 0;
45}
46LOG_TEST(log_test_pr_cont);