From e6b8e948abda64c52bb6535d8670121f7e2953ce Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 19 Jan 2021 14:40:10 -0500 Subject: test: test_ofplatdata: Mark as sandbox specific This test checks for output specific to the sandbox device tree, mark it as sandbox specific. Signed-off-by: Tom Rini --- test/py/tests/test_ofplatdata.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/py/tests/test_ofplatdata.py b/test/py/tests/test_ofplatdata.py index d55338e37e6..92d09b7aa19 100644 --- a/test/py/tests/test_ofplatdata.py +++ b/test/py/tests/test_ofplatdata.py @@ -4,6 +4,7 @@ import pytest import u_boot_utils as util +@pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec('spl_of_platdata') def test_spl_devicetree(u_boot_console): """Test content of spl device-tree""" -- cgit v1.2.3 From 34d7f72a1db0226d083a131b565ed294eeae9c48 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Wed, 27 Jan 2021 12:09:46 +0100 Subject: test: pr_cont_test.o depends on CONFIG_LOG=y MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Compiling wandboard_defconfig with CONFIG_UT_LOG=y leads to a build error: test/log/pr_cont_test.c: In function ‘log_test_pr_cont’: test/log/pr_cont_test.c:28:14: error: ‘gd_t’ {aka ‘volatile struct global_data’} has no member named ‘log_fmt’  log_fmt = gd->log_fmt; We do not want to let CONFIG_UT_LOG depend on CONFIG_LOG=y because we have tests for logging functions called with CONFIG_LOG=n. Fix the build dependency. Reported-by: Kever Yang Signed-off-by: Heinrich Schuchardt --- test/log/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/log/Makefile b/test/log/Makefile index afdafa502ac..3f09deb644b 100644 --- a/test/log/Makefile +++ b/test/log/Makefile @@ -8,7 +8,6 @@ obj-$(CONFIG_CMD_LOG) += log_filter.o ifdef CONFIG_UT_LOG obj-y += test-main.o -obj-y += pr_cont_test.o ifdef CONFIG_SANDBOX obj-$(CONFIG_LOG_SYSLOG) += syslog_test.o @@ -16,6 +15,7 @@ obj-$(CONFIG_LOG_SYSLOG) += syslog_test_ndebug.o endif ifdef CONFIG_LOG +obj-y += pr_cont_test.o obj-$(CONFIG_CONSOLE_RECORD) += cont_test.o else obj-$(CONFIG_CONSOLE_RECORD) += nolog_test.o -- cgit v1.2.3 From 89d52afa5d0b643bddbedd840cea98ea7cba84f9 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Thu, 28 Jan 2021 12:46:11 +0100 Subject: test: correct entry point to pytest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With Pytest 6.0.2 'make tests' fails: sandbox: Traceback (most recent call last): File "./test/py/test.py", line 20, in sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args)) TypeError: console_main() takes 0 positional arguments but 1 was given The definition of console_scripts has changed as follows: Pytest 4.6.1: [options.entry_points] console_scripts =         pytest=pytest:main         py.test=pytest:main          Pytest 6.0.2:          [options.entry_points] console_scripts = pytest=pytest:console_main py.test=pytest:console_main The new function console_main() has a comment: "This function is not meant for programmable use; use `main()`" Hence let's call pytest.main() directly. Move args processing into the __main__ paragraph. Signed-off-by: Heinrich Schuchardt Tested-by: Andy Shevchenko Tested-by: Tom Rini --- test/py/test.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/py/test.py b/test/py/test.py index bee88d96bc2..285fda54258 100755 --- a/test/py/test.py +++ b/test/py/test.py @@ -10,11 +10,11 @@ import os import os.path import sys +import pytest from pkg_resources import load_entry_point -# argv; py.test test_directory_name user-supplied-arguments -args = [os.path.dirname(__file__) + '/tests'] -args.extend(sys.argv) - if __name__ == '__main__': - sys.exit(load_entry_point('pytest', 'console_scripts', 'pytest')(args)) + # argv; py.test test_directory_name user-supplied-arguments + args = [os.path.dirname(__file__) + '/tests'] + args.extend(sys.argv) + sys.exit(pytest.main(args)) -- cgit v1.2.3 From a59e59c9be844553384b67c36a8040f65ec10011 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 28 Jan 2021 14:39:56 -0500 Subject: test: Update test_fs to not use deprecated pytest.yield_fixture() As noted in comments, yield_fixture has been deprecated for longer than our minimum required version of pytest. Newer versions of pytest cause this to be a louder warning, and as the migration is trivial, perform it now. Signed-off-by: Tom Rini --- test/py/tests/test_fs/conftest.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py index 58e8cd46ee2..ec70e8c4ef3 100644 --- a/test/py/tests/test_fs/conftest.py +++ b/test/py/tests/test_fs/conftest.py @@ -243,8 +243,7 @@ def umount_fs(mount_point): # Fixture for basic fs test # derived from test/fs/fs-test.sh # -# NOTE: yield_fixture was deprecated since pytest-3.0 -@pytest.yield_fixture() +@pytest.fixture() def fs_obj_basic(request, u_boot_config): """Set up a file system to be used in basic fs test. @@ -352,8 +351,7 @@ def fs_obj_basic(request, u_boot_config): # # Fixture for extended fs test # -# NOTE: yield_fixture was deprecated since pytest-3.0 -@pytest.yield_fixture() +@pytest.fixture() def fs_obj_ext(request, u_boot_config): """Set up a file system to be used in extended fs test. @@ -439,8 +437,7 @@ def fs_obj_ext(request, u_boot_config): # # Fixture for mkdir test # -# NOTE: yield_fixture was deprecated since pytest-3.0 -@pytest.yield_fixture() +@pytest.fixture() def fs_obj_mkdir(request, u_boot_config): """Set up a file system to be used in mkdir test. @@ -472,8 +469,7 @@ def fs_obj_mkdir(request, u_boot_config): # # Fixture for unlink test # -# NOTE: yield_fixture was deprecated since pytest-3.0 -@pytest.yield_fixture() +@pytest.fixture() def fs_obj_unlink(request, u_boot_config): """Set up a file system to be used in unlink test. @@ -538,8 +534,7 @@ def fs_obj_unlink(request, u_boot_config): # # Fixture for symlink fs test # -# NOTE: yield_fixture was deprecated since pytest-3.0 -@pytest.yield_fixture() +@pytest.fixture() def fs_obj_symlink(request, u_boot_config): """Set up a file system to be used in symlink fs test. -- cgit v1.2.3 From fe158657a5bf6d657539b0fb8875175662f34a60 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 18 Jan 2021 00:17:33 +0100 Subject: test: inconsistent bootm tests Excluding ut bootm in test/cmd_ut.c but compiling test/bootm.c results in failure of the Python test invoking the C unit tests as observed on sipeed_riscv_smode_defconfig: FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nop] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_nospace] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_silent_var] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_both] FAILED test/py/tests/test_ut.py::test_ut[ut_bootm_subst_var] Only compile test/bootm.c on the sandbox. Fixes: f158ba15ee0f ("bootm: Add tests for fixup_silent_linux()") Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 3c7bc8b549f..932e5173831 100644 --- a/test/Makefile +++ b/test/Makefile @@ -4,8 +4,8 @@ ifneq ($(CONFIG_$(SPL_)BLOBLIST),) obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o -endif obj-$(CONFIG_$(SPL_)CMDLINE) += bootm.o +endif obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o -- cgit v1.2.3 From 9d43b4106e23a241b398544a6d2aa5bb541e62cb Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 18 Jan 2021 00:17:34 +0100 Subject: test: inconsistent string tests Excluding ut str in test/cmd_ut.c but compiling test/str_ut.c results in failure of the Python test invoking the C unit tests as observed on sipeed_riscv_smode_defconfig: FAILED test/py/tests/test_ut.py::test_ut[ut_str_upper] Allow to compile test/str_ut.c on all boards. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/cmd_ut.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'test') diff --git a/test/cmd_ut.c b/test/cmd_ut.c index fad1c899a4e..90674d5de5d 100644 --- a/test/cmd_ut.c +++ b/test/cmd_ut.c @@ -89,9 +89,8 @@ static struct cmd_tbl cmd_ut_sub[] = { U_BOOT_CMD_MKENT(bloblist, CONFIG_SYS_MAXARGS, 1, do_ut_bloblist, "", ""), U_BOOT_CMD_MKENT(bootm, CONFIG_SYS_MAXARGS, 1, do_ut_bootm, "", ""), - U_BOOT_CMD_MKENT(str, CONFIG_SYS_MAXARGS, 1, do_ut_str, - "", ""), #endif + U_BOOT_CMD_MKENT(str, CONFIG_SYS_MAXARGS, 1, do_ut_str, "", ""), }; static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc, -- cgit v1.2.3