
This tests log filters matching on a minimum level.
Signed-off-by: Sean Anderson seanga2@gmail.com ---
(no changes since v1)
test/log/log_test.c | 23 +++++++++++++++++++++++ test/py/tests/test_log.py | 5 +++++ 2 files changed, 28 insertions(+)
diff --git a/test/log/log_test.c b/test/log/log_test.c index 6a71d3db7d..da433e332b 100644 --- a/test/log/log_test.c +++ b/test/log/log_test.c @@ -265,6 +265,29 @@ static int log_test(int testnum) return ret; break; } + case 14: { + /* Check matching based on minimum level */ + int filt1, filt2; + + ret = log_add_filter_flags("console", NULL, LOGL_WARNING, NULL, + LOGFF_LEVEL_MIN); + if (ret < 0) + return ret; + filt1 = ret; + ret = log_add_filter_flags("console", NULL, LOGL_INFO, NULL, + LOGFF_DENY | LOGFF_LEVEL_MIN); + if (ret < 0) + return ret; + filt2 = ret; + log_run(UCLASS_SPI, "file"); + ret = log_remove_filter("console", filt1); + if (ret < 0) + return ret; + ret = log_remove_filter("console", filt2); + if (ret < 0) + return ret; + break; + } }
return 0; diff --git a/test/py/tests/test_log.py b/test/py/tests/test_log.py index fabf3001cb..f191c84c02 100644 --- a/test/py/tests/test_log.py +++ b/test/py/tests/test_log.py @@ -106,6 +106,10 @@ def test_log(u_boot_console): lines = run_test(13) check_log_entries(lines, 1, LOGL_INFO, LOGL_WARNING + 1)
+ def test14(): + lines = run_test(14) + check_log_entries(lines, 1, LOGL_INFO - 1, LOGL_WARNING) + # TODO(sjg@chromium.org): Consider structuring this as separate tests cons = u_boot_console test0() @@ -122,6 +126,7 @@ def test_log(u_boot_console): test11() test12() test13() + test14()
@pytest.mark.buildconfigspec('cmd_log') def test_log_format(u_boot_console):