Prathibha Narasimha Iyengar

Passing variables across TCL Scripts

Discussion created by Prathibha Narasimha Iyengar on May 26, 2009
Latest reply on Jun 16, 2009 by CrasyCat
We are working on an Embedded system designed with a MC56F8335 as the core processor. The software for the system is built using the Metrowerks CodeWarrior IDE (Version - The need of the project is to automate the testing of this software through scripts. We have referred to CodeWarrior™Development Tools IDE 5.5/5.7 Automation Guide for the same.
Actions and Observations:
1.TCL Test Scripts are written, executed and are found to be working as expected.
2. A call and execution of one Test Script from another is also tested and found working. Example – when a Test Script 1.TCL is being executed with a Script to call and execute Test Script 2.TCL, it does the necessary action.
1. Is it possible to pass the value of variable from the calling Script to the Script being called? With reference to the examples below, is it possible to PASS and use the values of X1,X2 evaluated in 1.TCL in Script 2.TCL

Here is the content of calling Test Script - 1.TCL
while {$i 5} {;#Set the breakpoint at the entry point of the MCONTROL_ManageHallMode() function.
puts "Iteration number $i"
bp MCONTROL_ManageHallMode

;#Get the current value of MotorState.
set X1 [evaluate MotorState]

;#Let the code execute by clearing the MCONTROL_ManageHallMode() function entrypoint breakpoint.
;#Set the breakpoint at the end of MCONTROL_ManageHallMode() function.
bp MCONTROL_ManageHallMode off
bp BACKGROUND.c 156 6

;#Verify the value of MotorState at the end of the MCONTROL_ManageHallMode() function.
set X2 [evaluate MotorState]
source "D:/Prathibha/Projects/Motor Controller/BLMC/WIP/V&V/2.tcl"

Here is the content of called Test Script - 2.TCL
;#Clear all the break points
bp all off

;#set the while loop index
set i 0;

;#Open a log file to log the test report
log S "D:/Prathibha/Projects/Motor Controller/BLMC/WIP/V&V/Test 2/whiletest.Log"

while {$i 5} {;#This is to test the comment
puts "\n Value of i is $i";set i [expr $i + 1]}

;#Close the result file,kill the session and quit the IDE.
log off S

Looking forward to your quick response and support.