summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2021-06-04 10:47:03 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-06-09 12:20:05 +0200
commit67dd66cac92577e4442d8c2d5d7add55e42adf10 (patch)
tree1b87fc548839d7541b4a457b8395fba100698b19 /test
parent7271ce78d0fccd530a9b67d52f2248a9e6fd9f2f (diff)
downloadbarebox-67dd66cac92577e4442d8c2d5d7add55e42adf10.tar.gz
barebox-67dd66cac92577e4442d8c2d5d7add55e42adf10.tar.xz
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 <r.czerwinski@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210604084704.17410-13-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'test')
-rw-r--r--test/kconfig/base.cfg4
-rw-r--r--test/py/test_bselftests.py8
2 files changed, 12 insertions, 0 deletions
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))