Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py

Issue 3349001: hardware_DiskSize,SsdDetection: fix hardware root dev discovery (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: don't drop re Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/site_tests/hardware_DiskSize/hardware_DiskSize.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py
diff --git a/client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py b/client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py
index 3cf019b09fe0518d8d9f8dfdcfe4139cf461fe14..bc7853482c7fbc13c07cf060a2280f0ae28f2737 100644
--- a/client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py
+++ b/client/site_tests/hardware_SsdDetection/hardware_SsdDetection.py
@@ -22,16 +22,14 @@ class hardware_SsdDetection(test.test):
# TODO(ericli): need to find a general solution to install dep packages
# when tests are pre-compiled, so setup() is not called from client any
# more.
+
dep = 'hdparm'
dep_dir = os.path.join(self.autodir, 'deps', dep)
self.job.install_pkg(dep, 'dep', dep_dir)
- cmdline = file('/proc/cmdline').read()
- match = re.search(r'root=([^ ]+)', cmdline)
- if not match:
- raise error.TestError('Unable to find the root partition')
- device = match.group(1)[:-1]
-
+ # Use rootdev to find the underlying block device even if the
+ # system booted to /dev/dm-0.
+ device = utils.system_output('rootdev -s -d')
path = self.autodir + '/deps/hdparm/sbin/'
hdparm = utils.run(path + 'hdparm -I %s' % device)
@@ -46,18 +44,14 @@ class hardware_SsdDetection(test.test):
raise error.TestFail(
'Rotation Rate not reported from the device, '
'unable to ensure it is a SSD')
-
# Check if SSD is > 8GB in size
match = re.search("device size with M = 1000\*1000: (.+) MBytes",
hdparm.stdout, re.MULTILINE)
-
+
if match and match.group(1):
size = int(match.group(1))
self.write_perf_keyval({"mb_ssd_device_size" : size})
- else:
+ else:
raise error.TestFail(
'Device size info missing from the device')
-
-
-
« no previous file with comments | « client/site_tests/hardware_DiskSize/hardware_DiskSize.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698