diff options
author | Shakeeb <shakeebbk@in.ibm.com> | 2016-10-21 05:02:09 -0500 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2016-11-14 03:39:52 -0500 |
commit | 29a0cc1e3a5e493cd600ac1924380371d151e82b (patch) | |
tree | 6362565e2e79bee427fc1dcca567dfbd003e6c4c /src/test/testcases | |
parent | 77174dca7c6f715a1f0f11049466bc7beff4b049 (diff) | |
download | talos-sbe-29a0cc1e3a5e493cd600ac1924380371d151e82b.tar.gz talos-sbe-29a0cc1e3a5e493cd600ac1924380371d151e82b.zip |
Enhance sbe-istep command to take ranges
Signature of command remains the same
Ex1: sb-istep 2 2 -> will run only istep 2.2
Ex2: sb-istep 2.3 4.5 -> will run all the SBE isteps from 2.3 to 4.5
Change-Id: I7ede7a295485bcf209916c0a05798bfb5173996b
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31611
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/test/testcases')
-rwxr-xr-x | src/test/testcases/testIstepAuto.py | 84 |
1 files changed, 66 insertions, 18 deletions
diff --git a/src/test/testcases/testIstepAuto.py b/src/test/testcases/testIstepAuto.py index 8771c657..367dd113 100755 --- a/src/test/testcases/testIstepAuto.py +++ b/src/test/testcases/testIstepAuto.py @@ -23,6 +23,7 @@ # # IBM_PROLOG_END_TAG import sys +import copy from sim_commands import * import imp err = False @@ -30,26 +31,73 @@ testUtil = imp.load_source("testUtil", os.environ['SBE_TOOLS_PATH'] + "/testUtil EXPDATA = [0xc0,0xde,0xa1,0x01, 0x0,0x0,0x0,0x0, 0x00,0x0,0x0,0x03]; +gIstepArray = [ + [0, 0], #istep 0 --> invalid + [0, 0], #istep 1 --> invalid + [2, 17],#istep 2.2 to 2.17 + [1, 22],#istep 3.1 to 3.22 + [1, 34],#istep 4.1 to 4.34 + [1, 2] #istep 5.1 to 5.2 + ] # MAIN Test Run Starts Here... #------------------------------------------------- -def sbe_istep_func( major, minor ): - try: - TESTDATA = [0,0,0,3, - 0,0,0xA1,0x01, - 0,major,0,minor ] - testUtil.runCycles( 10000000 ) - testUtil.writeUsFifo( TESTDATA ) - testUtil.writeEot( ) - testUtil.readDsFifo( EXPDATA ) - testUtil.readEot( ) - except: - print ("\nTest completed with error(s). Raise error") - # TODO via RTC 142706 - # Currently simics commands created using hooks always return - # success. Need to check from simics command a way to return - # Calling non existant command to return failure - run_command("Command Failed"); - raise +def sbe_istep_func( inum1, inum2): + # Convert float number to string, which would help extracting + # decimal and integral part separately + # Interpretation: + # (Single iStep) inum1=2 inum2=2 => startMajor = 2; startMinor = 2; + # endMajor = 0; endMinor = 0; + # (Range of iSteps) inum1=2.3 inum2=3.7 => startMajor = 2; startMinor = 3; + # endMajor = 3; endMinor = 7; + istr1 = str(inum1) + istr2 = str(inum2) + startMajor = 0 + startMinor = 0 + endMajor = 0 + endMinor = 0 + startMajor = int(istr1.split('.')[0]) + # Check for single istep condition, where inum1=x.0 and inum2=x.0 + # If not extract the start and end isteps range + if(int(istr1.split('.')[1]) != 0): + startMinor = int(istr1.split('.')[1]) + if(int(istr2.split('.')[1]) != 0): + endMajor = int(istr2.split('.')[0]) + endMinor = int(istr2.split('.')[1]) + else: + startMinor = int(istr2.split('.')[0]) + + # Make sure array is a deep copy, + # as we are modifying and setting up the local array + # based on ranges requested + lIstepArray = copy.deepcopy(gIstepArray) + lIstepArray[startMajor][0] = startMinor + if endMajor != 0: + lIstepArray[endMajor][1] = endMinor + else: + endMajor = startMajor + lIstepArray[startMajor][1] = lIstepArray[startMajor][0] + for major in range(startMajor, endMajor+1): + for minor in range(lIstepArray[major][0], lIstepArray[major][1] + 1): + print "Running:"+str(major)+"."+str(minor) + + try: + TESTDATA = [0,0,0,3, + 0,0,0xA1,0x01, + 0,major,0,minor ] + testUtil.runCycles( 10000000 ) + testUtil.writeUsFifo( TESTDATA ) + testUtil.writeEot( ) + testUtil.readDsFifo( EXPDATA ) + testUtil.readEot( ) + + except: + print ("\nTest completed with error(s). Raise error") + # TODO via RTC 142706 + # Currently simics commands created using hooks always return + # success. Need to check from simics command a way to return + # Calling non existant command to return failure + run_command("Command Failed"); + raise print ("\nTest completed with no errors") #sys.exit(0); |