From aa6e94deabb45154cea07ad44c4a5c047bca078b Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Wed, 16 Nov 2022 13:10:37 -0500 Subject: global: Move remaining CONFIG_SYS_SDRAM_* to CFG_SYS_SDRAM_* The rest of the unmigrated CONFIG symbols in the CONFIG_SYS_SDRAM namespace do not easily transition to Kconfig. In many cases they likely should come from the device tree instead. Move these out of CONFIG namespace and in to CFG namespace. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- test/dm/remoteproc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c index 1cc07bc808..b5e9f9ddc9 100644 --- a/test/dm/remoteproc.c +++ b/test/dm/remoteproc.c @@ -208,7 +208,7 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts) * at SDRAM_BASE *device* address (p_paddr field). * Its size is defined by the p_filesz field. */ - phdr->p_paddr = CONFIG_SYS_SDRAM_BASE; + phdr->p_paddr = CFG_SYS_SDRAM_BASE; loaded_firmware_size = phdr->p_filesz; /* @@ -231,7 +231,7 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts) unmap_physmem(loaded_firmware, MAP_NOCACHE); /* Resource table */ - shdr->sh_addr = CONFIG_SYS_SDRAM_BASE; + shdr->sh_addr = CFG_SYS_SDRAM_BASE; rsc_table_size = shdr->sh_size; loaded_rsc_table_paddr = shdr->sh_addr + DEVICE_TO_PHYSICAL_OFFSET; @@ -243,7 +243,7 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts) /* Load and verify */ ut_assertok(rproc_elf32_load_rsc_table(dev, (ulong)valid_elf32, size, &rsc_addr, &rsc_size)); - ut_asserteq(rsc_addr, CONFIG_SYS_SDRAM_BASE); + ut_asserteq(rsc_addr, CFG_SYS_SDRAM_BASE); ut_asserteq(rsc_size, rsc_table_size); ut_asserteq_mem(loaded_firmware, valid_elf32 + shdr->sh_offset, shdr->sh_size); -- cgit v1.2.3 From 9cebc4ad8ebe6832c6d0eca786a85533a3b54ce4 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sat, 19 Nov 2022 18:45:44 -0500 Subject: post: Migrate to Kconfig We move the existing CONFIG_POST_* functionality over to CFG_POST and then introduce CONFIG_POST to Kconfig. Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- test/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/Kconfig b/test/Kconfig index a6b463e4d0..9f4641ae6b 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -1,3 +1,8 @@ +config POST + bool "Power On Self Test support" + help + See doc/README.POST for more details + menuconfig UNIT_TEST bool "Unit tests" help -- cgit v1.2.3 From 583f124aac205b354b3b73ebb62c79e8cc41e6d5 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 22 Nov 2022 12:31:55 -0500 Subject: event: Re-add file paths to the tests Now that we are enforcing dwarf-4 to be used we will have the full file paths present. Cc: Simon Glass Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- test/py/tests/test_event_dump.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_event_dump.py b/test/py/tests/test_event_dump.py index 1a46ca30f4..da196df4c3 100644 --- a/test/py/tests/test_event_dump.py +++ b/test/py/tests/test_event_dump.py @@ -16,7 +16,7 @@ def test_event_dump(u_boot_console): out = util.run_and_log(cons, ['scripts/event_dump.py', sandbox]) expect = '''.*Event type Id Source location -------------------- ------------------------------ ------------------------------ -EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*vbe_request.c:.* -EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*vbe_simple_os.c:.* -EVT_MISC_INIT_F sandbox_misc_init_f .*start.c:''' +EVT_FT_FIXUP bootmeth_vbe_ft_fixup .*boot/vbe_request.c:.* +EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup .*boot/vbe_simple_os.c:.* +EVT_MISC_INIT_F sandbox_misc_init_f .*arch/sandbox/cpu/start.c:''' assert re.match(expect, out, re.MULTILINE) is not None -- cgit v1.2.3 From d5c4b8b0631a1da03e67fdeb1b5bf4a637a33c20 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 4 Dec 2022 10:03:33 -0500 Subject: log: Remove some places where we redefine LOGLEVEL We cannot redefine a CONFIG value per file in this manner. Signed-off-by: Tom Rini --- test/log/pr_cont_test.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'test') diff --git a/test/log/pr_cont_test.c b/test/log/pr_cont_test.c index 6abddf7a11..df4520d280 100644 --- a/test/log/pr_cont_test.c +++ b/test/log/pr_cont_test.c @@ -16,9 +16,6 @@ #define BUFFSIZE 64 -#undef CONFIG_LOGLEVEL -#define CONFIG_LOGLEVEL 4 - DECLARE_GLOBAL_DATA_PTR; static int log_test_pr_cont(struct unit_test_state *uts) -- cgit v1.2.3 From 895999261ca02882813d477f28ba06c8060d9c43 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 12 Dec 2022 14:12:08 -0500 Subject: test: Add test for source command This adds a basic test for FIT image handling by the source command. It's a python test becase we need to run mkimage. Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- test/py/tests/source.its | 43 +++++++++++++++++++++++++++++++++++++++++++ test/py/tests/test_source.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test/py/tests/source.its create mode 100644 test/py/tests/test_source.py (limited to 'test') diff --git a/test/py/tests/source.its b/test/py/tests/source.its new file mode 100644 index 0000000000..3c62f777f1 --- /dev/null +++ b/test/py/tests/source.its @@ -0,0 +1,43 @@ +/dts-v1/; + +/ { + description = "FIT image to test the source command"; + #address-cells = <1>; + + images { + default = "script-1"; + + script-1 { + data = "echo 1"; + type = "script"; + arch = "sandbox"; + compression = "none"; + }; + + script-2 { + data = "echo 2"; + type = "script"; + arch = "sandbox"; + compression = "none"; + }; + + not-a-script { + data = "echo 3"; + type = "kernel"; + arch = "sandbox"; + compression = "none"; + }; + }; + + configurations { + default = "conf-2"; + + conf-1 { + script = "script-1"; + }; + + conf-2 { + script = "script-2"; + }; + }; +}; diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py new file mode 100644 index 0000000000..e5ffdfe3fc --- /dev/null +++ b/test/py/tests/test_source.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (C) 2022 Sean Anderson + +import os +import pytest +import u_boot_utils as util + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_echo') +@pytest.mark.buildconfigspec('cmd_source') +@pytest.mark.buildconfigspec('fit') +def test_source(u_boot_console): + # Compile our test script image + cons = u_boot_console + mkimage = os.path.join(cons.config.build_dir, 'tools/mkimage') + its = os.path.join(cons.config.source_dir, 'test/py/tests/source.its') + fit = os.path.join(cons.config.build_dir, 'source.itb') + util.run_and_log(cons, (mkimage, '-f', its, fit)) + cons.run_command(f'host load hostfs - $loadaddr {fit}') + + assert '1' in cons.run_command('source') + assert '1' in cons.run_command('source :script-1') + assert '2' in cons.run_command('source :script-2') + assert 'Fail' in cons.run_command('source :not-a-script || echo Fail') + + cons.run_command('fdt addr $loadaddr') + cons.run_command('fdt rm /images default') + assert 'Fail' in cons.run_command('source || echo Fail') -- cgit v1.2.3 From bcc85b96b5ffbbce19a89747138feb873d918915 Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Mon, 12 Dec 2022 14:12:11 -0500 Subject: cmd: source: Support specifying config name As discussed previously [1,2], the source command is not safe to use with verified boot unless there is a key with required = "images" (which has its own problems). This is because if such a key is absent, signatures are verified but not required. It is assumed that configuration nodes will provide the signature. Because the source command does not use configurations to determine the image to source, effectively no verification takes place. To address this, allow specifying configuration nodes. We use the same syntax as the bootm command (helpfully provided for us by fit_parse_conf). By default, we first try the default config and then the default image. To force using a config, # must be present in the command (e.g. `source $loadaddr#my-conf`). For convenience, the config may be omitted, just like the address may be (e.g. `source \#`). This also works for images (`source :` behaves exactly like `source` currently does). [1] https://lore.kernel.org/u-boot/7d711133-d513-5bcb-52f2-a9dbaa9eeded@prevas.dk/ [2] https://lore.kernel.org/u-boot/042dcb34-f85f-351e-1b0e-513f89005fdd@gmail.com/ Signed-off-by: Sean Anderson Reviewed-by: Simon Glass --- test/py/tests/test_source.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/py/tests/test_source.py b/test/py/tests/test_source.py index e5ffdfe3fc..bbc311df6d 100644 --- a/test/py/tests/test_source.py +++ b/test/py/tests/test_source.py @@ -18,11 +18,20 @@ def test_source(u_boot_console): util.run_and_log(cons, (mkimage, '-f', its, fit)) cons.run_command(f'host load hostfs - $loadaddr {fit}') - assert '1' in cons.run_command('source') + assert '2' in cons.run_command('source') + assert '1' in cons.run_command('source :') assert '1' in cons.run_command('source :script-1') assert '2' in cons.run_command('source :script-2') assert 'Fail' in cons.run_command('source :not-a-script || echo Fail') + assert '2' in cons.run_command('source \\#') + assert '1' in cons.run_command('source \\#conf-1') + assert '2' in cons.run_command('source \\#conf-2') cons.run_command('fdt addr $loadaddr') + cons.run_command('fdt rm /configurations default') + assert '1' in cons.run_command('source') + assert 'Fail' in cons.run_command('source \\# || echo Fail') + cons.run_command('fdt rm /images default') assert 'Fail' in cons.run_command('source || echo Fail') + assert 'Fail' in cons.run_command('source \\# || echo Fail') -- cgit v1.2.3 From 7943ae241c099edc6d0cd7c4dd3c5ee18ecb24f7 Mon Sep 17 00:00:00 2001 From: Yuepeng Xing Date: Fri, 2 Dec 2022 14:23:07 +0800 Subject: test:dm:fix typo Fix typos in the 'test/dm' directory. Signed-off-by: Yuepeng Xing Reviewed-by: Simon Glass --- test/dm/blk.c | 2 +- test/dm/button.c | 4 ++-- test/dm/gpio.c | 4 ++-- test/dm/host.c | 2 +- test/dm/remoteproc.c | 2 +- test/dm/scmi.c | 2 +- test/dm/spmi.c | 2 +- test/dm/test-fdt.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/dm/blk.c b/test/dm/blk.c index 612f3ffb32..0aa04c64ef 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -127,7 +127,7 @@ static int dm_test_blk_devnum(struct unit_test_state *uts) /* * Probe the devices, with the first one being probed last. This is the - * one with no alias / sequence numnber. + * one with no alias / sequence number. */ ut_assertok(uclass_get_device(UCLASS_MMC, 1, &dev)); ut_assertok(uclass_get_device(UCLASS_MMC, 2, &dev)); diff --git a/test/dm/button.c b/test/dm/button.c index f8a7fab61d..e76c1ad030 100644 --- a/test/dm/button.c +++ b/test/dm/button.c @@ -46,7 +46,7 @@ static int dm_test_button_gpio(struct unit_test_state *uts) struct udevice *dev, *gpio; /* - * Check that we can manipulate an BUTTON. BUTTON 1 is connected to GPIO + * Check that we can manipulate a BUTTON. BUTTON 1 is connected to GPIO * bank gpio_a, offset 3. */ ut_assertok(uclass_get_device(UCLASS_BUTTON, 1, &dev)); @@ -64,7 +64,7 @@ static int dm_test_button_gpio(struct unit_test_state *uts) } DM_TEST(dm_test_button_gpio, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -/* Test obtaining an BUTTON by label */ +/* Test obtaining a BUTTON by label */ static int dm_test_button_label(struct unit_test_state *uts) { struct udevice *dev, *cmp; diff --git a/test/dm/gpio.c b/test/dm/gpio.c index a8c35d4370..0d88ec24bd 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -348,7 +348,7 @@ static int dm_test_gpio_phandles(struct unit_test_state *uts) ut_asserteq(-ENOENT, gpio_request_by_name(dev, "test-gpios", 5, &desc, 0)); - /* Last GPIO is ignord as it comes after <0> */ + /* Last GPIO is ignored as it comes after <0> */ ut_asserteq(3, gpio_request_list_by_name(dev, "test-gpios", desc_list, ARRAY_SIZE(desc_list), 0)); ut_asserteq(-EBUSY, gpio_request_list_by_name(dev, "test-gpios", @@ -377,7 +377,7 @@ static int dm_test_gpio_phandles(struct unit_test_state *uts) ut_asserteq(6, gpio_request_list_by_name(dev, "test2-gpios", desc_list, ARRAY_SIZE(desc_list), 0)); - /* This was set to output previously but flags resetted to 0 = INPUT */ + /* This was set to output previously but flags reset to 0 = INPUT */ ut_asserteq(0, sandbox_gpio_get_flags(gpio_a, 1)); ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_a, 1, NULL)); diff --git a/test/dm/host.c b/test/dm/host.c index 4dafc24abb..355ba7770a 100644 --- a/test/dm/host.c +++ b/test/dm/host.c @@ -132,7 +132,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts) ut_assertok(run_commandf("host bind fat %s", filename2)); - /* Check it is not removeable (no '-r') */ + /* Check it is not removable (no '-r') */ ut_assertok(uclass_next_device_err(&dev)); ut_assertok(blk_get_from_parent(dev, &blk)); desc = dev_get_uclass_plat(blk); diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c index b5e9f9ddc9..7a8ff47fa1 100644 --- a/test/dm/remoteproc.c +++ b/test/dm/remoteproc.c @@ -139,7 +139,7 @@ static int dm_test_remoteproc_elf(struct unit_test_state *uts) 0x20, 0x00, 0x00, 0x00, /* memsz = filesz */ 0x20, 0x00, 0x00, 0x00, - /* flags : readable and exectuable */ + /* flags : readable and executable */ 0x05, 0x00, 0x00, 0x00, /* padding */ 0x00, 0x00, 0x00, 0x00, diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 795f207304..93c7d08f43 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -6,7 +6,7 @@ * uclass devices probe when a SCMI server exposes resources. * * Note in test.dts the protocol@10 node in scmi node. Protocol 0x10 is not - * implemented in U-Boot SCMI components but the implementation is exepected + * implemented in U-Boot SCMI components but the implementation is expected * to not complain on unknown protocol IDs, as long as it is not used. Note * in test.dts tests that SCMI drivers probing does not fail for such an * unknown SCMI protocol ID. diff --git a/test/dm/spmi.c b/test/dm/spmi.c index 114fd2d22e..9cc284b98c 100644 --- a/test/dm/spmi.c +++ b/test/dm/spmi.c @@ -17,7 +17,7 @@ #include #include -/* Test if bus childs got probed propperly*/ +/* Test if bus children got probed properly*/ static int dm_test_spmi_probe(struct unit_test_state *uts) { const char *name = "spmi@0"; diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 8bb868b678..7cd2d04612 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -592,7 +592,7 @@ static int dm_test_fdt_translation(struct unit_test_state *uts) ut_asserteq_str("dev@2,200", dev->name); ut_asserteq(0xA000, dev_read_addr(dev)); - /* No translation for busses with #size-cells == 0 */ + /* No translation for buses with #size-cells == 0 */ ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 3, &dev)); ut_asserteq_str("dev@42", dev->name); ut_asserteq(0x42, dev_read_addr(dev)); -- cgit v1.2.3