For most hardware targets other than SimpleRemoteTarget, you can control power:
You can use
TEST_POWERCONTROL_CMD
together with
TEST_POWERCONTROL_EXTRA_ARGS
as a command that runs on the host and does power
cycling.
The test code passes one argument to that command:
off, on or cycle (off then on).
Here is an example that could appear in your
local.conf
file:
TEST_POWERCONTROL_CMD = "powercontrol.exp test 10.11.12.1 nuc1"
In this example, the expect script does the following:
ssh test@10.11.12.1 "pyctl nuc1 arg
"
It then runs a Python script that controls power
for a label called nuc1
.
TEST_POWERCONTROL_CMD
and
TEST_POWERCONTROL_EXTRA_ARGS
for your own setup.
The one requirement is that it accepts
"on", "off", and "cycle" as the last argument.
When no command is defined, it connects to the device over SSH and uses the classic reboot command to reboot the device. Classic reboot is fine as long as the machine actually reboots (i.e. the SSH test has not failed). It is useful for scenarios where you have a simple setup, typically with a single board, and where some manual interaction is okay from time to time.
If you have no hardware to automatically perform power
control but still wish to experiment with automated
hardware testing, you can use the dialog-power-control
script that shows a dialog prompting you to perform the
required power action.
This script requires either KDialog or Zenity to be
installed.
To use this script, set the
TEST_POWERCONTROL_CMD
variable as follows:
TEST_POWERCONTROL_CMD = "${COREBASE}/scripts/contrib/dialog-power-control"