Skip to content

Commit

Permalink
fix test_jetson_cboot
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed May 13, 2024
1 parent 86d36ae commit 276bfdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions otaclient/app/boot_control/_jetson_uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,13 @@ def __init__(self):
logger.info(f"{bsp_version=}")

# ------ sanity check, currently jetson-uefi only supports >= R35.2 ----- #
# only after R35.2, the Capsule Firmware update is available.
if not bsp_version >= (35, 2, 0):
_err_msg = f"jetson-uefi only supports BSP version >= R35.2, but get {bsp_version=}. "
logger.error(_err_msg)
raise JetsonUEFIBootControlError(_err_msg)

# NOTE: unified A/B is enabled by default and cannot be disabled after BSP R34.
# unified A/B is enabled by default and cannot be disabled after BSP R34.
logger.info("unified A/B is enabled")

# ------ check A/B slots ------ #
Expand All @@ -252,6 +253,7 @@ def __init__(self):
CMDHelperFuncs.get_parent_dev(current_rootfs_devpath).strip()
)

# --- detect boot device --- #
self._external_rootfs = False
parent_devname = parent_devpath.name
if parent_devname.startswith(boot_cfg.MMCBLK_DEV_PREFIX):
Expand All @@ -270,7 +272,7 @@ def __init__(self):
f"/dev/{parent_devname}p{self._slot_id_partid[standby_slot]}"
)
self.standby_rootfs_dev_partuuid = CMDHelperFuncs.get_attrs_by_dev(
"PARTUUID", f"{self.standby_rootfs_devpath}"
"PARTUUID", self.standby_rootfs_devpath
).strip()
current_rootfs_dev_partuuid = CMDHelperFuncs.get_attrs_by_dev(
"PARTUUID", current_rootfs_devpath
Expand All @@ -282,7 +284,6 @@ def __init__(self):
f"standby_rootfs(slot {standby_slot}): {self.standby_rootfs_devpath=}, {self.standby_rootfs_dev_partuuid=}"
)

# internal emmc partition
self.standby_internal_emmc_devpath = f"/dev/{boot_cfg.INTERNAL_EMMC_DEVNAME}p{self._slot_id_partid[standby_slot]}"

logger.info("finished jetson-uefi boot control startup")
Expand Down Expand Up @@ -323,6 +324,7 @@ def __init__(self) -> None:
active_slot_dev=self._uefi_control.curent_rootfs_devpath,
active_slot_mount_point=cfg.ACTIVE_ROOT_MOUNT_POINT,
)

current_ota_status_dir = Path(boot_cfg.OTA_STATUS_DIR)
standby_ota_status_dir = self._mp_control.standby_slot_mount_point / Path(
boot_cfg.OTA_STATUS_DIR
Expand All @@ -332,6 +334,8 @@ def __init__(self) -> None:
self._firmware_ver_control = FirmwareBSPVersionControl(
current_firmware_bsp_vf=current_ota_status_dir
/ boot_cfg.FIRMWARE_BSP_VERSION_FNAME,
# NOTE: standby slot's bsp version file might be not yet
# available before an OTA.
standby_firmware_bsp_vf=standby_ota_status_dir
/ boot_cfg.FIRMWARE_BSP_VERSION_FNAME,
)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_boot_control/test_jetson_cboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
FirmwareBSPVersion,
SlotID,
parse_bsp_version,
update_extlinux_cfg,
)

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -140,4 +141,4 @@ def test_parse_bsp_version(_in: str, expected: BSPVersion):
def test_update_extlinux_conf(_template_f: Path, _updated_f: Path, partuuid: str):
_in = (TEST_DIR / _template_f).read_text()
_expected = (TEST_DIR / _updated_f).read_text()
assert _CBootControl.update_extlinux_cfg(_in, partuuid) == _expected
assert update_extlinux_cfg(_in, partuuid) == _expected

0 comments on commit 276bfdc

Please sign in to comment.