37
37
import difflib
38
38
39
39
import OpTestConfiguration
40
+ from common .Exceptions import CommandFailed
41
+ from common .OpTestError import OpTestError
40
42
from common .OpTestSystem import OpSystemState
41
43
from common .OpTestConstants import OpTestConstants as BMC_CONST
42
44
import common .OpTestQemu as OpTestQemu
@@ -61,6 +63,7 @@ def setUp(self):
61
63
self .cv_HOST = conf .host ()
62
64
self .cv_IPMI = conf .ipmi ()
63
65
self .cv_SYSTEM = conf .system ()
66
+ self .bmc_type = conf .args .bmc_type
64
67
self .node = "/proc/device-tree/ibm,opal/"
65
68
66
69
# Checks for monotonocity/strictly increase/decrease of values
@@ -235,6 +238,28 @@ def validate_pstate_properties(self):
235
238
self .assertTrue (self .strictly_increasing (pstate_ids ),
236
239
"Non monotonocity observed for pstate ids" )
237
240
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
+
238
263
def check_dt_matches (self ):
239
264
# allows the ability to filter for debug
240
265
# skip the parent(s) in the hierarchy
@@ -390,6 +415,7 @@ def runTest(self):
390
415
self .cv_HOST .host_get_proc_gen (console = 1 )
391
416
self .validate_idle_state_properties ()
392
417
self .validate_pstate_properties ()
418
+ self .validate_firmware_version ()
393
419
394
420
# Validate ibm,opal node DT content at skiroot against host
395
421
# We can extend for other nodes as well, which are suspicieous.
@@ -416,6 +442,7 @@ def runTest(self):
416
442
self .cv_HOST .host_get_proc_gen (console = 1 )
417
443
self .validate_idle_state_properties ()
418
444
self .validate_pstate_properties ()
445
+ self .validate_firmware_version ()
419
446
420
447
props = self .c .run_command ("find %s -type d" % self .node )
421
448
for prop in props :
0 commit comments