Multiple changes to support functions.
lib/dvt/obmc_call_points.robot
- Deleting this file. I don't really see a need for it.
lib/gen_print.py
- I added code to convert local copy of GEN_PRINT_DEBUG to int.
lib/gen_robot_print.py
- I added code to convert local copy of GEN_ROBOT_PRINT_DEBUG to int.
- I added import of DotDict and collections. I added code to define shortcuts
for debug and quiet versions (e.g. rdpvars, rqpvars).
bin/process_plug_in_packages.py
- Change from using dissuing to dpissuing to coincide with changes in
gen_robot_print.py
- Shift 'Starting plug-in' output 1 char to the right to align better with
time stamp output.
lib/rest_client.robot
- I added support for a quiet parm to the following keywords:
- OpenBMC Get Request
- OpenBMC Post Request
- Read Attribute
- Call Method
- I cleaned up excessive spaces (e.g. 4 where 2 will do).
- I changed " =" to "=" for consistency (e.g. "${data} =" to "${data}=").
lib/utils.robot
- I cleaned up some lines exceeding 79 chars.
- I cleaned up excessive spaces (e.g. 4 where 2 will do).
- I changed " =" to "=" for consistency (e.g. "${data} =" to "${data}=").
- I added support for a quiet parm to the following keywords:
- Get Boot Progress
- Check OS
- Wait for OS
- Get BMC State
- Get Power State
- This quiet parm may contribute to resolving the following issue:
https://github.com/openbmc/openbmc-test-automation/issues/162
- I added support for a wait parm to "Initiate Power On". It defaults to ${1}
to preserve traditional behavior. I have calls to this keyword that only
want it to "Initiate Power On" and that's it. No waiting for anything.
- I added support for print_string parm to Check OS.
- I improved the error output for "Check OS".
- I improved the output for "Wait for OS"
lib/dvt/obmc_driver_vars.txt
- Changed all "IPL" to "BOOT". "IPL" is an IBM term. This file only used by
obmc_boot_test.robot so change is safe.
Change-Id: I9a410b17b5ec4ffb0c8998cb6b8763c41cfd2655
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_robot_print.py b/lib/gen_robot_print.py
index 8fdd7d0..7c48912 100755
--- a/lib/gen_robot_print.py
+++ b/lib/gen_robot_print.py
@@ -8,6 +8,11 @@
import re
import os
+try:
+ from robot.utils import DotDict as my_ord_dict
+except ImportError:
+ from collections import OrderedDict as my_ord_dict
+
import gen_print as gp
from robot.libraries.BuiltIn import BuiltIn
@@ -17,7 +22,7 @@
try:
# The user can set environment variable "GEN_ROBOT_PRINT_DEBUG" to get
# debug output from this module.
- gen_robot_print_debug = os.environ['GEN_ROBOT_PRINT_DEBUG']
+ gen_robot_print_debug = int(os.environ['GEN_ROBOT_PRINT_DEBUG'])
except KeyError:
gen_robot_print_debug = 0
@@ -180,6 +185,9 @@
buffer += sprint_vars(str(indent), str(loc_col1_width), *parm_list)
buffer += "\n"
+ # Setting global program_pid.
+ BuiltIn().set_global_variable("${program_pid}", os.getpid())
+
return buffer
###############################################################################
@@ -309,6 +317,14 @@
'print_issuing_keyword', 'print_vars', 'print_auto_vars'
]
func_names = gp.func_names + robot_func_names
+
+func_names = list(my_ord_dict.fromkeys(func_names))
+
+if gen_robot_print_debug:
+ rprintn()
+ BuiltIn().log_to_console(gp.sprint_var(func_names), no_newline=True)
+ rprintn()
+
for func_name in func_names:
# The print_var function's job is to figure out the name of arg 1 and
# then call print_varx. This is not currently supported for robot
@@ -332,6 +348,7 @@
pgm_definition_string = '\n'.join(func_def)
if gen_robot_print_debug:
+ rprintn()
rprintn(pgm_definition_string)
exec(pgm_definition_string)
@@ -375,17 +392,20 @@
rprintn(pgm_definition_string)
exec(pgm_definition_string)
- # Create abbreviated aliases (e.g. rpvarx is an alias for rprint_varx).
+ prefixes = ["", "q", "d"]
alias = re.sub("print_", "p", func_name)
- cmd_buf = robot_prefix + alias + " = " + robot_prefix + func_name
- if gen_robot_print_debug:
- rprintn(cmd_buf)
- exec(cmd_buf)
+ for prefix2 in prefixes:
+ cmd_buf = robot_prefix + prefix2 + alias + " = " + robot_prefix +\
+ prefix2 + func_name
+ if gen_robot_print_debug:
+ rprintn(cmd_buf)
+ exec(cmd_buf)
# Define an alias. rpvar is just a special case of rpvars where the args
# list contains only one element.
cmd_buf = "rpvar = rpvars"
if gen_robot_print_debug:
+ rprintn()
rprintn(cmd_buf)
exec(cmd_buf)