blob: 236eff4b33b3d211ec129c1f29d34a862861e7fb [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>
14#include <linux/printk.h>
15
16#define BUFFSIZE 64
17
18#undef CONFIG_LOGLEVEL
19#define CONFIG_LOGLEVEL 4
20
21DECLARE_GLOBAL_DATA_PTR;
22
23static int log_test_pr_cont(struct unit_test_state *uts)
24{
25 int log_fmt;
26 int log_level;
27
28 log_fmt = gd->log_fmt;
29 log_level = gd->default_log_level;
30
31 /* Write two messages, the second continuing the first */
32 gd->log_fmt = BIT(LOGF_MSG);
33 gd->default_log_level = LOGL_INFO;
34 console_record_reset_enable();
35 pr_err("ea%d ", 1);
36 pr_cont("cc%d\n", 2);
37 gd->default_log_level = log_level;
38 gd->log_fmt = log_fmt;
39 gd->flags &= ~GD_FLG_RECORD;
40 ut_assertok(ut_check_console_line(uts, "ea1 cc2"));
41 ut_assertok(ut_check_console_end(uts));
42
43 return 0;
44}
45LOG_TEST(log_test_pr_cont);