Debian Codegraph @

examples/library/test.py

raw symbols SCIP
1 #!/usr/bin/env python3
2 """Power-cycle a target until the /dev/nand0 device is missing."""
3
4 import sys
5 import logging
6
7 from labgrid import Environment
8 from labgrid.logging import basicConfig, StepLogger
9 from labgrid.strategy.bareboxstrategy import Status
10
11
12 # enable info logging
13 basicConfig(level=logging.INFO)
14
15 # log labgrid steps
16 StepLogger.start()
17
18
19 def run_once(target):
20 s = target.get_driver("BareboxStrategy")
21 s.status = Status.unknown # force a power-cycle
22 s.transition("barebox")
23 cmd = target["CommandProtocol"]
24 cmd.run_check("test -e /dev/nand0")
25 target.deactivate(cmd)
26
27
28 env = Environment(sys.argv[1])
29 target = env.get_target("main")
30 while True:
31 run_once(target)