Skip to content

Conversation

@SmithChart
Copy link
Member

No description provided.

@SmithChart SmithChart self-assigned this Sep 12, 2025

def test_linux_watchdog(strategy):
"""
Check if the system reboots, if we stop feeding the watchdog.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Check if the system reboots, if we stop feeding the watchdog.
Check if the system resets, if we stop feeding the watchdog.

"""
Check if the system reboots, if we stop feeding the watchdog.
The watchdog is handled by systemd, so stopping systemd should reboot the DUT.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The watchdog is handled by systemd, so stopping systemd should reboot the DUT.
The watchdog is handled by systemd, so stopping systemd should reset the DUT.

Comment on lines +103 to +108
index, _, _, _ = strategy.console.expect(
["STM32 RCC reset reason WDG", TIMEOUT],
timeout=30,
)
if index != 0:
raise Exception("Device failed to reboot in time.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit compared to..

Suggested change
index, _, _, _ = strategy.console.expect(
["STM32 RCC reset reason WDG", TIMEOUT],
timeout=30,
)
if index != 0:
raise Exception("Device failed to reboot in time.")
strategy.console.expect("STM32 RCC reset reason WDG", timeout=30)

..?

Comment on lines +109 to +113
strategy.target.activate(strategy.barebox)
strategy.barebox.run_check("global linux.bootargs.loglevel=loglevel=6")
strategy.barebox.boot("")
strategy.barebox.await_boot()
strategy.target.activate(strategy.shell)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're basically doing the same as the strategy does. I don't think that's a good approach. I would drop all of this (see below how the device can be easily transitioned to a well defined state).

Comment on lines +114 to +118
except Exception as e:
# With any exception happening in this test we must assume that the device state is tainted.
# Let's switch it off, so the strategy can reboot the device into a clean state
strategy.transition(Status.off)
raise e
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
except Exception as e:
# With any exception happening in this test we must assume that the device state is tainted.
# Let's switch it off, so the strategy can reboot the device into a clean state
strategy.transition(Status.off)
raise e
finally:
# Let's switch the TAC off, so it reaches a well defined state
strategy.transition("off")

..and drop the from lxatacstrategy import Status.

Comment on lines +97 to +100
strategy.target.deactivate(strategy.shell)

# systemd should be feeding the watchdog. let's kill systemd and wait for the watchdog to reset the DUT.
strategy.console.write(b"kill -11 1\n") # This command will not return, so we can not use shell.run()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert 10 <= data["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] <= 70


def test_linux_watchdog(strategy):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing makes sure the device is actually in the shell state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants