-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpTestSystem: Add state names for readability #380
base: master
Are you sure you want to change the base?
Conversation
common/OpTestSystem.py
Outdated
@@ -328,10 +328,12 @@ def goto_state(self, state): | |||
raise unittest.SkipTest("OpTestSystem running QEMU/Mambo so skipping OpSystemState.OS test") | |||
if (self.state == OpSystemState.UNKNOWN): | |||
log.debug("OpTestSystem CHECKING CURRENT STATE and TRANSITIONING for TARGET STATE: %s" % (state)) | |||
log.debug(" *** UNKNOWN=0 OFF=1 IPLing=2 PETITBOOT=3 PETITBOOT_SHELL=4 BOOTING=5 OS=6 POWERING_OFF=7 UNKNOWN_BAD=8") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we instead have a little helper that turns state numbers into strings and do
log.debug("OpTestSystem CHECKING CURRENT STATE and TRANSITIONING for TARGET STATE: {} ({})".format(state, state_name(state))
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a little helper
I thought about that as well, but in some places it just says "CURRENT DETECTED STATE=xx" and for the consumer that is not familiar doesn't know the entire table so it is not quite as meaningful, so I thought the entire state machine would help level set the terminology.
Sam Mendoza-Jonas <[email protected]> writes:
sammj commented on this pull request.
> @@ -328,10 +328,12 @@ def goto_state(self, state):
raise unittest.SkipTest("OpTestSystem running QEMU/Mambo so skipping OpSystemState.OS test")
if (self.state == OpSystemState.UNKNOWN):
log.debug("OpTestSystem CHECKING CURRENT STATE and TRANSITIONING for TARGET STATE: %s" % (state))
+ log.debug(" *** UNKNOWN=0 OFF=1 IPLing=2 PETITBOOT=3 PETITBOOT_SHELL=4 BOOTING=5 OS=6 POWERING_OFF=7 UNKNOWN_BAD=8")
Could we instead have a little helper that turns state numbers into strings and do
`log.debug("OpTestSystem CHECKING CURRENT STATE and TRANSITIONING for TARGET STATE: {} ({})".format(state, state_name(state))`?
We should be able to do that by using the object-as-an-enum trick and
having a __str__ method in it.
…--
Stewart Smith
OPAL Architect, IBM.
|
I think I have a combo solution, alternative suggestions welcomed ! |
9f82e1b
to
b5d5201
Compare
cd98861
to
6252e4f
Compare
73bddc3
to
dc465ed
Compare
For consumers of the debug files add the state names to aide in debug log analysis. Signed-off-by: Deb McLemore <[email protected]>
comedy option:
Whenever we print the state we'd get the string name, but in most situations it's treated as an integer would be. We might be better off using the enum class rather though. |
4d0cb14
to
b976629
Compare
For consumers of the debug files add the state names
to aide in debug log analysis.
Signed-off-by: Deb McLemore [email protected]