Merge lp:~sylvain-pineau/checkbox/eMMC_as_DISK into lp:checkbox

Proposed by Sylvain Pineau
Status: Rejected
Rejected by: Sylvain Pineau
Proposed branch: lp:~sylvain-pineau/checkbox/eMMC_as_DISK
Merge into: lp:checkbox
Diff against target: 98 lines (+26/-6)
3 files modified
checkbox-support/checkbox_support/parsers/tests/test_submission.py (+1/-1)
checkbox-support/checkbox_support/parsers/tests/test_udevadm.py (+3/-3)
checkbox-support/checkbox_support/parsers/udevadm.py (+22/-2)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/eMMC_as_DISK
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Disapprove
Paul Larson Needs Information
Pierre Equoy Pending
Review via email: mp+282004@code.launchpad.net

Description of the change

This MR proposes a way to detect eMMC drives and report them as DISKS using the udev parser of checkbox-support. Thus avoiding the linked (critical) bug.

Please test it on real hw before merging please

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

It's probably worth updating the copyright in the other files you changed, since they changed and you're updating others.

I'm curious of the test results on real hardware too, and does it (or should it) make a difference whether you are running from a booted usb stick or from an installation to the emmc? Are there some disk tests that we don't want to run for good reason? In the past, I think a lot of testing on things like panda have intentionally avoided disk tests on emmc because they are so slow. Something that took only a few minutes on x86 would suddenly take hours and just wind up hitting the timeout.

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

Rejecting as using GPT is finally not a good idea

review: Disapprove

Unmerged revisions

4152. By Sylvain Pineau

checkbox-support:parsers:udevadm: Allow eMMC drives to be treated as disks

First from a udev point of view it's impossible to distinguish an eMMC drive
from a simple MMC card. both are using the same driver.

The proposed workaround is to detect drives using GPT and treat them as disks.
SD cards using VFAT/MBR won't interfere with disk tests then.

Fixes: https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1522768

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_submission.py'
2--- checkbox-support/checkbox_support/parsers/tests/test_submission.py 2015-10-19 19:03:48 +0000
3+++ checkbox-support/checkbox_support/parsers/tests/test_submission.py 2016-01-08 14:45:26 +0000
4@@ -202,7 +202,7 @@
5 """
6 result = self.getResult("submission_udev_armhf.xml")
7 self.assertTrue("device_states" in result)
8- self.assertEqual(len(result["device_states"]), 14)
9+ self.assertEqual(len(result["device_states"]), 15)
10
11 def test_device_udevadm(self):
12 """Device states can be in a udevadm info element."""
13
14=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_udevadm.py'
15--- checkbox-support/checkbox_support/parsers/tests/test_udevadm.py 2015-06-10 15:53:02 +0000
16+++ checkbox-support/checkbox_support/parsers/tests/test_udevadm.py 2016-01-08 14:45:26 +0000
17@@ -555,15 +555,15 @@
18
19 def test_PANDABOARD(self):
20 devices = self.parse("PANDABOARD")
21- self.assertEqual(len(devices), 14)
22+ self.assertEqual(len(devices), 15)
23 # Check that the wireless product name is extracted from the platform
24 # modalias
25- self.assertEqual(devices[2].product, "wl12xx")
26+ self.assertEqual(devices[3].product, "wl12xx")
27 self.assertEqual(self.count(devices, "VIDEO"), 0)
28 self.assertEqual(self.count(devices, "AUDIO"), 0)
29 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
30 self.assertEqual(self.count(devices, "TOUCHPAD"), 0)
31- self.assertEqual(self.count(devices, "CARDREADER"), 0)
32+ self.assertEqual(self.count(devices, "CARDREADER"), 1)
33 self.assertEqual(self.count(devices, "CDROM"), 0)
34 self.assertEqual(self.count(devices, "FIREWIRE"), 0)
35 self.assertEqual(self.count(devices, "MOUSE"), 0)
36
37=== modified file 'checkbox-support/checkbox_support/parsers/udevadm.py'
38--- checkbox-support/checkbox_support/parsers/udevadm.py 2015-11-19 22:05:14 +0000
39+++ checkbox-support/checkbox_support/parsers/udevadm.py 2016-01-08 14:45:26 +0000
40@@ -1,7 +1,7 @@
41 #
42 # This file is part of Checkbox.
43 #
44-# Copyright 2011-2013 Canonical Ltd.
45+# Copyright 2011-2016 Canonical Ltd.
46 #
47 # Checkbox is free software: you can redistribute it and/or modify
48 # it under the terms of the GNU General Public License version 3,
49@@ -302,7 +302,9 @@
50 if self.driver.startswith("sdhci"):
51 return "CARDREADER"
52 if self.driver.startswith("mmc"):
53- return "CARDREADER"
54+ table_type = self._environment.get("ID_PART_TABLE_TYPE")
55+ if table_type and table_type != "gpt":
56+ return "CARDREADER"
57 if self.driver == "rts_pstor":
58 return "CARDREADER"
59 # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702145
60@@ -364,6 +366,10 @@
61 # we need to test, and is a valid disk device
62 # we need to report.
63 return "DISK"
64+ if (self.driver == 'mmcblk' and
65+ self._environment.get("ID_PART_TABLE_TYPE") == "gpt"):
66+ # eMMC drives using GPT should also be treated as disks
67+ return "DISK"
68 if devtype == "scsi_device":
69 match = SCSI_RE.match(self._environment.get("MODALIAS", ""))
70 type = int(match.group("type"), 16) if match else -1
71@@ -567,6 +573,13 @@
72 if "ID_MODEL_ENC" in self._environment:
73 return decode_id(self._environment["ID_MODEL_ENC"])
74
75+ if self.driver == 'mmcblk':
76+ # Check parent device for MMC name
77+ if self._stack:
78+ parent = self._stack[-1]
79+ if "MMC_NAME" in parent._environment:
80+ return parent._environment["MMC_NAME"]
81+
82 for element in ("NAME", "POWER_SUPPLY_MODEL_NAME"):
83 if element in self._environment:
84 return self._environment[element].strip('"')
85@@ -674,6 +687,13 @@
86 # product/vendor ID, yet still constitute valid ethX interfaces.
87 if device.bus == "net" and "ID_NET_NAME_MAC" in device._environment:
88 return False
89+
90+ # Do not ignore eMMC drives using GPT
91+ if ("ID_PART_TABLE_TYPE" in device._environment and
92+ device.driver == 'mmcblk'):
93+ if device._environment["ID_PART_TABLE_TYPE"] == 'gpt':
94+ return False
95+
96 # Do not ignore nvme devices on the pci bus, these are to be treated
97 # as disks (categorization is done elsewhere). Note that the *parent*
98 # device will have no category, though it's not ignored per se.

Subscribers

People subscribed via source and target branches