Skip to content

Commit

Permalink
update test_rpi_boot accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Jun 19, 2024
1 parent 41e80fc commit 0ba07f3
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions tests/test_otaclient/test_boot_control/test_rpi_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class TestRPIBootControl:

@pytest.fixture
def rpi_boot_ab_slot(self, tmp_path: Path, ab_slots: SlotMeta):
self.model_file = tmp_path / "model"
self.model_file.write_text(rpi_boot_cfg.RPI_MODEL_HINT)

self.slot_a_mp = Path(ab_slots.slot_a)
self.slot_b_mp = Path(ab_slots.slot_b)

Expand Down Expand Up @@ -239,15 +242,16 @@ def test_rpi_boot_normal_update(self, mocker: pytest_mock.MockerFixture):
from otaclient.app.boot_control._rpi_boot import RPIBootController

# ------ patch rpi_boot_cfg for boot_controller_inst1.stage 1~3 ------#
_rpi_boot_cfg_path = f"{cfg.BOOT_CONTROL_CONFIG_MODULE_PATH}.rpi_boot_cfg"
rpi_boot_cfg_path = f"{cfg.BOOT_CONTROL_CONFIG_MODULE_PATH}.rpi_boot_cfg"
mocker.patch(
f"{_rpi_boot_cfg_path}.SYSTEM_BOOT_MOUNT_POINT", str(self.system_boot)
f"{rpi_boot_cfg_path}.SYSTEM_BOOT_MOUNT_POINT", str(self.system_boot)
)
mocker.patch(f"{_rpi_boot_cfg_path}.ACTIVE_ROOTFS_PATH", str(self.slot_a_mp))
mocker.patch(f"{_rpi_boot_cfg_path}.MOUNT_POINT", str(self.slot_b_mp))
mocker.patch(f"{rpi_boot_cfg_path}.ACTIVE_ROOTFS_PATH", str(self.slot_a_mp))
mocker.patch(f"{rpi_boot_cfg_path}.MOUNT_POINT", str(self.slot_b_mp))
mocker.patch(
f"{_rpi_boot_cfg_path}.ACTIVE_ROOT_MOUNT_POINT", str(self.slot_a_mp)
f"{rpi_boot_cfg_path}.ACTIVE_ROOT_MOUNT_POINT", str(self.slot_a_mp)
)
mocker.patch(f"{rpi_boot_cfg_path}.RPI_MODEL_FILE", str(self.model_file))

# ------ boot_controller_inst1.stage1: init ------ #
rpi_boot_controller1 = RPIBootController()
Expand Down Expand Up @@ -312,13 +316,8 @@ def test_rpi_boot_normal_update(self, mocker: pytest_mock.MockerFixture):
assert not (self.system_boot / rpi_boot_cfg.SWITCH_BOOT_FLAG_FILE).is_file()

# ------ boot_controller_inst2: first reboot ------ #
# patch rpi_boot_cfg for boot_controller_inst2
_rpi_boot_cfg_path = f"{cfg.BOOT_CONTROL_CONFIG_MODULE_PATH}.rpi_boot_cfg"
mocker.patch(
f"{_rpi_boot_cfg_path}.SYSTEM_BOOT_MOUNT_POINT", str(self.system_boot)
)
mocker.patch(f"{_rpi_boot_cfg_path}.ACTIVE_ROOTFS_PATH", str(self.slot_b_mp))
mocker.patch(f"{_rpi_boot_cfg_path}.MOUNT_POINT", str(self.slot_a_mp))
mocker.patch(f"{rpi_boot_cfg_path}.ACTIVE_ROOTFS_PATH", str(self.slot_b_mp))
mocker.patch(f"{rpi_boot_cfg_path}.MOUNT_POINT", str(self.slot_a_mp))

# ------ boot_controller_inst2.stage1: finalize switchboot ------ #
logger.info("1st reboot: finalize switch boot and update firmware....")
Expand Down

0 comments on commit 0ba07f3

Please sign in to comment.