Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Watchdog punching is paused if file is present
_WATCHDOG_PAUSE_FILE_PATH = Path("/var/lock/pddf-locks/watchdog.pause")
# How long the watchdog is armed for by the watchdog.timer
_WATCHDOG_PUNCH_DAEMON_ARM_SECONDS = 360
_WATCHDOG_PUNCH_DAEMON_ARM_SECONDS = 300


def _pause_watchdog_punching(duration: datetime.timedelta) -> None:
Expand Down Expand Up @@ -126,6 +126,12 @@ def _do_real_arm(self, seconds: int) -> int:
self._toggle_watchdog_counter_enable(True)
self._toggle_watchdog_reboot(True)
self._update_watchdog_countdown_value(milliseconds=seconds*1_000)
# TODO: workaround: arm watchdog 2 to trigger watchdog 1
fpga_lib.write_32(
pci_address=self.fpga_pci_addr,
offset=0x1d8,
val=0x80000001,
)
except Exception as e:
_logger.log_error(f"cannot arm watchdog: {e}")
return -1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def test_arm_seconds_out_of_bound_error(self, seconds):

def test_arm_should_update_counter(
self,
watchdog_module,
mock_update_watchdog_countdown_value,
mock_toggle_watchdog_reboot,
mock_toggle_watchdog_counter_enable,
Expand All @@ -211,7 +212,9 @@ def test_arm_should_update_counter(
)

# Act
actual_return_value = self.watchdog.arm(timeout_seconds)
# TODO: workaround: arm watchdog 2 to trigger watchdog 1
with patch.object(watchdog_module.fpga_lib, "write_32", autospec=True):
actual_return_value = self.watchdog.arm(timeout_seconds)

# Assert
assert (
Expand Down
Loading