Open
Description
I find that sometimes my lab rots, e.g. a piece has fallen out, or something has failed. I have a 'check' tool which goes through and makes sure that everything is working. It works mostly in parallel so is fairly fast. At the end it tells me what is wrong.
Is that possible in labgrid?
For example, with an SDwire, it switches the mux and sees if the device can be mounted / seen:
def check(self):
"""Run a check on the SDwire to see that it seems to work OK
Returns:
work.CheckResult: Result obtained from the check
"""
try:
self.select_dut()
if self.get_status() != self.DUT:
self.raise_self('Failed to switch to DUT')
time.sleep(1)
self.select_ts()
if self.get_status() != self.TS:
self.raise_self('Failed to switch to TS')
symlink_path = '/dev/%s' % self._symlink
result = self.lab.run_command('head', '-0', symlink_path)
if result.return_code:
self.raise_self("Failed to locate '%s'" % symlink_path)
if self._block_symlink:
self.check_for_block_symlink()
if self._mount_uuid:
self.check_for_mount()
msg = 'all OK'
good = True
except ValueError as exc:
msg = str(exc)
good = False
return work.CheckResult(self, good, msg)
The output ends up being something like this and I can check each hub for the problem ports:
Good 104, bad 19, not tested 0
usbport6: head: cannot open '/dev/ttyusb_port6' for reading: No such file or directory
usbport3: head: cannot open '/dev/ttyusb_port3' for reading: No such file or directory
portserver1: Cannot connect: b''
sunxi-usb4: lab kea: dut pine64: No power control
usbport17: head: cannot open '/dev/ttyusb_port17' for reading: No such file or directory
rockchipusb0: head: cannot open '/dev/usbdev-kevin' for reading: No such file or directory
samsungusb0: head: cannot open '/dev/usbdev-snow' for reading: No such file or directory
tegra-usb0: head: cannot open '/dev/usbdev-jetson-tk1' for reading: No such file or directory
imxusb0: head: cannot open '/dev/usbdev-snappermx6' for reading: No such file or directory
intelusb0: head: cannot open '/dev/usbdev-edison' for reading: No such file or directory
Fix list for hub 'hubc'
2: usbport6
6: usbport3
Fix list for hub 'hubf'
5: sunxi-usb4
Fix list for hub 'hube'
2: svcoral
9: tegra-usb1
14: svbob
Fix list for hub 'huba'
5: svsamus
6: svnyan-big
7: svlink
8: svjerry
13: tegra-usb0
16: usbport17
Fix list for hub 'hubd'
1: svsnow
3: imxusb0
4: samsungusb0
7: svkevin
8: rockchipusb0