ProcZoneInfoTest.py: fix the check for unpopulated nodes
There might be more than one unpopulated nodes displayed in /proc/zoneinfo,
and there is the case that the unpopulated node is not the last node in /proc/zoneinfo.
This change is to fix problem for such cases.
Test: run vts-kernel -m KernelProcFileApiTest -t KernelProcFileApiTest.testProcZoneInfoTest manually on HiKey and X15 boards
Bug: 111215978
Change-Id: Iab7903571525c21ed27788779520319e8ed61fef
Merged-In: Iab7903571525c21ed27788779520319e8ed61fef
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
diff --git a/api/proc/ProcZoneInfoTest.py b/api/proc/ProcZoneInfoTest.py
index 4062f37..dda233d 100644
--- a/api/proc/ProcZoneInfoTest.py
+++ b/api/proc/ProcZoneInfoTest.py
@@ -36,7 +36,7 @@
t_ignore = ' '
- start = 'newnode'
+ start = 'nodes'
p_nodes = repeat_rule('node')
p_lines = repeat_rule('line')
@@ -44,22 +44,20 @@
p_colonlines = repeat_rule('colonline')
p_numcommas = repeat_rule('numcomma')
- def p_newnode(self, p):
- 'newnode : nodes unpopulated'
- p[0] = p[1:]
-
def p_node(self, p):
- '''node : heading pernode APAGES lines protection PAGESETS NEWLINE cpus colonlines
- | heading pernode APAGES lines protection lines PAGESETS NEWLINE cpus colonlines'''
- if len(p) == 11:
- p[0] = [p[1], p[3], p[4] + p[6], p[8], p[9]]
- else:
- p[0] = [p[1], p[3], p[4], p[7], p[8]]
+ '''node : heading pernode APAGES lines protection populated'''
+ p[0] = [p[1], p[2], p[4], p[5], p[6]]
- def p_unpopulated(self, p):
- '''unpopulated : heading pernode APAGES lines protection
- | empty'''
- p[0] = [] if len(p) == 2 else [p[1], p[3], p[4]]
+ def p_populated(self, p):
+ '''populated : PAGESETS NEWLINE cpus colonlines
+ | lines PAGESETS NEWLINE cpus colonlines
+ | empty'''
+ if len(p) == 2:
+ p[0] = []
+ elif len(p) == 6:
+ p[0] = [p[1], p[4], p[5]]
+ else:
+ p[0] = [p[3], p[4]]
def p_pernode(self, p):
'''pernode : PERNODE STATS NEWLINE lines