1 // 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 <console.h> 9 #include <test/log.h> 10 #include <test/test.h> 11 #include <test/ut.h> 12 #include <asm/global_data.h> 13 #include <linux/printk.h> 14 15 #define BUFFSIZE 64 16 17 DECLARE_GLOBAL_DATA_PTR; 18 log_test_pr_cont(struct unit_test_state * uts)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; 30 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")); 36 ut_assert_console_end(); 37 38 return 0; 39 } 40 LOG_TEST(log_test_pr_cont); 41