summaryrefslogtreecommitdiffstats
path: root/test/log
Commit message (Collapse)AuthorAgeFilesLines
* test: unit test for pr_err(), pr_cont()Heinrich Schuchardt2021-01-162-0/+46
| | | | | | | Provide a unit test for printing via pr_err() and pr_cont(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: log: add test for console output of dropped messagesPatrick Delaunay2021-01-151-0/+8
| | | | | | | | Add a new test to check the content of the dropped messages sent to console puts function. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: log: add test for dropped messagesPatrick Delaunay2021-01-151-8/+35
| | | | | | | | Add a new test to check the dropped messages when LOG is not ready with log_drop_count and the result of _log(). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: add LOGL_FORCE_DEBUG flags support in log testsPatrick Delaunay2021-01-151-9/+20
| | | | | | | | | | | | Add a check of the _log function with LOGL_FORCE_DEBUG flags, used to force the trace display. The trace should be displayed for all the level when flags have LOGL_FORCE_DEBUG bit is set, for any filter. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Add a test for log filter-*Sean Anderson2020-10-302-0/+109
| | | | | | | | | | This exercises a few success and failure modes of the log filter-* commands. log filter-list is not tested because it's purely informational. I don't think there's a good way to test it except by testing if the output of the command exactly matches a sample run. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Add test for LOGFF_MINSean Anderson2020-10-301-0/+23
| | | | | | | This tests log filters matching on a minimum level. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Add tests for LOGFF_DENYSean Anderson2020-10-301-0/+67
| | | | | | | This adds some tests for log filters which deny if they match. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: log: Give tests names instead of numbersSean Anderson2020-10-301-24/+24
| | | | | | | Now that the log test command is no more, we can give the log tests proper names. Signed-off-by: Sean Anderson <seanga2@gmail.com>
* test: log: Convert log_test from python to CSean Anderson2020-10-302-187/+255
| | | | | | | | | | | | | | | | When rebasing this series I had to renumber all my log tests because someone made another log test in the meantime. This involved updaing a number in several places (C and python), and it wasn't checked by the compiler. So I though "how hard could it be to just rewrite in C?" And though it wasn't hard, it *was* tedious. Tests are numbered the same as before to allow for easier review. A note that if a test fails, everything after it will probably also fail. This is because that test won't clean up its filters. There's no easy way to do the cleanup, except perhaps removing all filters in a wrapper function. Signed-off-by: Sean Anderson <seanga2@gmail.com>
* test: log: test message continuationHeinrich Schuchardt2020-10-272-1/+55
| | | | | | | | Provide a unit test checking that a continuation message will use the same log level and log category as the previous message. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: Fix sandbox tests failing to buildSean Anderson2020-10-172-2/+2
| | | | | | | | syslog_test.h is in test/log/, not include/ Fixes: 52d3df7fef ("log: Allow LOG_DEBUG to always enable log output") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* log: Disable the syslog driver by defaultSimon Glass2020-10-103-0/+42
| | | | | | | | | | This driver interferes with other sandbox tests since it causes log output to be interspersed with "No ethernet found." messages. Disable this driver by default. Enable it for the syslog tests so that they still pass. Signed-off-by: Simon Glass <sjg@chromium.org>
* log: Add a way to enable/disable a log deviceSimon Glass2020-10-101-0/+7
| | | | | | | At present all log devices are enabled by default. Add a function to allow devices to be disabled or enabled at runtime. Signed-off-by: Simon Glass <sjg@chromium.org>
* log: Drop #ifdef in log_testSimon Glass2020-10-101-2/+0
| | | | | | | This is not needed as the Makefile only builds the file if CONFIG_LOG_TEST is enabled. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* log: Allow LOG_DEBUG to always enable log outputSimon Glass2020-10-104-74/+108
| | | | | | | | | | | | | | | | | | | | | At present if CONFIG_LOG enabled, putting LOG_DEBUG at the top of a file (before log.h inclusion) causes _log() to be executed for every log() call, regardless of the build- or run-time logging level. However there is no guarantee that the log record will actually be displayed. If the current log level is lower than LOGL_DEBUG then it will not be. Add a way to signal that the log record should always be displayed and update log_passes_filters() to handle this. With the new behaviour, log_debug() will always log if LOG_DEBUG is enabled. Move log_test_syslog_nodebug() into its own file since it cannot be made to work where it is, with LOG_DEBUG defined. Signed-off-by: Simon Glass <sjg@chromium.org>
* log: don't show function by defaultHeinrich Schuchardt2020-07-091-6/+14
| | | | | | | | | | | | | The name of the function emitting a log message may be of interest for a developer but is distracting for normal users. See the example below: try_load_entry() Booting: Debian Make the default format for log messages customizable. By default show only the message text. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* common: Drop log.h from common headerSimon Glass2020-05-182-0/+2
| | | | | | Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
* command: Remove the cmd_tbl_t typedefSimon Glass2020-05-182-2/+3
| | | | | | | | | | | | | We should not use typedefs in U-Boot. They cannot be used as forward declarations which means that header files must include the full header to access them. Drop the typedef and rename the struct to remove the _s suffix which is now not useful. This requires quite a few header-file additions. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: fix naming of test functions in the log test suiteHeinrich Schuchardt2020-05-082-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Both the nolog as well as the syslog tests were not found by Python function generate_ut_subtest() due to not following the nameing requirements imposed by the regular expression used to find linker generated list entries in file u-boot.sym. Adjust the naming of test functions. With the patch the following tests are executed successfully for sandbox_defconfig: test/py/tests/test_ut.py::test_ut[ut_log_syslog_debug] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_err] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_info] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_nodebug] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_notice] PASSED test/py/tests/test_ut.py::test_ut[ut_log_syslog_warning] PASSED The nolog tests are only executed if CONFIG_LOG=n and CONFIG_CONSOLE_RECORD=y. Reported-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* test: log: test syslog logging driverHeinrich Schuchardt2020-04-162-0/+284
| | | | | | | Provide unit tests for the syslog logging driver. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: log functions with CONFIG_LOG=nHeinrich Schuchardt2020-04-163-0/+165
| | | | | | | | | | | | | | | | | | | If CONFIG_LOG=n, we still expect output for log_err(), log_warning(), log_notice(), log_info() and in case of DEBUG=1 also for log_debug(). Provide unit tests verifying this. The tests depend on: CONFIG_CONSOLE_RECORD=y CONFIG_LOG=n CONFIG_UT_LOG=y It may be necessary to increase the value of CONFIG_SYS_MALLOC_F_LEN to accommodate CONFIG_CONSOLE_RECORD=y. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* log: Add helpers for common log levelsSimon Glass2018-10-091-0/+13
| | | | | | | | | | | | | | | | | | | | | At present to output a log message you need something like: log(UCLASS_SPI, LOCL_INFO, "message1"); log(UCLASS_SPI, LOCL_INFO, "message2"); but many files use the same category throughout. Also it is helpful to shorten the length of log names, providing helpers for common logging levels. Add some macros so that it is possible to do: (top of file, before #includes) #define LOG_CATEGORY UCLASS_SPI (later in the file) log_info("message1"); log_debug("message2"); log_err("message3"); Signed-off-by: Simon Glass <sjg@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-072-5/+2
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* log: Add a test commandSimon Glass2017-12-072-0/+212
Add a command which exercises the logging system. Signed-off-by: Simon Glass <sjg@chromium.org>