Merge ~sylvain-pineau/plainbox-provider-snappy:lsusb-stress-check into plainbox-provider-snappy:master

Proposed by Sylvain Pineau
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 1b69170971732b57faa4173210ef9986010a7ef8
Merged at revision: aee1fcea910c580556ebe3b55515fa608e4850aa
Proposed branch: ~sylvain-pineau/plainbox-provider-snappy:lsusb-stress-check
Merge into: plainbox-provider-snappy:master
Diff against target: 169 lines (+46/-12)
2 files modified
bin/lsusb.py (+13/-4)
units/stress/boot.pxu (+33/-8)
Reviewer Review Type Date Requested Status
Devices Certification Bot Needs Fixing
Jonathan Cave (community) Approve
Review via email: mp+336318@code.launchpad.net

Description of the change

This MR adds lsusb checks after every warm/cold boot cycles.

Diff is possible uisng a short mode added to the python script replacing lsusb on core

To post a comment you must log in.
Revision history for this message
Jonathan Cave (jocave) wrote :

I think i would like to know exactly which devices i have found connected and, if the list changes, exactly which device disappeared.

This would help identify if a problem is due to a particularly piece of hardware or something else. Would it be possible to add a device serial number to fields collected?

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

Use diff -u for a more readable output when things differ across reboots.

Regarding iSerial, it is not mandatory according to the USB standard to have such string descriptor.
See http://www.beyondlogic.org/usbnutshell/usb5.shtml#DeviceDescriptors:

"Three string descriptors exist to provide details of the manufacturer, product and serial number.
There is no requirement to have string descriptors.
If no string descriptor is present, a index of zero should be used."

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

Ok, although the feature would have been nice, it seems there is no guarantee of the information to implement it being available. Thanks for the research in to that.

review: Approve
Revision history for this message
Devices Certification Bot (ce-certification-qa) wrote :

The merge was fine but running tests failed.

[trusty] starting container
[trusty] (timing) 0.00user 0.00system 0:00.15elapsed 5%CPU (0avgtext+0avgdata 4848maxresident)k
[trusty] (timing) 16inputs+72outputs (0major+1430minor)pagefaults 0swaps
[trusty] provisioning container
[trusty] (timing) 39.55user 13.28system 2:22.56elapsed 37%CPU (0avgtext+0avgdata 67908maxresident)k
[trusty] (timing) 641992inputs+2007952outputs (581major+1388097minor)pagefaults 0swaps
[trusty-testing] Starting tests...
Found a test script: ./requirements/container-tests-provider-snappy
[trusty-testing] container-tests-provider-snappy: PASS
[trusty-testing] (timing) 10.94user 0.52system 0:34.35elapsed 33%CPU (0avgtext+0avgdata 74316maxresident)k
[trusty-testing] (timing) 6632inputs+85296outputs (11major+61947minor)pagefaults 0swaps
[trusty-testing] Fixing file permissions in source directory
[trusty-testing] Destroying container
Name: trusty-testing
State: STOPPED
[xenial] starting container
[xenial] (timing) 0.00user 0.00system 0:00.12elapsed 6%CPU (0avgtext+0avgdata 4848maxresident)k
[xenial] (timing) 16inputs+72outputs (0major+1423minor)pagefaults 0swaps
[xenial] provisioning container
[xenial] (timing) 55.58user 10.19system 2:19.31elapsed 47%CPU (0avgtext+0avgdata 107684maxresident)k
[xenial] (timing) 739288inputs+2322944outputs (580major+2350962minor)pagefaults 0swaps
[xenial-testing] Starting tests...
Found a test script: ./requirements/container-tests-provider-snappy
[xenial-testing] container-tests-provider-snappy: PASS
[xenial-testing] (timing) 9.42user 0.50system 0:36.65elapsed 27%CPU (0avgtext+0avgdata 68676maxresident)k
[xenial-testing] (timing) 7752inputs+85296outputs (24major+54381minor)pagefaults 0swaps
[xenial-testing] Fixing file permissions in source directory
[xenial-testing] Destroying container
Name: xenial-testing
State: STOPPED
Complete test time:
115.62user 25.22system 6:17.25elapsed 37%CPU (0avgtext+0avgdata 107684maxresident)k
1412712inputs+4501728outputs (1250major+3883120minor)pagefaults 0swaps
Check build status: https://launchpad.net/~ce-certification-qa/+snap/checkbox-snappy-edge/+build/132934
HTTP Error 400: Bad Request
Response headers:
---
connection: close
content-length: 59
content-type: text/plain
date: Fri, 19 Jan 2018 10:07:09 GMT
server: zope.server.http (HTTP)
status: 400
strict-transport-security: max-age=15552000
vary: Accept
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-launchpad-revision: 18532
x-lazr-notifications: []
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-xss-protection: 1; mode=block
---
Response body:
---
b'An identical build of this snap package is already pending.'
---

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

WHAT?

Revision history for this message
Devices Certification Bot (ce-certification-qa) wrote :

The merge was fine but running tests failed.

[trusty] starting container
[trusty] (timing) 0.00user 0.00system 0:00.14elapsed 5%CPU (0avgtext+0avgdata 4896maxresident)k
[trusty] (timing) 80inputs+72outputs (1major+1417minor)pagefaults 0swaps
[trusty] provisioning container
[trusty] (timing) 39.69user 13.24system 2:27.52elapsed 35%CPU (0avgtext+0avgdata 68212maxresident)k
[trusty] (timing) 646144inputs+2007960outputs (586major+1363043minor)pagefaults 0swaps
[trusty-testing] Starting tests...
Found a test script: ./requirements/container-tests-provider-snappy
[trusty-testing] container-tests-provider-snappy: PASS
[trusty-testing] (timing) 11.07user 0.56system 0:30.28elapsed 38%CPU (0avgtext+0avgdata 74300maxresident)k
[trusty-testing] (timing) 5432inputs+85288outputs (23major+61054minor)pagefaults 0swaps
[trusty-testing] Fixing file permissions in source directory
[trusty-testing] Destroying container
Name: trusty-testing
State: STOPPED
[xenial] starting container
[xenial] (timing) 0.00user 0.00system 0:00.17elapsed 4%CPU (0avgtext+0avgdata 4928maxresident)k
[xenial] (timing) 80inputs+72outputs (1major+1434minor)pagefaults 0swaps
[xenial] provisioning container
[xenial] (timing) 55.88user 9.44system 2:13.76elapsed 48%CPU (0avgtext+0avgdata 107692maxresident)k
[xenial] (timing) 735904inputs+2322944outputs (569major+2155579minor)pagefaults 0swaps
[xenial-testing] Starting tests...
Found a test script: ./requirements/container-tests-provider-snappy
[xenial-testing] container-tests-provider-snappy: PASS
[xenial-testing] (timing) 9.33user 0.46system 0:27.67elapsed 35%CPU (0avgtext+0avgdata 68632maxresident)k
[xenial-testing] (timing) 8040inputs+85288outputs (33major+54855minor)pagefaults 0swaps
[xenial-testing] Fixing file permissions in source directory
[xenial-testing] Destroying container
Name: xenial-testing
State: STOPPED
Complete test time:
116.12user 24.44system 6:03.74elapsed 38%CPU (0avgtext+0avgdata 107692maxresident)k
1416600inputs+4501720outputs (1287major+3662327minor)pagefaults 0swaps
Check build status: https://launchpad.net/~ce-certification-qa/+snap/checkbox-snappy-edge/+build/132963
HTTP Error 400: Bad Request
Response headers:
---
connection: close
content-length: 59
content-type: text/plain
date: Fri, 19 Jan 2018 11:06:48 GMT
server: zope.server.http (HTTP)
status: 400
strict-transport-security: max-age=15552000
vary: Accept
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-launchpad-revision: 18532
x-lazr-notifications: []
x-powered-by: Zope (www.zope.org), Python (www.python.org)
x-xss-protection: 1; mode=block
---
Response body:
---
b'An identical build of this snap package is already pending.'
---

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/lsusb.py b/bin/lsusb.py
2index 22239d8..9fa152f 100755
3--- a/bin/lsusb.py
4+++ b/bin/lsusb.py
5@@ -20,6 +20,7 @@ showhubint = False
6 noemptyhub = False
7 nohub = False
8 warnsort = False
9+shortmode = False
10
11 prefix = "/sys/bus/usb/devices/"
12 usbids = "/usr/share/usb.ids"
13@@ -401,8 +402,11 @@ class UsbDevice:
14 else:
15 col = cols[1]
16 if not nohub or self.iclass != 9:
17- str = "Bus %03d Device %03d: ID %04x:%04x %s" % \
18- (self.busnum, self.devnum, self.vid, self.pid, self.name)
19+ if shortmode:
20+ str = "ID %04x:%04x %s" % (self.vid, self.pid, self.name)
21+ else:
22+ str = "Bus %03d Device %03d: ID %04x:%04x %s" % \
23+ (self.busnum, self.devnum, self.vid, self.pid, self.name)
24 str += "\n"
25 if showint:
26 for iface in self.interfaces:
27@@ -469,6 +473,7 @@ def usage():
28 print(" -u suppress empty hubs")
29 print(" -U suppress all hubs")
30 print(" -c use colors")
31+ print(" -s short mode")
32 print(" -w display warning if usb.ids is not sorted correctly")
33 print(" -f FILE override filename for /usr/share/usb.ids")
34 return 2
35@@ -487,9 +492,10 @@ def read_usb():
36
37 def main(argv):
38 "main entry point"
39- global showint, showhubint, noemptyhub, nohub, warnsort, cols, usbids
40+ global showint, showhubint, noemptyhub, nohub, warnsort, cols, usbids, \
41+ shortmode
42 try:
43- (optlist, args) = getopt.gnu_getopt(argv[1:], "hiIuUwcf:", ("help",))
44+ (optlist, args) = getopt.gnu_getopt(argv[1:], "hiIuUwcsf:", ("help",))
45 except getopt.GetoptError as exc:
46 print("Error:", exc)
47 sys.exit(usage())
48@@ -520,6 +526,9 @@ def main(argv):
49 if opt[0] == "-f":
50 usbids = opt[1]
51 continue
52+ if opt[0] == "-s":
53+ shortmode = True
54+ continue
55 if len(args) > 0:
56 print("Error: excess args %s ..." % args[0])
57 sys.exit(usage())
58diff --git a/units/stress/boot.pxu b/units/stress/boot.pxu
59index 006a5bc..ee94d80 100644
60--- a/units/stress/boot.pxu
61+++ b/units/stress/boot.pxu
62@@ -48,6 +48,7 @@ plugin: shell
63 command:
64 lspci -i $SNAP/usr/share/misc/pci.ids > $PLAINBOX_SESSION_SHARE/lspci_original || true
65 nmcli -t -f active,BSSID d w l | grep -oP "(?<=^yes:).*" > $PLAINBOX_SESSION_SHARE/wifi_original || true
66+ lsusb.py -f $SNAP/var/lib/usbutils/usb.ids -s | sort > $PLAINBOX_SESSION_SHARE/lsusb_original || true
67 environ: LD_LIBRARY_PATH
68 user: root
69 estimated_duration: 1s
70@@ -100,16 +101,22 @@ environ: LD_LIBRARY_PATH
71 command:
72 lspci -i $SNAP/usr/share/misc/pci.ids > $PLAINBOX_SESSION_SHARE/lspci_test
73 nmcli -t -f active,BSSID d w l | grep -oP "(?<=^yes:).*" > $PLAINBOX_SESSION_SHARE/wifi_test
74- diff $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
75+ lsusb.py -f $SNAP/var/lib/usbutils/usb.ids -s | sort > $PLAINBOX_SESSION_SHARE/lsusb_test
76+ diff -u $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
77 if [ $? -ne 0 ] ; then
78 echo "lspci mismatch during cycle 1"
79 exit 1
80 fi
81- diff $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
82+ diff -u $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
83 if [ $? -ne 0 ] ; then
84 echo "wifi mismatch during cycle 1"
85 exit 1
86 fi
87+ diff -u $PLAINBOX_SESSION_SHARE/lsusb_original $PLAINBOX_SESSION_SHARE/lsusb_test
88+ if [ $? -ne 0 ] ; then
89+ echo "lsusb mismatch during cycle 1"
90+ exit 1
91+ fi
92 user: root
93 flags: preserve-locale
94 estimated_duration: 1.0
95@@ -129,16 +136,22 @@ environ: LD_LIBRARY_PATH
96 command:
97 lspci -i $SNAP/usr/share/misc/pci.ids > $PLAINBOX_SESSION_SHARE/lspci_test
98 nmcli -t -f active,BSSID d w l | grep -oP "(?<=^yes:).*" > $PLAINBOX_SESSION_SHARE/wifi_test
99- diff $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
100+ lsusb.py -f $SNAP/var/lib/usbutils/usb.ids -s | sort > $PLAINBOX_SESSION_SHARE/lsusb_test
101+ diff -u $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
102 if [ $? -ne 0 ] ; then
103 echo "lspci mismatch during cycle {reboot_id}"
104 exit 1
105 fi
106- diff $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
107+ diff -u $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
108 if [ $? -ne 0 ] ; then
109 echo "wifi mismatch during cycle {reboot_id}"
110 exit 1
111 fi
112+ diff -u $PLAINBOX_SESSION_SHARE/lsusb_original $PLAINBOX_SESSION_SHARE/lsusb_test
113+ if [ $? -ne 0 ] ; then
114+ echo "lsusb mismatch during cycle {reboot_id}"
115+ exit 1
116+ fi
117 user: root
118 flags: preserve-locale
119 estimated_duration: 1.0
120@@ -192,16 +205,22 @@ environ: LD_LIBRARY_PATH
121 command:
122 lspci -i $SNAP/usr/share/misc/pci.ids > $PLAINBOX_SESSION_SHARE/lspci_test
123 nmcli -t -f active,BSSID d w l | grep -oP "(?<=^yes:).*" > $PLAINBOX_SESSION_SHARE/wifi_test
124- diff $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
125+ lsusb.py -f $SNAP/var/lib/usbutils/usb.ids -s | sort > $PLAINBOX_SESSION_SHARE/lsusb_test
126+ diff -u $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
127 if [ $? -ne 0 ] ; then
128 echo "lspci mismatch during cycle 1"
129 exit 1
130 fi
131- diff $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
132+ diff -u $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
133 if [ $? -ne 0 ] ; then
134 echo "wifi mismatch during cycle 1"
135 exit 1
136 fi
137+ diff -u $PLAINBOX_SESSION_SHARE/lsusb_original $PLAINBOX_SESSION_SHARE/lsusb_test
138+ if [ $? -ne 0 ] ; then
139+ echo "lsusb mismatch during cycle 1"
140+ exit 1
141+ fi
142 user: root
143 flags: preserve-locale
144 estimated_duration: 1.0
145@@ -221,16 +240,22 @@ environ: LD_LIBRARY_PATH
146 command:
147 lspci -i $SNAP/usr/share/misc/pci.ids > $PLAINBOX_SESSION_SHARE/lspci_test
148 nmcli -t -f active,BSSID d w l | grep -oP "(?<=^yes:).*" > $PLAINBOX_SESSION_SHARE/wifi_test
149- diff $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
150+ lsusb.py -f $SNAP/var/lib/usbutils/usb.ids -s | sort > $PLAINBOX_SESSION_SHARE/lsusb_test
151+ diff -u $PLAINBOX_SESSION_SHARE/lspci_original $PLAINBOX_SESSION_SHARE/lspci_test
152 if [ $? -ne 0 ] ; then
153 echo "lspci mismatch during cycle {reboot_id}"
154 exit 1
155 fi
156- diff $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
157+ diff -u $PLAINBOX_SESSION_SHARE/wifi_original $PLAINBOX_SESSION_SHARE/wifi_test
158 if [ $? -ne 0 ] ; then
159 echo "wifi mismatch during cycle {reboot_id}"
160 exit 1
161 fi
162+ diff -u $PLAINBOX_SESSION_SHARE/lsusb_original $PLAINBOX_SESSION_SHARE/lsusb_test
163+ if [ $? -ne 0 ] ; then
164+ echo "lsusb mismatch during cycle {reboot_id}"
165+ exit 1
166+ fi
167 user: root
168 flags: preserve-locale
169 estimated_duration: 1.0

Subscribers

People subscribed via source and target branches