Skip to content

Commit 84bf8ae

Browse files
Vasant Hegdesammj
Vasant Hegde
authored andcommitted
DeviceTreeValidation: Add test case to validate ibm,firmware-versions node
Validate various firmware components. Signed-off-by: Vasant Hegde <[email protected]>
1 parent 019194a commit 84bf8ae

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

testcases/DeviceTreeValidation.py

+27
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
import difflib
3838

3939
import OpTestConfiguration
40+
from common.Exceptions import CommandFailed
41+
from common.OpTestError import OpTestError
4042
from common.OpTestSystem import OpSystemState
4143
from common.OpTestConstants import OpTestConstants as BMC_CONST
4244
import common.OpTestQemu as OpTestQemu
@@ -61,6 +63,7 @@ def setUp(self):
6163
self.cv_HOST = conf.host()
6264
self.cv_IPMI = conf.ipmi()
6365
self.cv_SYSTEM = conf.system()
66+
self.bmc_type = conf.args.bmc_type
6467
self.node = "/proc/device-tree/ibm,opal/"
6568

6669
# Checks for monotonocity/strictly increase/decrease of values
@@ -235,6 +238,28 @@ def validate_pstate_properties(self):
235238
self.assertTrue(self.strictly_increasing(pstate_ids),
236239
"Non monotonocity observed for pstate ids")
237240

241+
def validate_firmware_version(self):
242+
fw_node = "/proc/device-tree/ibm,firmware-versions/"
243+
# Validate firmware version properties
244+
if self.bmc_type not in ['OpenBMC', 'SMC', 'AMI']:
245+
self.skipTest("ibm,firmware-versions DT node not available on this system")
246+
247+
if self.cv_HOST.host_get_proc_gen() not in ["POWER8", "POWER8E"]:
248+
try:
249+
self.c.run_command("ls --color=never %s/version" % fw_node)
250+
version = self.dt_prop_read_str_arr("ibm,firmware-versions/version")
251+
if not version:
252+
raise OpTestError("DT: Firmware version property is empty")
253+
except CommandFailed:
254+
raise OpTestError("DT: Firmware version property is missing")
255+
256+
props = self.c.run_command("find %s -type f" % fw_node)
257+
for prop in props:
258+
val = self.c.run_command("lsprop %s" % prop)
259+
if not val:
260+
raise OpTestError("DT: Firmware component (%s) is empty" % prop)
261+
262+
238263
def check_dt_matches(self):
239264
# allows the ability to filter for debug
240265
# skip the parent(s) in the hierarchy
@@ -390,6 +415,7 @@ def runTest(self):
390415
self.cv_HOST.host_get_proc_gen(console=1)
391416
self.validate_idle_state_properties()
392417
self.validate_pstate_properties()
418+
self.validate_firmware_version()
393419

394420
# Validate ibm,opal node DT content at skiroot against host
395421
# We can extend for other nodes as well, which are suspicieous.
@@ -416,6 +442,7 @@ def runTest(self):
416442
self.cv_HOST.host_get_proc_gen(console=1)
417443
self.validate_idle_state_properties()
418444
self.validate_pstate_properties()
445+
self.validate_firmware_version()
419446

420447
props = self.c.run_command("find %s -type d" % self.node)
421448
for prop in props:

0 commit comments

Comments
 (0)