From b0465eb88f0406ba286df9ee056b9a62c8ab9c80 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 7 Aug 2025 11:08:14 +0300 Subject: test/py: Correctly restore the DT after capsule tests Some capsule tests are changing the sandbox DT to test various features, e.g authenticated capsule updates, versioning support etc. However, no one restores the original DT and the CI pops errors looking like /u-boot Bloblist at 100 not found (err=-2) Failed to find FDT file '/tmp/sandbox/persistent-data/scratch/EFI/CapsuleTestData/test_ver.dtb' initcall_run_f(): initcall fdtdec_setup() failed if sandbox is restarted. So let's restore the proper DT after done with the capsule testing. Signed-off-by: Ilias Apalodimas Reviewed-by: Tom Rini --- test/py/tests/test_efi_capsule/capsule_common.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test') diff --git a/test/py/tests/test_efi_capsule/capsule_common.py b/test/py/tests/test_efi_capsule/capsule_common.py index 04dabc176c4..8c66411929e 100644 --- a/test/py/tests/test_efi_capsule/capsule_common.py +++ b/test/py/tests/test_efi_capsule/capsule_common.py @@ -137,6 +137,8 @@ def do_reboot_dtb_specified(u_boot_config, ubman, dtb_filename): dtb_filename -- DTB file name. """ mnt_point = u_boot_config.persistent_data_dir + '/scratch' + old_dtb = ubman.config.dtb ubman.config.dtb = mnt_point + CAPSULE_DATA_DIR \ + f'/{dtb_filename}' ubman.restart_uboot() + ubman.config.dtb = old_dtb -- cgit v1.2.3 From 5096f81bda1cfac2a8a325e850442bf463be2f00 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 7 Aug 2025 11:08:15 +0300 Subject: test/py: Read from the correct offset when initializing capsules The current code writes values to a flash offset defined by a function argument. However, when reading it back we always read from a static offset. Adjust the reads to use the correct offset. Signed-off-by: Ilias Apalodimas Reviewed-by: Tom Rini --- test/py/tests/test_efi_capsule/capsule_common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/py/tests/test_efi_capsule/capsule_common.py b/test/py/tests/test_efi_capsule/capsule_common.py index 8c66411929e..8aaddfc19d6 100644 --- a/test/py/tests/test_efi_capsule/capsule_common.py +++ b/test/py/tests/test_efi_capsule/capsule_common.py @@ -42,7 +42,7 @@ def init_content(ubman, target, filename, expected): 'sf probe 0:0', f'fatload host 0:1 4000000 {CAPSULE_DATA_DIR}/{filename}', f'sf write 4000000 {target} 10', - 'sf read 5000000 100000 10', + f'sf read 5000000 {target} 10', 'md.b 5000000 10']) assert expected in ''.join(output) -- cgit v1.2.3 From fa2a2e20d0b4d7af92ee118d66f3245055cc9ba3 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 7 Aug 2025 11:08:16 +0300 Subject: test/py: Fix race conditions on EFI capsule tests efi_capsule_data() is called in each of the EFI tests to create and setup the files we need. However, it also recreates the spi.bin file that holds the SPI flash contents we rely on for the test validation. This leads to weird errors since reading from the flash returns 0, instead of the expected value if the file has been recreated. Always restart our sandbox instance if the files are recreated. Signed-off-by: Ilias Apalodimas --- test/py/tests/test_efi_capsule/conftest.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 961d2e0b3c1..45c06c42fd2 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -103,6 +103,7 @@ def efi_capsule_data(request, ubman): pytest.skip('Setup failed: %s' % exception.cmd) return else: + ubman.restart_uboot() yield image_path finally: call('rm -rf %s' % mnt_point, shell=True) -- cgit v1.2.3 From fc2686d2a87391dd1b165e44ffd525b61c93e521 Mon Sep 17 00:00:00 2001 From: Ilias Apalodimas Date: Thu, 7 Aug 2025 11:08:17 +0300 Subject: test/py: Fix capsule update tests Capsule updates tests have been skipped since commit 659f97eb1fc3 ("scripts/Makefile.lib: EFI: Use capsule CRT instead of ESL file") Remove that check since it's not needed anymore and re-enable the tests. Fixes: 659f97eb1fc3 ("scripts/Makefile.lib: EFI: Use capsule CRT instead of ESL file") Signed-off-by: Ilias Apalodimas --- test/py/tests/test_efi_capsule/conftest.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'test') diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 45c06c42fd2..ad0cda59ebf 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -44,8 +44,6 @@ def efi_capsule_data(request, ubman): % (key_dir, data_dir), shell=True) check_call('cp %s/capsule_pub_key_good.crt %s/SIGNER.crt' % (key_dir, data_dir), shell=True) - check_call('cp %s/capsule_pub_esl_good.esl %s/SIGNER.esl' - % (key_dir, data_dir), shell=True) check_call('cp %s/capsule_priv_key_bad.key %s/SIGNER2.key' % (key_dir, data_dir), shell=True) -- cgit v1.2.3