mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-15 21:28:15 +01:00
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
140 lines
3.3 KiB
C
140 lines
3.3 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (c) 2020, Heinrich Schuchardt <xypron.glpk@gmx.de>
|
|
*
|
|
* Logging function tests for CONFIG_LOG=n.
|
|
*/
|
|
|
|
/* Needed for testing log_debug() */
|
|
#define DEBUG 1
|
|
|
|
#include <common.h>
|
|
#include <console.h>
|
|
#include <log.h>
|
|
#include <asm/global_data.h>
|
|
#include <test/log.h>
|
|
#include <test/test.h>
|
|
#include <test/suites.h>
|
|
#include <test/ut.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
#define BUFFSIZE 32
|
|
|
|
static int log_test_nolog_err(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_err("testing %s\n", "log_err");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing log_err"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_err);
|
|
|
|
static int log_test_nolog_warning(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_warning("testing %s\n", "log_warning");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing log_warning"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_warning);
|
|
|
|
static int log_test_nolog_notice(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_notice("testing %s\n", "log_notice");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing log_notice"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_notice);
|
|
|
|
static int log_test_nolog_info(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_err("testing %s\n", "log_info");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing log_info"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_info);
|
|
|
|
#undef _DEBUG
|
|
#define _DEBUG 0
|
|
static int nolog_test_nodebug(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
debug("testing %s\n", "debug");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(nolog_test_nodebug);
|
|
|
|
static int log_test_nolog_nodebug(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_debug("testing %s\n", "log_debug");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assert(!strcmp(buf, ""));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_nodebug);
|
|
|
|
#undef _DEBUG
|
|
#define _DEBUG 1
|
|
static int nolog_test_debug(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
debug("testing %s\n", "debug");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing debug"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(nolog_test_debug);
|
|
|
|
static int log_test_nolog_debug(struct unit_test_state *uts)
|
|
{
|
|
char buf[BUFFSIZE];
|
|
|
|
memset(buf, 0, BUFFSIZE);
|
|
console_record_reset_enable();
|
|
log_debug("testing %s\n", "log_debug");
|
|
log(LOGC_NONE, LOGL_DEBUG, "more %s\n", "log_debug");
|
|
gd->flags &= ~GD_FLG_RECORD;
|
|
ut_assertok(ut_check_console_line(uts, "testing log_debug"));
|
|
ut_assertok(ut_check_console_line(uts, "more log_debug"));
|
|
ut_assertok(ut_check_console_end(uts));
|
|
return 0;
|
|
}
|
|
LOG_TEST(log_test_nolog_debug);
|