Skip to content

Commit 9661c6b

Browse files
douglas-raillard-armmarcbonnici
authored andcommitted
target: Handle non-existing /sys/devices/system/node
Some systems (ARM 32bits it seems) don't have this file in sysfs. Assume 1 node in that case.
1 parent 0aeb5bc commit 9661c6b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

devlib/target.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,14 +167,18 @@ def number_of_cpus(self):
167167
@property
168168
@memoized
169169
def number_of_nodes(self):
170-
num_nodes = 0
171-
nodere = re.compile(r'^\./node\d+\s*$')
172170
cmd = 'cd /sys/devices/system/node && {busybox} find . -maxdepth 1'.format(busybox=quote(self.busybox))
173-
output = self.execute(cmd, as_root=self.is_rooted)
174-
for entry in output.splitlines():
175-
if nodere.match(entry):
176-
num_nodes += 1
177-
return num_nodes
171+
try:
172+
output = self.execute(cmd, as_root=self.is_rooted)
173+
except TargetStableError:
174+
return 1
175+
else:
176+
nodere = re.compile(r'^\./node\d+\s*$')
177+
num_nodes = 0
178+
for entry in output.splitlines():
179+
if nodere.match(entry):
180+
num_nodes += 1
181+
return num_nodes
178182

179183
@property
180184
@memoized

0 commit comments

Comments
 (0)