1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

module/sched: Harden probe()

Running some tests on a VM I hit that unexpected scenario where the
required sched_domain file is there but then read_tree_values() fails
because there are no files to read, only directories.

This does a quick check that there's actual data to be read.
This commit is contained in:
Valentin Schneider 2018-11-01 16:13:28 +00:00 committed by Marc Bonnici
parent da3afeba2e
commit 74444210e7

View File

@ -195,7 +195,19 @@ class SchedProcFSData(SchedProcFSNode):
@staticmethod
def available(target):
return target.directory_exists(SchedProcFSData.sched_domain_root)
path = SchedProcFSData.sched_domain_root
cpus = target.list_directory(path) if target.file_exists(path) else []
if not cpus:
return False
# Even if we have a CPU entry, it can be empty (e.g. hotplugged out)
# Make sure some data is there
for cpu in cpus:
if target.file_exists(target.path.join(path, cpu, "domain0", "name")):
return True
return False
def __init__(self, target, path=None):
if not path: