@@ -441,18 +441,22 @@ def test_lparstat(self):
441441 output = process .system_output ("grep security /proc/powerpc/lparcfg"
442442 ).decode ("utf-8" )
443443 security_flavor = output .split ("=" )[1 ]
444+ '''Multiple tests are there for lparstat, to continue the execution
445+ of whole code we can capture the error message and use that for fail
446+ condition at the end of code.'''
447+ error_messages = []
444448 if value == security_flavor :
445449 self .log .info ("Lpar security flavor is correct" )
446450 else :
447- self . fail ("Lpar security flavor is incorrect" )
451+ error_messages . append ("Lpar security flavor is incorrect" )
448452 lists = self .params .get ('lparstat_nlist' ,
449453 default = ['--nonexistingoption' ])
450454 for list_item in lists :
451455 cmd = "lparstat %s" % list_item
452456 if not process .system (cmd , ignore_status = True , sudo = True ):
453457 self .log .info ("%s command passed" % cmd )
454- self . fail ("lparstat: Expected failure, %s command executed \
455- successfully." % cmd )
458+ error_messages . append ("lparstat: Expected failure, %s command \
459+ executed successfully." % cmd )
456460 output = process .system_output ("lparstat -E 1 1" ).decode ("utf-8" )
457461 for line in output .splitlines ():
458462 if 'GHz' in line :
@@ -471,13 +475,15 @@ def test_lparstat(self):
471475 if (actual_busy > 0 ) and (actual_idle < 100 ):
472476 self .log .info ("Busy and idle actual values are correct" )
473477 else :
474- self .fail ("Busy and idle actual values are incorrect" )
478+ error_messages .append ("Busy and idle actual values are incorrect" )
479+
475480 if normal == freq_percentile :
476481 self .log .info ("Normalised busy plus idle value match with \
477482 Frequency percentage" )
478483 else :
479- self .fail ("Normalised busy plus idle value does not match \
480- with Frequency percentage" )
484+ error_messages .append ("Normalised busy plus idle value \
485+ does not match with Frequency percentage" )
486+
481487 list_physc = []
482488 for i in [2 , 4 , 8 , "off" ]:
483489 self .run_cmd ("ppc64_cpu --smt=%s" % i )
@@ -492,12 +498,18 @@ def test_lparstat(self):
492498 matches = re .findall (pattern , last_line )
493499 physc_val = float (matches [4 ])
494500 list_physc .append (physc_val )
501+
495502 if len (set (list_physc )) == 1 :
496503 self .log .info ("Correctly displaying the number of physical \
497504 processors consumed" )
498505 else :
499- self .fail ("number of physical processors consumed are not \
500- displaying correct" )
506+ error_messages .append ("number of physical processors consumed \
507+ are not displaying correct" )
508+
509+ if len (error_messages ) != 0 :
510+ self .fail (error_messages )
511+ else :
512+ self .log .info ("no failures in lparstat command" )
501513
502514 @skipIf (IS_POWER_NV or IS_KVM_GUEST ,
503515 "This test is not supported on KVM guest or PowerNV platform" )
0 commit comments