1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-20 11:58:55 +00:00

list_file_systems: fix for Android M and Linux devices

In previous versions of Android, "mount" returned output in the format
similar to fstab entries, which is what list_file_systems expected. This
fixes it to be able to handle the more traditional "mount" output in the
format

	<device> on <mount point> type <fs type> <options>

as well as continue to parse the Android output correctly.
This commit is contained in:
Sergei Trofimov 2015-06-16 08:42:50 +01:00
parent 92ddcbb1e3
commit 4d3feeba64

View File

@ -37,6 +37,8 @@ WRITE_ONLY_TUNABLES = {
'interactive': ['boostpulse']
}
FSTAB_ENTRY_REGEX = re.compile(r'(\S+) on (\S+) type (\S+) \((\S+)\)')
FstabEntry = namedtuple('FstabEntry', ['device', 'mount_point', 'fs_type', 'options', 'dump_freq', 'pass_num'])
PsEntry = namedtuple('PsEntry', 'user pid ppid vsize rss wchan pc state name')
@ -285,7 +287,13 @@ class BaseLinuxDevice(Device): # pylint: disable=abstract-method
output = self.execute('mount')
fstab = []
for line in output.split('\n'):
fstab.append(FstabEntry(*line.split()))
match = FSTAB_ENTRY_REGEX.search(line)
if match:
fstab.append(FstabEntry(match.group(1), match.group(2),
match.group(3), match.group(4),
None, None))
else: # assume pre-M Android
fstab.append(FstabEntry(*line.split()))
return fstab
# Process query and control