Closed mmajdoubi closed 9 years ago
Hello, you are right, the PROPERTIES variable is indeed not injected in TCL and PERL tests. I will find a method to fix it, your code seems a good place to start. Thank you !!
Hello,
This code should fix this quickly, in RunnerClasses.py, if you feel adventurous :)
Put this instead of your code self.tcl.setvar('PROPERTIES', globs['PROPERTIES'])
# Set properties Associative Array
for k, v in globs['PROPERTIES'].iteritems():
self.tcl.eval('set PROPERTIES({}) {}'.format(k, v))
Then, in the Tcl test, use like this:
puts "\nProperties::"
foreach i [array names PROPERTIES] {
puts "PROPERTIES($i) = $PROPERTIES($i)"
}
I will submit this and it will be pushed on Github with the next batch of fixes. Thank you.
I changed RunnerClaases.py with the proposed TCL code change, it's working as expected. BTW The Perl Properties code change is also working, many thanks !
I find a way how to make PROPERTIES dictionary accessible for TCL scripts, the PROTERTIES variable reference/injection is missing RunnerClasses.py for TCL scripts. Below you can find the change that I did perform to make it operational:
Client/executionprocess/RunnerClasses.py (add PROPERTIES reference)
Inject variables
How to make use of PROPERTIES dictionary in any TCL testcase
package require Tclx package require json #step1: Define PROPERTIES variable according to JSON format, replace single quotes with double ones set PROPERTIES_JSON [string map {\' \"} $PROPERTIES] #step2: Convert JSON to dictionary format set PROPERTIES_DICT [::json::json2dict $PROPERTIES_JSON] #step3: make use of all PROPERTIES by using dict get methode set MTU [dict get $PROPERTIES_DICT MTU]
Could you please review the change above, I classified it a workaround? I hope that you have another way how to make PROPERTIES accessible for TCL testcases/scripts
Thanks in advance