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
=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_submission.py'
--- checkbox-support/checkbox_support/parsers/tests/test_submission.py 2015-10-19 19:03:48 +0000
+++ checkbox-support/checkbox_support/parsers/tests/test_submission.py 2016-01-08 14:45:26 +0000
@@ -202,7 +202,7 @@
202 """202 """
203 result = self.getResult("submission_udev_armhf.xml")203 result = self.getResult("submission_udev_armhf.xml")
204 self.assertTrue("device_states" in result)204 self.assertTrue("device_states" in result)
205 self.assertEqual(len(result["device_states"]), 14)205 self.assertEqual(len(result["device_states"]), 15)
206206
207 def test_device_udevadm(self):207 def test_device_udevadm(self):
208 """Device states can be in a udevadm info element."""208 """Device states can be in a udevadm info element."""
209209
=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_udevadm.py'
--- checkbox-support/checkbox_support/parsers/tests/test_udevadm.py 2015-06-10 15:53:02 +0000
+++ checkbox-support/checkbox_support/parsers/tests/test_udevadm.py 2016-01-08 14:45:26 +0000
@@ -555,15 +555,15 @@
555555
556 def test_PANDABOARD(self):556 def test_PANDABOARD(self):
557 devices = self.parse("PANDABOARD")557 devices = self.parse("PANDABOARD")
558 self.assertEqual(len(devices), 14)558 self.assertEqual(len(devices), 15)
559 # Check that the wireless product name is extracted from the platform559 # Check that the wireless product name is extracted from the platform
560 # modalias560 # modalias
561 self.assertEqual(devices[2].product, "wl12xx")561 self.assertEqual(devices[3].product, "wl12xx")
562 self.assertEqual(self.count(devices, "VIDEO"), 0)562 self.assertEqual(self.count(devices, "VIDEO"), 0)
563 self.assertEqual(self.count(devices, "AUDIO"), 0)563 self.assertEqual(self.count(devices, "AUDIO"), 0)
564 self.assertEqual(self.count(devices, "KEYBOARD"), 1)564 self.assertEqual(self.count(devices, "KEYBOARD"), 1)
565 self.assertEqual(self.count(devices, "TOUCHPAD"), 0)565 self.assertEqual(self.count(devices, "TOUCHPAD"), 0)
566 self.assertEqual(self.count(devices, "CARDREADER"), 0)566 self.assertEqual(self.count(devices, "CARDREADER"), 1)
567 self.assertEqual(self.count(devices, "CDROM"), 0)567 self.assertEqual(self.count(devices, "CDROM"), 0)
568 self.assertEqual(self.count(devices, "FIREWIRE"), 0)568 self.assertEqual(self.count(devices, "FIREWIRE"), 0)
569 self.assertEqual(self.count(devices, "MOUSE"), 0)569 self.assertEqual(self.count(devices, "MOUSE"), 0)
570570
=== modified file 'checkbox-support/checkbox_support/parsers/udevadm.py'
--- checkbox-support/checkbox_support/parsers/udevadm.py 2015-11-19 22:05:14 +0000
+++ checkbox-support/checkbox_support/parsers/udevadm.py 2016-01-08 14:45:26 +0000
@@ -1,7 +1,7 @@
1#1#
2# This file is part of Checkbox.2# This file is part of Checkbox.
3#3#
4# Copyright 2011-2013 Canonical Ltd.4# Copyright 2011-2016 Canonical Ltd.
5#5#
6# Checkbox is free software: you can redistribute it and/or modify6# Checkbox is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License version 3,7# it under the terms of the GNU General Public License version 3,
@@ -302,7 +302,9 @@
302 if self.driver.startswith("sdhci"):302 if self.driver.startswith("sdhci"):
303 return "CARDREADER"303 return "CARDREADER"
304 if self.driver.startswith("mmc"):304 if self.driver.startswith("mmc"):
305 return "CARDREADER"305 table_type = self._environment.get("ID_PART_TABLE_TYPE")
306 if table_type and table_type != "gpt":
307 return "CARDREADER"
306 if self.driver == "rts_pstor":308 if self.driver == "rts_pstor":
307 return "CARDREADER"309 return "CARDREADER"
308 # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702145310 # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=702145
@@ -364,6 +366,10 @@
364 # we need to test, and is a valid disk device366 # we need to test, and is a valid disk device
365 # we need to report.367 # we need to report.
366 return "DISK"368 return "DISK"
369 if (self.driver == 'mmcblk' and
370 self._environment.get("ID_PART_TABLE_TYPE") == "gpt"):
371 # eMMC drives using GPT should also be treated as disks
372 return "DISK"
367 if devtype == "scsi_device":373 if devtype == "scsi_device":
368 match = SCSI_RE.match(self._environment.get("MODALIAS", ""))374 match = SCSI_RE.match(self._environment.get("MODALIAS", ""))
369 type = int(match.group("type"), 16) if match else -1375 type = int(match.group("type"), 16) if match else -1
@@ -567,6 +573,13 @@
567 if "ID_MODEL_ENC" in self._environment:573 if "ID_MODEL_ENC" in self._environment:
568 return decode_id(self._environment["ID_MODEL_ENC"])574 return decode_id(self._environment["ID_MODEL_ENC"])
569575
576 if self.driver == 'mmcblk':
577 # Check parent device for MMC name
578 if self._stack:
579 parent = self._stack[-1]
580 if "MMC_NAME" in parent._environment:
581 return parent._environment["MMC_NAME"]
582
570 for element in ("NAME", "POWER_SUPPLY_MODEL_NAME"):583 for element in ("NAME", "POWER_SUPPLY_MODEL_NAME"):
571 if element in self._environment:584 if element in self._environment:
572 return self._environment[element].strip('"')585 return self._environment[element].strip('"')
@@ -674,6 +687,13 @@
674 # product/vendor ID, yet still constitute valid ethX interfaces.687 # product/vendor ID, yet still constitute valid ethX interfaces.
675 if device.bus == "net" and "ID_NET_NAME_MAC" in device._environment:688 if device.bus == "net" and "ID_NET_NAME_MAC" in device._environment:
676 return False689 return False
690
691 # Do not ignore eMMC drives using GPT
692 if ("ID_PART_TABLE_TYPE" in device._environment and
693 device.driver == 'mmcblk'):
694 if device._environment["ID_PART_TABLE_TYPE"] == 'gpt':
695 return False
696
677 # Do not ignore nvme devices on the pci bus, these are to be treated697 # Do not ignore nvme devices on the pci bus, these are to be treated
678 # as disks (categorization is done elsewhere). Note that the *parent*698 # as disks (categorization is done elsewhere). Note that the *parent*
679 # device will have no category, though it's not ignored per se.699 # device will have no category, though it's not ignored per se.

Subscribers

People subscribed via source and target branches