From 67dd66cac92577e4442d8c2d5d7add55e42adf10 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Fri, 4 Jun 2021 10:47:03 +0200 Subject: test: self: run selftests as part of the pytest suite We don't want to enable self tests in the normal configs as they may, in future, bloat size needlessly. Enable it instead in the base.cfg fragment and add a test that verifies the selftest command runs without errors. Selftests can be run on startup for CONFIG_SHELL_NONE systems. This is not implemented here. For such systems the test will be skipped as CONFIG_CMD_SELFTEST won't be defined. To manually skip with emulate.pl, add --no-kconfig-base. Acked-by: Rouven Czerwinski Signed-off-by: Ahmad Fatoum Link: https://lore.barebox.org/20210604084704.17410-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer --- test/kconfig/base.cfg | 4 ++++ test/py/test_bselftests.py | 8 ++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/py/test_bselftests.py (limited to 'test') diff --git a/test/kconfig/base.cfg b/test/kconfig/base.cfg index e69de29bb2..6a9f683498 100644 --- a/test/kconfig/base.cfg +++ b/test/kconfig/base.cfg @@ -0,0 +1,4 @@ +CONFIG_TEST=y +CONFIG_SELFTEST=y +CONFIG_CMD_SELFTEST=y +CONFIG_SELFTEST_ENABLE_ALL=y diff --git a/test/py/test_bselftests.py b/test/py/test_bselftests.py new file mode 100644 index 0000000000..7417e74349 --- /dev/null +++ b/test/py/test_bselftests.py @@ -0,0 +1,8 @@ +import pytest +from .helper import * + +def test_bselftest(barebox, barebox_config): + skip_disabled(barebox_config, "CONFIG_CMD_SELFTEST") + + stdout, _, returncode = barebox.run('selftest', timeout=30) + assert returncode == 0, "selftest failed:\n{}\n".format("\n".join(stdout)) -- cgit v1.2.3