Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit db96848

Browse files
committedMar 27, 2019
OpTestSystem: Add state names for readability
For consumers of the debug files add the state names to aide in debug log analysis. Signed-off-by: Deb McLemore <debmc@linux.ibm.com>
1 parent 84bf8ae commit db96848

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
 

‎common/OpTestSystem.py

+19
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ class OpSystemState():
6969
POWERING_OFF = 7
7070
UNKNOWN_BAD = 8 # special case, use set_state to place system in hold for later goto
7171

72+
table_strings = {'UNKNOWN' : UNKNOWN,
73+
'OFF' : OFF,
74+
'IPLing' : IPLing,
75+
'PETITBOOT' : PETITBOOT,
76+
'PETITBOOT_SHELL' : PETITBOOT_SHELL,
77+
'BOOTING' : BOOTING,
78+
'OS' : OS,
79+
'POWERING_OFF' : POWERING_OFF,
80+
'UNKNOWN_BAD' : UNKNOWN_BAD,
81+
}
82+
table_string = ""
83+
for i in sorted(table_strings.values()):
84+
table_string = table_string + table_strings.keys()[table_strings.values().index(i)] + "=" + str(i) + " "
85+
7286
class OpTestSystem(object):
7387

7488
## Initialize this object
@@ -350,10 +364,12 @@ def goto_state(self, state):
350364
raise unittest.SkipTest("OpTestSystem running QEMU/Mambo so skipping OpSystemState.OS test")
351365
if (self.state == OpSystemState.UNKNOWN):
352366
log.debug("OpTestSystem CHECKING CURRENT STATE and TRANSITIONING for TARGET STATE: %s" % (state))
367+
log.debug(" *** {}".format(OpSystemState.table_string))
353368
self.state = self.run_DETECT(state)
354369
log.debug("OpTestSystem CURRENT DETECTED STATE: %s" % (self.state))
355370

356371
log.debug("OpTestSystem START STATE: %s (target %s)" % (self.state, state))
372+
log.debug(" *** {}".format(OpSystemState.table_string))
357373
never_unknown = False
358374
while 1:
359375
if self.stop == 1:
@@ -368,6 +384,7 @@ def goto_state(self, state):
368384
self.util.clear_state(self)
369385
self.previous_state = self.state
370386
log.debug("OpTestSystem TRANSITIONED TO: %s" % (self.state))
387+
log.debug(" *** {}".format(OpSystemState.table_string))
371388
if self.state == state:
372389
break;
373390
if never_unknown and self.state == OpSystemState.UNKNOWN:
@@ -536,12 +553,14 @@ def wait_for_it(self, **kwargs):
536553
else:
537554
x += 1
538555
log.debug("\n *** WaitForIt CURRENT STATE \"{:02}\" TARGET STATE \"{:02}\"\n"
556+
" *** {}\n"
539557
" *** WaitForIt working on transition\n"
540558
" *** Expect Buffer ID={}\n"
541559
" *** Current loop iteration \"{:02}\" - Reconnect attempts \"{:02}\" - loop_max \"{:02}\"\n"
542560
" *** WaitForIt timeout interval \"{:02}\" seconds - Stale buffer check every \"{:02}\" times\n"
543561
" *** WaitForIt variables \"{}\"\n"
544562
" *** WaitForIt Refresh=\"{}\" Buffer Kicker=\"{}\" - Kill Cord=\"{:02}\"\n".format(self.state, self.target_state,
563+
OpSystemState.table_string,
545564
hex(id(sys_pty)), x, reconnect_count, kwargs['loop_max'], kwargs['timeout'], kwargs['threshold'],
546565
sorted(kwargs['expect_dict'].keys()), kwargs['refresh'], kwargs['buffer_kicker'], self.kill_cord))
547566
if (x >= kwargs['loop_max']):

0 commit comments

Comments
 (0)
Please sign in to comment.