blob: 67d8ac59db97e6045ae86eaea0f69dd9675444a4 [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
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +01008#include <console.h>
9#include <test/log.h>
10#include <test/test.h>
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010011#include <test/ut.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060012#include <asm/global_data.h>
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010013#include <linux/printk.h>
14
15#define BUFFSIZE 64
16
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010017DECLARE_GLOBAL_DATA_PTR;
18
19static int log_test_pr_cont(struct unit_test_state *uts)
20{
21 int log_fmt;
22 int log_level;
23
24 log_fmt = gd->log_fmt;
25 log_level = gd->default_log_level;
26
27 /* Write two messages, the second continuing the first */
28 gd->log_fmt = BIT(LOGF_MSG);
29 gd->default_log_level = LOGL_INFO;
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010030 pr_err("ea%d ", 1);
31 pr_cont("cc%d\n", 2);
32 gd->default_log_level = log_level;
33 gd->log_fmt = log_fmt;
34 gd->flags &= ~GD_FLG_RECORD;
35 ut_assertok(ut_check_console_line(uts, "ea1 cc2"));
Simon Glassc579bd42024-08-22 07:58:03 -060036 ut_assert_console_end();
Heinrich Schuchardtb5a828e2021-01-04 08:02:56 +010037
38 return 0;
39}
40LOG_TEST(log_test_pr_cont);