From 29a0cc1e3a5e493cd600ac1924380371d151e82b Mon Sep 17 00:00:00 2001 From: Shakeeb Date: Fri, 21 Oct 2016 05:02:09 -0500 Subject: 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 Tested-by: FSP CI Jenkins Reviewed-by: Sachin Gupta --- src/test/testcases/testIstepAuto.py | 84 ++++++++++++++++++++++++------- src/tools/debug/simics-debug-framework.py | 2 +- 2 files changed, 67 insertions(+), 19 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); diff --git a/src/tools/debug/simics-debug-framework.py b/src/tools/debug/simics-debug-framework.py index 4b2538cc..a5f7df67 100755 --- a/src/tools/debug/simics-debug-framework.py +++ b/src/tools/debug/simics-debug-framework.py @@ -44,7 +44,7 @@ def register_sbe_debug_framework_tools(): fillSymTable() # Create command hook. new_command("sbe-istep",testIstepAuto.sbe_istep_func, - args = [arg(int_t, "major"), arg(int_t, "minor")], + args = [arg(float_t, "Major/start istep"), arg(float_t, "Minor/end istep")], alias = "istep", type = ["sbe-commands"], short = "Runs the debug framework for istep ", -- cgit v1.2.1