host/lib/tools.py: Fix unit tests for fdisk 2.24.
Version output has changed slightly, so be more lax on format. New
version is printed as:
fdisk from util-linux 2.24
Also, remove the check for failed execution, since the 2.24 version now
raises an error. SUID bits should be caught by the security test suites,
so there's no need to double-check it here.
BUG=chromium:334368
TEST=FEATURES=test emerge-<board> cros-devutils
Change-Id: I6430c2ec11d2c732f415bd653f946af667dec916
Reviewed-on: https://chromium-review.googlesource.com/182733
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Olof Johansson <olofj@chromium.org>
Tested-by: Olof Johansson <olofj@chromium.org>
diff --git a/host/lib/tools.py b/host/lib/tools.py
index 3d4a0a3..b7a8164 100755
--- a/host/lib/tools.py
+++ b/host/lib/tools.py
@@ -584,12 +584,10 @@
tools = self.tools
# Ask fdisk for its version - this utility must be in the chroot.
- re_fdisk = re.compile('fdisk \(util-linux .*\)')
+ re_fdisk = re.compile('fdisk .*util-linux .*')
self.assertTrue(re_fdisk.match(tools.Run('fdisk', ['-v'])))
# We need sudo for looking at disks.
- self.assertEqual(tools.Run('fdisk', ['-l', '/dev/sda']),
- 'Cannot open /dev/sda\n')
out = tools.Run('fdisk', ['-l', '/dev/sda'], sudo=True)
# Don't look at the specific output, but it will have > 5 lines.