diff options
author | shakeeb <shakeebbk@in.ibm.com> | 2016-05-18 17:09:07 +0530 |
---|---|---|
committer | Prachi Gupta <pragupta@us.ibm.com> | 2016-06-08 11:45:49 -0500 |
commit | b3ef6ec422344837fdf1f095b816736cefafa242 (patch) | |
tree | 421573c570d95efb322e6598cb47f379093d50e7 /sbe/test | |
parent | affc97abc610165ce0b9c65d190a87fedff40f11 (diff) | |
download | talos-sbe-b3ef6ec422344837fdf1f095b816736cefafa242.tar.gz talos-sbe-b3ef6ec422344837fdf1f095b816736cefafa242.zip |
PSU test framework update
Restructuring of SBE-HOST MBOX interface test framework
Change-Id: Icc24fde4c0ac09ecbe2288f3ac4327b14defe156
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/24702
Tested-by: Jenkins Server
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'sbe/test')
-rw-r--r-- | sbe/test/testExecutorPSU.py | 14 | ||||
-rw-r--r-- | sbe/test/testPSUUserUtil.py (renamed from sbe/test/testClassUtil.py) | 4 | ||||
-rw-r--r-- | sbe/test/testPSUUtil.py (renamed from sbe/test/testClass.py) | 44 |
3 files changed, 36 insertions, 26 deletions
diff --git a/sbe/test/testExecutorPSU.py b/sbe/test/testExecutorPSU.py index 20314792..52846ecb 100644 --- a/sbe/test/testExecutorPSU.py +++ b/sbe/test/testExecutorPSU.py @@ -13,7 +13,7 @@ ############################################################# ''' -import testClass as testObj +import testPSUUtil import testRegistry as reg #------------------------------- @@ -93,19 +93,19 @@ def main(): # Intialize the class obj instances print "\n Initializing Registry instances ...." - regObj = testObj.registry() # Registry obj def for operation + regObj = testPSUUtil.registry() # Registry obj def for operation print "\n Execute SBE Test set [ PSU ] ...\n" - # Sim obj Target Test set - rc_test = regObj.ExecuteTestOp(testObj.simSbeObj,sbe_test_data) - if rc_test != testObj.SUCCESS: + # Sim obj Target Test set Raise Exception + rc_test = regObj.ExecuteTestOp(testPSUUtil.simSbeObj,sbe_test_data, True) + if rc_test != testPSUUtil.SUCCESS: print " SBE Test data set .. [ Failed ] .." else: print " SBE Test data set .. [ OK ] " print "\n Poll on Host side for INTR ...\n" # Sim obj Target Test set Max timedout - rc_intr = regObj.pollingOn(testObj.simSbeObj,host_test_data,20) - if rc_intr == testObj.SUCCESS: + rc_intr = regObj.pollingOn(testPSUUtil.simSbeObj,host_test_data,20) + if rc_intr == testPSUUtil.SUCCESS: print " Interrupt Event Recieved .. Success !!" else: print " Interrupt not Recieved.. Exiting .." diff --git a/sbe/test/testClassUtil.py b/sbe/test/testPSUUserUtil.py index 48e79b80..d2126e56 100644 --- a/sbe/test/testClassUtil.py +++ b/sbe/test/testPSUUserUtil.py @@ -14,7 +14,7 @@ ############################################################# ''' -import testClass as testClass +import testPSUUtil ''' Add your personalize functions here for execution but ensure it returns @@ -32,4 +32,4 @@ either SUCCESS or FAILURE as an end result for generalization purpose. def classUtilFuncSample(i_paramArray): for input in i_paramArray: print " classUtilFuncSample : parm: ",input - return testClass.SUCCESS + return testPSUUtil.SUCCESS diff --git a/sbe/test/testClass.py b/sbe/test/testPSUUtil.py index bdae1df5..a452b5e8 100644 --- a/sbe/test/testClass.py +++ b/sbe/test/testPSUUtil.py @@ -18,7 +18,8 @@ #------------------------- import time import conf -import testClassUtil as util +import testUtil +import testPSUUserUtil from sim_commands import * #------------------------- @@ -219,7 +220,7 @@ class registry(object): # Execute the read or write operation in loop as per # Test data set pre-defined #---------------------------------------------------- - def ExecuteTestOp(self, testOp, test_bucket): + def ExecuteTestOp(self, testOp, test_bucket, raiseException): ''' 3 prong steps : set data, read/write data, validate ''' @@ -257,6 +258,8 @@ class registry(object): if self.validateTestOp(sim_data,l_params[4]) == True: print " Test validated .. [ OK ]" else: + if(raiseException == True): + raise Exception('Data mistmach'); return FAILURE # Failed validation else: print " ++++++++++++++++++++++++++++++++++++++++++" @@ -270,6 +273,9 @@ class registry(object): rc = self.loadFunc( l_params[1], l_params[2] ) return rc else: + print "\n Invalid Test Data" + if(raiseException == True): + raise Exception('Invalid Test Data'); return FAILURE # Unknown entry op print "\n" @@ -316,28 +322,32 @@ class registry(object): return True #---------------------------------------------------- - # A basic loop wait poll mechanism + # A basic loop poll mechanism #---------------------------------------------------- - def pollingOn(self, simObj, test_data, timeOut): - print "\n***** Polling On result for %d seconds " % timeOut - while True: - print "\n" - rc = self.ExecuteTestOp(simObj,test_data) - if rc == SUCCESS: - return rc - elif timeOut <= 0: - print " Timmer Expired... Exiting polling" - break - else: - time.sleep(5) - timeOut = timeOut - 5 + def pollingOn(self, simObj, test_data, retries=20): + for l_param in test_data: + print "\n***** Polling On result - retrials left [%d] " % retries + while True: + print "\n" + testUtil.runCycles( 10000000); + test_d = (l_param,) + rc = self.ExecuteTestOp(simObj, test_d, False) + if rc == SUCCESS: + print ('Polling Successful for - ' + l_param[5]) + break + elif retries <= 0: + print " Retrials exhausted... Exiting polling" + raise Exception('Polling Failed for - ' + l_param[5]); + break + else: + retries = retries - 1 return FAILURE #---------------------------------------------------- # Load the function and execute #---------------------------------------------------- def loadFunc(self, func_name, i_pArray ): - rc = util.__getattribute__(func_name)(i_pArray) + rc = testPSUUserUtil.__getattribute__(func_name)(i_pArray) return rc # Either success or failure from func |