Merge ~jocave/checkbox-support:add-watchdog-category-udev into checkbox-support:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: c8cb28d56cd3ab90fa77f38467d064f354f883fc
Merged at revision: 7e8db9af9d1ef49a343347d25747bc0be1464b86
Proposed branch: ~jocave/checkbox-support:add-watchdog-category-udev
Merge into: checkbox-support:master
Diff against target: 112 lines (+16/-7)
2 files modified
checkbox_support/parsers/tests/test_udevadm.py (+11/-7)
checkbox_support/parsers/udevadm.py (+5/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+395442@code.launchpad.net

Description of the change

Update udev parsing to add detection of watchdog devices. These are of more interest for IoT devices so putting time in to device resource reporting seems worth while.

Further MRs will be provided to update p-p-r device resource job and a p-p-c detect job.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

I'm wondering if we should discard virtual watchdogs like:

P: /devices/virtual/watchdog/watchdog9

Spotted while reading your comment about the 32 watchdogs declared in the LENOVO_E431.txt test data file.

review: Needs Information
Revision history for this message
Jonathan Cave (jocave) wrote :

Modifying to ignore virtual devices

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

Thanks for the last fix, LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/checkbox_support/parsers/tests/test_udevadm.py b/checkbox_support/parsers/tests/test_udevadm.py
2index ace031a..d611727 100644
3--- a/checkbox_support/parsers/tests/test_udevadm.py
4+++ b/checkbox_support/parsers/tests/test_udevadm.py
5@@ -67,6 +67,7 @@ class UdevadmDataMixIn(object):
6 except (IOError, OSError):
7 return None
8
9+
10 class TestUdevadmParser(TestCase, UdevadmDataMixIn):
11
12 def getParser(self, string):
13@@ -364,7 +365,7 @@ E: UDEV_LOG=3
14
15 def test_TOSHIBA_NVME(self):
16 devices = self.parse("TOSHIBA_NVME")
17- self.assertEqual(len(devices), 132)
18+ self.assertEqual(len(devices), 133)
19 self.assertEqual(self.count(devices, "VIDEO"), 2)
20 self.assertEqual(self.count(devices, "AUDIO"), 2)
21 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
22@@ -529,7 +530,7 @@ E: UDEV_LOG=3
23 self.assertEqual(self.count(devices, "AUDIO"), 4)
24 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
25 self.assertEqual(self.count(devices, "TOUCHPAD"), 1)
26- self.assertEqual(self.count(devices, "CARDREADER"), 1) # rtsx
27+ self.assertEqual(self.count(devices, "CARDREADER"), 1) # rtsx
28 self.assertEqual(self.count(devices, "CDROM"), 1)
29 self.assertEqual(self.count(devices, "FIREWIRE"), 0)
30 self.assertEqual(self.count(devices, "MOUSE"), 1)
31@@ -631,9 +632,10 @@ E: UDEV_LOG=3
32
33 def test_EMMC_INTEL_NUC_SNAPPY(self):
34 devices = self.parse("INTEL_NUC_SNAPPY")
35- self.assertEqual(len(devices), 77)
36+ self.assertEqual(len(devices), 78)
37 # Check that the eMMC drive is reported as a DISK
38 self.assertEqual(self.count(devices, "DISK"), 1)
39+ self.assertEqual(self.count(devices, "WATCHDOG"), 1)
40
41 def test_EMMC_NOT_AS_MAIN_DRIVE(self):
42 devices = self.parse("EMMC_AS_MAIN_DRIVE", with_lsblk=False)
43@@ -865,13 +867,13 @@ E: UDEV_LOG=3
44 (None, "VIDEO", "pci", 0x10de, 0x1049),
45 ("RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller",
46 "NETWORK", "pci", 0x10EC, 0x8168),
47- ]
48+ ]
49 self.verify_devices(devices, expected_devices)
50
51 def test_CARA_T(self):
52 # A Snappy system with CANBus
53 devices = self.parse("CARA_T")
54- self.assertEqual(len(devices), 78)
55+ self.assertEqual(len(devices), 79)
56 self.assertEqual(self.count(devices, "VIDEO"), 0)
57 self.assertEqual(self.count(devices, "AUDIO"), 0)
58 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
59@@ -885,11 +887,12 @@ E: UDEV_LOG=3
60 self.assertEqual(self.count(devices, "CAPTURE"), 0)
61 self.assertEqual(self.count(devices, "DISK"), 1)
62 self.assertEqual(self.count(devices, "CANBUS"), 1)
63+ self.assertEqual(self.count(devices, "WATCHDOG"), 1)
64
65 def test_CARA_T_SOCKETCAN(self):
66 # A Snappy system with a SocketCAN device
67 devices = self.parse("CARA_T_SOCKETCAN")
68- self.assertEqual(len(devices), 78)
69+ self.assertEqual(len(devices), 79)
70 self.assertEqual(self.count(devices, "VIDEO"), 0)
71 self.assertEqual(self.count(devices, "AUDIO"), 0)
72 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
73@@ -904,6 +907,7 @@ E: UDEV_LOG=3
74 self.assertEqual(self.count(devices, "DISK"), 1)
75 self.assertEqual(self.count(devices, "CANBUS"), 0)
76 self.assertEqual(self.count(devices, "SOCKETCAN"), 1)
77+ self.assertEqual(self.count(devices, "WATCHDOG"), 1)
78
79 def test_IBM_s390x_DASD(self):
80 devices = self.parse("IBM_s390x_DASD")
81@@ -920,7 +924,7 @@ E: UDEV_LOG=3
82
83 def test_VESTA_300(self):
84 devices = self.parse("VESTA_300")
85- self.assertEqual(len(devices), 14)
86+ self.assertEqual(len(devices), 15)
87 self.assertEqual(self.count(devices, "NETWORK"), 1)
88 self.assertEqual(self.count(devices, "WIRELESS"), 1)
89 self.assertEqual(self.count(devices, "CARDREADER"), 0)
90diff --git a/checkbox_support/parsers/udevadm.py b/checkbox_support/parsers/udevadm.py
91index baee862..a2d884e 100644
92--- a/checkbox_support/parsers/udevadm.py
93+++ b/checkbox_support/parsers/udevadm.py
94@@ -557,6 +557,8 @@ class UdevadmDevice(object):
95 # special device for PiCamera
96 if self._environment["SUBSYSTEM"] == "vchiq":
97 return "MMAL"
98+ if self._environment["SUBSYSTEM"] == "watchdog":
99+ return "WATCHDOG"
100
101 if ('RFKILL_TYPE' in self._environment and
102 'RFKILL_NAME' in self._environment):
103@@ -1107,6 +1109,9 @@ class UdevadmParser(object):
104 if device.bus == "vchiq":
105 return False
106
107+ if device.category == "WATCHDOG":
108+ return "virtual" in device.path
109+
110 # Ignore devices without bus information
111 if not device.bus:
112 return True

Subscribers

People subscribed via source and target branches