autotest: fix bootchart missing on NVMe devices.
This change fixes the bug that bootchart is missing in test
BootPerfServerCrosPerf if it runs with a DUT with NVMe storage. Fix the
regular expression in extracting the partition index of "rootdev -s"
output so that values like "/dev/nvme0n1p3" are matched correctly.
BUG=chromium:1043854
TEST=test_that $dut BootPerfServerCrosPerf
Change-Id: Ie6395b13924ec33186b81dc828069b70c3192e4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2008918
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Tested-by: Chinglin Yu <chinglinyu@chromium.org>
Commit-Queue: Chinglin Yu <chinglinyu@chromium.org>
diff --git a/server/site_tests/platform_BootPerfServer/platform_BootPerfServer.py b/server/site_tests/platform_BootPerfServer/platform_BootPerfServer.py
index 239cc75..87e2662 100644
--- a/server/site_tests/platform_BootPerfServer/platform_BootPerfServer.py
+++ b/server/site_tests/platform_BootPerfServer/platform_BootPerfServer.py
@@ -24,10 +24,11 @@
"""Helper function for getting the partition index from the system. """
# Determine root partition
rootdev = host.run_output('rootdev -s')
- # For "mmcblk0p3", partition is 2. Extract the last digit to get the
- # partition index.
+ # Sample value of rootdev: "/dev/mmcblk0p3" or "/dev/nvme0n1p3." For
+ # "/dev/mmcblk0p3", the target is partition 2. Extract the last digit
+ # to get the partition index.
logging.info('rootdev: %s', rootdev)
- match = re.match(r'/dev/mmcblk\dp(\d+)', rootdev)
+ match = re.match(r'^/dev/.*\dp(\d+)$', rootdev)
if match:
return int(match.group(1)) - 1