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

target: Use root if available when determine number of cpus

On some targets some entries in `/sys/devices/system/cpu` require root
to list otherwise will return a permission error.
This commit is contained in:
Marc Bonnici 2019-05-24 11:15:46 +01:00 committed by setrofim
parent b5f36610ad
commit ae7f01fd19

View File

@ -155,7 +155,7 @@ class Target(object):
def number_of_cpus(self):
num_cpus = 0
corere = re.compile(r'^\s*cpu\d+\s*$')
output = self.execute('ls /sys/devices/system/cpu')
output = self.execute('ls /sys/devices/system/cpu', as_root=self.is_rooted)
for entry in output.split():
if corere.match(entry):
num_cpus += 1