We are trying to automate tesing for a project using TCL for automation. We have got this far and can't proceed any furthur without support. Please help us out, the help needed is also in the TCL code it self.
############################### # Open the Project ############################################################## #proj -o ./test_project.mcp ############################### # Build the Project ############################################################## #make ./test_project.mcp ############################### # Launch the Debugger. ############################################################## #debug ./test_project.mcp set t_infile [open ./function_under_test_D3_D3_P3.in r] ############################### # Read the test vector from the file ############################################################## for {set i 0 } {$i < 962} {incr i 1} { gets $t_infile line set in_testvector(i) $line } ############################### # Close in file. Reading done. ############################################################## close $t_infile ############################### # Put Break point to fill Test vector ############################################################## bp inputFunction ############################### # Put Break point to extract Test results ############################################################## bp outputFunction ############################### # Run till first break point. ############################################################## #go ############################### # Go one step to get the variables in scope. ############################################################## step ############################################################## # # Help Needed here for the following: # =================================== # 1. Read the values of C-pointer-variables 'inPtr' and 'outPtr' # into tcl_inPtr and tcl_outPtr # 2. Using the values of the pointer we have to fill in the # test pattern from '$in_testvector($i)' to the memory # area pointed by '$tcl_inPtr' # 3. Using the values of the pointer we have to read in the # test results from the memory area pointed by # '$tcl_outPtr' to 'out_testresults($i)' # # void *inPtr; void *outPtr; # long in[100], out[100]; # # main (void) # { # inPtr = &in[0]; # outPtr = &out[0]; # # /* break point Load the in variable with our test vector */ # # function_under_test(); # # /* break point Here will read the out variable */ # # } # ################################################################ ############################### # Read the Value of inPtr (C vairable) # try to assign the test vector from in_testvector in to memory # pointed by $tcl_inPtr ################################################################ # From Pg 65 of IDE 5.7 Windows® Automation Guide # var [v:]<var> [-np] [-s|-ns] [%<conv>] set tcl_inPtr [var inPtr -np %x]; # <------- this line prints out the value of the inPtr and script breaks. # From Pg 24 of IDE 5.7 Windows® Automation Guide # change [<ms>:]<addr> [<count>][<width>] [-s|-ns] [%<conv>] <value> for {set i 0 } {$i < 962} {incr i 1} { change $tcl_inPtr($i) 1 32 %x $in_testvector($i) } ############################### # Read the Value of outPtr (C vairable) ############################################################## set tcl_outPtr [var outPtr -np %x]; set t_outfile [open ./function_under_test_D3_D3_P3.ac w] # Dump $out_testresults($i) to out file. close $t_outfile
Thanks in advance!
Hello
# 1. Read the values of C-pointer-variables 'inPtr' and 'outPtr' into tcl_inPtr and tcl_outPtr
This can be done using commands:
set tcl_inPtr [evaluate ptrIn]
set tcl_outPtr [evaluate outPtr]
# 2. Using the values of the pointer we have to fill in the
# test pattern from '$in_testvector($i)' to the memory
# area pointed by '$tcl_inPtr'
I would try the following here:
set offset [evaluate #x $tcl_inPtr+$i*4]
change m:$offset %x $in_testvector($i)
# 3. Using the values of the pointer we have to read in the
# test results from the memory area pointed by
# '$tcl_outPtr' to 'out_testresults($i)'
I would try the following here:
set offset_out [evaluate #x $tcl_outPtr+$i*4]
display m:$offset_out %x
CrasyCat
Hello CrasyCat,
Thanks for the help! We are now able to achieve what we wanted. I had also raised a Service request per our local support executive. I received similar suggestions.
May be I will try the forum first when I need support next time.
Regards,
Ravi