-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'efi-2023-07-rc1-2' of https://source.denx.de/u-boot/custod…
…ians/u-boot-efi Pull request for efi-2023-07-rc1-2 Documentation: * Describe Python coding style UEFI: * Enable tests for authenticated capsules on the sandbox * Fix pylint warnings * Correct struct efi_hii_keyboard_layout definition
- Loading branch information
Showing
10 changed files
with
78 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,30 +2,21 @@ | |
# Copyright (c) 2020, Linaro Limited | ||
# Author: AKASHI Takahiro <[email protected]> | ||
|
||
import os | ||
import os.path | ||
import re | ||
from subprocess import call, check_call, check_output, CalledProcessError | ||
import pytest | ||
from capsule_defs import * | ||
"""Fixture for UEFI capsule test | ||
""" | ||
|
||
# | ||
# Fixture for UEFI capsule test | ||
# | ||
from subprocess import call, check_call, CalledProcessError | ||
import pytest | ||
from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR, EFITOOLS_PATH | ||
|
||
@pytest.fixture(scope='session') | ||
def efi_capsule_data(request, u_boot_config): | ||
"""Set up a file system to be used in UEFI capsule and | ||
authentication test. | ||
Args: | ||
request: Pytest request object. | ||
u_boot_config: U-boot configuration. | ||
"""Set up a file system to be used in UEFI capsule and authentication test | ||
and return a ath to disk image to be used for testing | ||
Return: | ||
A path to disk image to be used for testing | ||
request -- Pytest request object. | ||
u_boot_config -- U-boot configuration. | ||
""" | ||
global CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR | ||
|
||
mnt_point = u_boot_config.persistent_data_dir + '/test_efi_capsule' | ||
data_dir = mnt_point + CAPSULE_DATA_DIR | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
# Copyright (c) 2020, Linaro Limited | ||
# Author: AKASHI Takahiro <[email protected]> | ||
# | ||
# U-Boot UEFI: Firmware Update Test | ||
|
||
""" | ||
"""U-Boot UEFI: Firmware Update Test | ||
This test verifies capsule-on-disk firmware update for FIT images | ||
""" | ||
|
||
from subprocess import check_call, check_output, CalledProcessError | ||
import pytest | ||
from capsule_defs import * | ||
from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR | ||
|
||
|
||
@pytest.mark.boardspec('sandbox_flattree') | ||
|
@@ -24,15 +21,18 @@ | |
@pytest.mark.buildconfigspec('cmd_nvedit_efi') | ||
@pytest.mark.buildconfigspec('cmd_sf') | ||
@pytest.mark.slow | ||
class TestEfiCapsuleFirmwareFit(object): | ||
class TestEfiCapsuleFirmwareFit(): | ||
"""Test capsule-on-disk firmware update for FIT images | ||
""" | ||
|
||
def test_efi_capsule_fw1( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 1 - Update U-Boot and U-Boot environment on SPI Flash | ||
but with an incorrect GUID value in the capsule | ||
No update should happen | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
0x150000-0x200000: U-Boot environment (but dummy) | ||
"""Test Case 1 | ||
Update U-Boot and U-Boot environment on SPI Flash | ||
but with an incorrect GUID value in the capsule | ||
No update should happen | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
0x150000-0x200000: U-Boot environment (but dummy) | ||
""" | ||
# other tests might have run and the | ||
# system might not be in a clean state. | ||
|
@@ -74,8 +74,6 @@ def test_efi_capsule_fw1( | |
|
||
capsule_early = u_boot_config.buildconfig.get( | ||
'config_efi_capsule_on_disk_early') | ||
capsule_auth = u_boot_config.buildconfig.get( | ||
'config_efi_capsule_authenticate') | ||
|
||
# reboot | ||
u_boot_console.restart_uboot(expect_reset = capsule_early) | ||
|
@@ -107,11 +105,12 @@ def test_efi_capsule_fw1( | |
|
||
def test_efi_capsule_fw2( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
"""Test Case 2 | ||
Update U-Boot and U-Boot environment on SPI Flash | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
0x150000-0x200000: U-Boot environment (but dummy) | ||
""" | ||
Test Case 2 - Update U-Boot and U-Boot environment on SPI Flash | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
0x150000-0x200000: U-Boot environment (but dummy) | ||
""" | ||
|
||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 2-a, before reboot'): | ||
output = u_boot_console.run_command_list([ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,8 @@ | |
# Copyright (c) 2022, Arm Limited | ||
# Author: AKASHI Takahiro <[email protected]>, | ||
# adapted to FIT images by Vincent Stehlé <[email protected]> | ||
# | ||
# U-Boot UEFI: Firmware Update (Signed capsule with FIT images) Test | ||
|
||
""" | ||
"""U-Boot UEFI: Firmware Update (Signed capsule with FIT images) Test | ||
This test verifies capsule-on-disk firmware update | ||
with signed capsule files containing FIT images | ||
""" | ||
|
@@ -25,15 +23,18 @@ | |
@pytest.mark.buildconfigspec('cmd_nvedit_efi') | ||
@pytest.mark.buildconfigspec('cmd_sf') | ||
@pytest.mark.slow | ||
class TestEfiCapsuleFirmwareSignedFit(object): | ||
class TestEfiCapsuleFirmwareSignedFit(): | ||
"""Capsule-on-disk firmware update test | ||
""" | ||
|
||
def test_efi_capsule_auth1( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 1 - Update U-Boot on SPI Flash, FIT image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 1 | ||
Update U-Boot on SPI Flash, FIT image format | ||
x150000: U-Boot binary (but dummy) | ||
If the capsule is properly signed, the authentication | ||
should pass and the firmware be updated. | ||
If the capsule is properly signed, the authentication | ||
should pass and the firmware be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 1-a, before reboot'): | ||
|
@@ -103,13 +104,13 @@ def test_efi_capsule_auth1( | |
|
||
def test_efi_capsule_auth2( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 2 - Update U-Boot on SPI Flash, FIT image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 2 | ||
Update U-Boot on SPI Flash, FIT image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
If the capsule is signed but with an invalid key, | ||
the authentication should fail and the firmware | ||
not be updated. | ||
If the capsule is signed but with an invalid key, | ||
the authentication should fail and the firmware | ||
not be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 2-a, before reboot'): | ||
|
@@ -182,12 +183,12 @@ def test_efi_capsule_auth2( | |
|
||
def test_efi_capsule_auth3( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 3 - Update U-Boot on SPI Flash, FIT image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 3 | ||
Update U-Boot on SPI Flash, FIT image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
If the capsule is not signed, the authentication | ||
should fail and the firmware not be updated. | ||
If the capsule is not signed, the authentication | ||
should fail and the firmware not be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 3-a, before reboot'): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
# SPDX-License-Identifier: GPL-2.0+ | ||
# Copyright (c) 2021, Linaro Limited | ||
# Author: AKASHI Takahiro <[email protected]> | ||
# | ||
# U-Boot UEFI: Firmware Update (Signed capsule with raw images) Test | ||
|
||
""" | ||
"""U-Boot UEFI: Firmware Update (Signed capsule with raw images) Test | ||
This test verifies capsule-on-disk firmware update | ||
with signed capsule files containing raw images | ||
""" | ||
|
@@ -23,15 +21,17 @@ | |
@pytest.mark.buildconfigspec('cmd_nvedit_efi') | ||
@pytest.mark.buildconfigspec('cmd_sf') | ||
@pytest.mark.slow | ||
class TestEfiCapsuleFirmwareSignedRaw(object): | ||
class TestEfiCapsuleFirmwareSignedRaw(): | ||
"""Firmware Update (Signed capsule with raw images) Test | ||
""" | ||
|
||
def test_efi_capsule_auth1( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 1 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 1 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
If the capsule is properly signed, the authentication | ||
should pass and the firmware be updated. | ||
If the capsule is properly signed, the authentication | ||
should pass and the firmware be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 1-a, before reboot'): | ||
|
@@ -100,13 +100,12 @@ def test_efi_capsule_auth1( | |
|
||
def test_efi_capsule_auth2( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 2 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 2 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
If the capsule is signed but with an invalid key, | ||
the authentication should fail and the firmware | ||
not be updated. | ||
If the capsule is signed but with an invalid key, | ||
the authentication should fail and the firmware | ||
not be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 2-a, before reboot'): | ||
|
@@ -179,12 +178,11 @@ def test_efi_capsule_auth2( | |
|
||
def test_efi_capsule_auth3( | ||
self, u_boot_config, u_boot_console, efi_capsule_data): | ||
""" | ||
Test Case 3 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
"""Test Case 3 - Update U-Boot on SPI Flash, raw image format | ||
0x100000-0x150000: U-Boot binary (but dummy) | ||
If the capsule is not signed, the authentication | ||
should fail and the firmware not be updated. | ||
If the capsule is not signed, the authentication | ||
should fail and the firmware not be updated. | ||
""" | ||
disk_img = efi_capsule_data | ||
with u_boot_console.log.section('Test Case 3-a, before reboot'): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters