diff options
author | spashabk-in <shakeebbk@in.ibm.com> | 2016-12-01 04:38:45 -0600 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2017-01-19 01:09:35 -0500 |
commit | f7622cfdaafd77c57b93ade0d144c623eaec043f (patch) | |
tree | 5b8d535236619422400b9c3d4045e58c75e5ae31 /src/tools | |
parent | 58ca2d13fcdde12e57950fbd1254070a7f107fd7 (diff) | |
download | talos-sbe-f7622cfdaafd77c57b93ade0d144c623eaec043f.tar.gz talos-sbe-f7622cfdaafd77c57b93ade0d144c623eaec043f.zip |
Saving existing Cronus FIFO state in sbe-debug.py
Change-Id: Ice8801e36f563ba0565b13e55b2b83a11a834d90
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33234
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/tools')
-rwxr-xr-x | src/tools/debug/sbe-debug.py | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/src/tools/debug/sbe-debug.py b/src/tools/debug/sbe-debug.py index 43dce05a..c944548d 100755 --- a/src/tools/debug/sbe-debug.py +++ b/src/tools/debug/sbe-debug.py @@ -218,7 +218,7 @@ def main( argv ): except getopt.GetoptError as err: print str(err) usage() - exit_main(errorcode.ERROR_EXIT) + exit(1) # Default values level = 'trace' @@ -230,35 +230,42 @@ def main( argv ): for opt, arg in opts: if opt in ('-h', '--help'): usage() - exit_main(errorcode.HELP_EXIT) + exit(1) elif opt in ('-l', '--level'): if arg in ('trace','attr','ppestate','sbestate','sbestatus'): level = arg else: print "level should be one of {trace,attr,ppestate,sbestate,sbestatus}" - exit_main(errorcode.ERROR_EXIT) + exit(1) elif opt in ('-t', '--target'): if arg in ('AWAN', 'HW', 'FILE'): target = arg else: print "target should be one of {AWAN,HW,FILE}" - exit_main(errorcode.ERROR_EXIT) + exit(1) elif opt in ('-n', '--node'): try: node = int(arg) except: print "node should be an integer number" - exit_main(errorcode.ERROR_EXIT) + exit(1) elif opt in ('-p', '--proc'): try: proc = int(arg) except: print "proc should be an integer number" - exit_main(errorcode.ERROR_EXIT) - + exit(1) + + # On cronus, save the existing FIFO mode + cmdFifoLastState = subprocess.Popen(['getconfig','USE_SBE_FIFO'], stdout=subprocess.PIPE).communicate()[0] + # Example output: 'CNFG FILE GLOBAL_DEBUG: 8.VI.B\n\tk0 \nUSE_SBE_FIFO = off\n/afs/awd.austin.ibm.com/projects/eng/tools/cronus/p9/exe/dev/p9sim_dev_x86_64.exe getconfig USE_SBE_FIFO \n' + regEx = re.search('USE_SBE_FIFO.*=(.*)', cmdFifoLastState) + if (regEx == None): + print "ERROR in getting USE_SBE_FIFO config" + return 1 + cmdFifoLastState = regEx.group(1).split()[0] # On cronus, disabe FIFO mode cmdFifoOff = "setconfig USE_SBE_FIFO off" - cmdFifoOn = "setconfig USE_SBE_FIFO on" rc = os.system( cmdFifoOff ) if ( rc ): print "ERROR running %s: %d " % ( cmdFifoOff, rc ) @@ -283,10 +290,11 @@ def main( argv ): elif ( level == 'sbestatus' ): sbeStatus( node, proc ) - # On cronus, Enable FIFO mode - rc = os.system( cmdFifoOn ) + # On cronus, set the FIFO mode to previous state + cmdFifoLastState = "setconfig USE_SBE_FIFO " + cmdFifoLastState + rc = os.system( cmdFifoLastState ) if ( rc ): - print "ERROR running %s: %d " % ( cmdFifoOn, rc ) + print "ERROR running %s: %d " % ( cmdFifoLastState, rc ) return 1 |