1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright 2021 Google LLC 4 * 5 * Logging function tests for CONFIG_LOG=n without #define DEBUG 6 */ 7 8#include <common.h> 9#include <console.h> 10#include <log.h> 11#include <asm/global_data.h> 12#include <test/log.h> 13#include <test/ut.h> 14 15DECLARE_GLOBAL_DATA_PTR; 16 17#define BUFFSIZE 32 18 19static int log_test_log_disabled_ndebug(struct unit_test_state *uts) 20{ 21 char buf[BUFFSIZE]; 22 int i; 23 24 memset(buf, 0, BUFFSIZE); 25 console_record_reset_enable(); 26 27 /* Output a log record at every level */ 28 for (i = LOGL_EMERG; i < LOGL_COUNT; i++) 29 log(LOGC_NONE, i, "testing level %i\n", i); 30 gd->flags &= ~GD_FLG_RECORD; 31 32 /* Since DEBUG is not defined, we expect to not get debug output */ 33 for (i = LOGL_EMERG; i < LOGL_DEBUG; i++) 34 ut_assertok(ut_check_console_line(uts, "testing level %d", i)); 35 ut_assertok(ut_check_console_end(uts)); 36 37 return 0; 38} 39LOG_TEST(log_test_log_disabled_ndebug); 40