Gift-VT Tools Development Overview

3,059 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
3,059
On SlideShare
0
From Embeds
0
Number of Embeds
55
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Gift-VT Tools Development Overview

  1. 1. GIFT-VT Tools Overview
  2. 2. Agenda <ul><li>Tools Levels. </li></ul><ul><li>The gift file. </li></ul><ul><li>Execute Tool by the Server. </li></ul><ul><li>Tools MakeFile. </li></ul>
  3. 3. The Tools layer <ul><li>We have several types of Tools: </li></ul><ul><ul><li>Generic. </li></ul></ul><ul><ul><ul><li>LineShmoo, ExecuteAllPats etc. </li></ul></ul></ul><ul><ul><li>Product specific. </li></ul></ul><ul><ul><ul><li>ScanOut, LCP etc. </li></ul></ul></ul><ul><ul><li>Platform Specific </li></ul></ul><ul><ul><ul><li>S9KPutCompare </li></ul></ul></ul><ul><ul><li>Produc & Platform Specific </li></ul></ul><ul><ul><ul><li>DTN_S9KRaster </li></ul></ul></ul>
  4. 4. Tools layer <ul><li>For each type we have: </li></ul><ul><ul><li>Service classes </li></ul></ul><ul><ul><ul><li>Common task which used by Tools and Modules (i.e. CoutputServer or CfailureTable) </li></ul></ul></ul><ul><ul><li>Module classes </li></ul></ul><ul><ul><ul><li>Implements a specific algorithm within a Tool, this algorithm may be used by several Tools (i.e. CShmoo or CStability ) </li></ul></ul></ul><ul><ul><li>Tool classes </li></ul></ul><ul><ul><ul><li>Implements a specific Tool algorithm (i.e. CColumnShmoo or CLCP_DC ). </li></ul></ul></ul>
  5. 5. Classes – Tools, Modules & Services CBaseTool Modules Tools Services inheritance CBaseTool C2DShmoo CShmoo CStability CLineShmoo CLCP_DC CRunShmoo CScanOut CFailureTable COutputServer CAddressCalc CConfigServer
  6. 6. Gift file <ul><li>Every tool need a gift file: </li></ul><ul><li>The gift file include the tool name </li></ul><ul><ul><ul><li># UF: ToolName </li></ul></ul></ul><ul><li>All Tool Params (Globlas) </li></ul><ul><ul><li>A line starting with “ # ” is a comment. </li></ul></ul><ul><ul><li>A line starting with “: ;” is an empty line. </li></ul></ul><ul><ul><li>A line like “:XXX;” is a header line (the XXX will be green in the GUI). </li></ul></ul><ul><ul><li>All other lines are parameter lines, each divided into fields by the “;” delimiter: </li></ul></ul><ul><ul><ul><li>First field is a name and must begin with the “-“ character (for clift). </li></ul></ul></ul><ul><ul><ul><li>Second field is the parameter name to be passed to the Tool. </li></ul></ul></ul><ul><ul><ul><li>Third field is the parameter type (INT, FLOAT, STRING). </li></ul></ul></ul><ul><ul><ul><li>Fourth field is the parameter short description to appear in the GUI and in the Tool header. </li></ul></ul></ul>
  7. 7. Gift file cont’ <ul><ul><li>Fourth field parameter </li></ul></ul><ul><ul><ul><li>If the field ends with “#0” the field is read only – user can change it only if it has a drop-down menu. </li></ul></ul></ul><ul><ul><ul><li>If the field ends with “#5!” the field appears as a button. The five subsequent lines will correspond to a sub window that will pop up when clicking the button. </li></ul></ul></ul><ul><ul><li>Fifth field is the parameter help line that appears in the GUI when the mouse points at the parameter. </li></ul></ul><ul><ul><li>Sixth field is optional. When it exists the field becomes a menu field. </li></ul></ul><ul><ul><ul><li>The tokens in the field (separated by coma “,”) are the menu contents. </li></ul></ul></ul><ul><ul><ul><li>If the content of the field is “<2#>” the menu content will come from the configuration file. </li></ul></ul></ul><ul><ul><li>Seventh field is also optional. The value(s) of each token replaces the corresponding item selected in the sixth field menu for transmission to the Tool. </li></ul></ul>
  8. 8. Gift file Example. <ul><li># GIFT/CLIFT Configuration file for Example </li></ul><ul><li># UF: Example </li></ul><ul><li># ------------------------------------------- </li></ul><ul><li># This is a comment. </li></ul><ul><li>:This is the header; </li></ul><ul><li>-First; DBG_First_Param; int; First Parameter#0; Help line 1; One,Two; 1,2; </li></ul><ul><li># Empty line </li></ul><ul><li>: ; </li></ul><ul><li>-Second; DBG_Second_Param; string; Second Parameter; Help line 2; One,Two,Three; </li></ul><ul><li>:This is another header; </li></ul><ul><li>-Third; DBG_Third_Param; int; Third Parameter; Help line 3; </li></ul><ul><li>-Options; DBG_Options; string; Options#2!; More options; Yes,No; 1,2; </li></ul><ul><li>:Options header; </li></ul><ul><li>-FirstOption; DBG_First_Options; int; First Option; </li></ul><ul><li>-SecondOption; DBG_Second_Options; int; Second Option; </li></ul><ul><li>#end of gift file </li></ul>
  9. 9. Execute Tool <ul><li>In order to execute a tool the server translate a string tool name to the func pointer. </li></ul><ul><ul><li>Get Tool Name form the .gift file </li></ul></ul><ul><ul><ul><li>E.g. MyTool </li></ul></ul></ul><ul><ul><li>Loading the tool from the disk to mem. </li></ul></ul><ul><ul><ul><li>P = dlopen(“ MyTool ”); </li></ul></ul></ul><ul><ul><li>Get ‘MyTool’ exec & Check functions </li></ul></ul><ul><ul><ul><li>Pcheck = dlsym(p,” MyTool _Check”); </li></ul></ul></ul><ul><ul><ul><li>Prun = dlsym(p,” MyTool _Run”) </li></ul></ul></ul><ul><ul><li>Note: </li></ul></ul><ul><ul><ul><li>The name of Run/Check functions has to be the same as Tool MyTool file name. </li></ul></ul></ul>
  10. 10. MakeFile <ul><li># This is a Makefile for the VT project </li></ul><ul><li># General flags </li></ul><ul><li>GIFTVT_ROOT = /afs/iil.intel.com/tmn/eng/tcg/TMN_TCG_11/GiftVT </li></ul><ul><li>TARGET = $(GIFTVT_ROOT)/VT_lib/tools_lib/generic_tools_lib/ </li></ul><ul><li>LIBNAME = libExample </li></ul><ul><li>GIFTNAME = Example.gift </li></ul><ul><li>  </li></ul><ul><li>CFLAGS = -fPIC -fexceptions -g -c –o </li></ul><ul><li>  </li></ul><ul><li>INCLUDE = -I$(GIFTVT_ROOT)/src/include </li></ul><ul><li> -I$(GIFTVT_ROOT)/src/GiftVT_Utiles </li></ul><ul><li> -I$(GIFTVT_ROOT)/src/generic_tools/ToolFuncs </li></ul><ul><li>  </li></ul><ul><li>LIBS = -L$(GIFTVT_ROOT)/VT_lib/emul_funcs_lib/ - lVTfuncs </li></ul><ul><li> -L$(GIFTVT_ROOT)/VT_lib/tools_lib/generic_tools_lib/ - lToolFuncs </li></ul><ul><li>SRCS = CExample.cpp </li></ul><ul><li>OBJS = ${SRCS:.cpp=.o} </li></ul>
  11. 11. Makefile cont’ <ul><li>build_objects: </li></ul><ul><li>  </li></ul><ul><li>make_lib_share: ${OBJS} </li></ul><ul><li>@echo &quot;Building Shared Library &quot; ${TARGET}/${LIBNAME}.so.${M1}.${M2} &quot; ...&quot; </li></ul><ul><li>${LD} -shared -G -z text -o ${TARGET}/${LIBNAME}.so.${M1}.${M2} ${OBJS} ${LIBS} </li></ul><ul><li>@echo &quot;Done.&quot; </li></ul><ul><li>@echo &quot;&quot; </li></ul><ul><li>make_link: </li></ul><ul><li>@echo &quot;Make a link to &quot; ${TARGET}/${LIBNAME}.so.${M1}.${M2} &quot; ...&quot; </li></ul><ul><li>@ rm -f ${TARGET}/${LIBNAME}.so </li></ul><ul><li>ln -s ${LIBNAME}.so.${M1}.${M2} ${TARGET}/${LIBNAME}.so </li></ul><ul><li>@echo &quot;Done.&quot; </li></ul><ul><li>@echo &quot;&quot; </li></ul><ul><li>add_gift: </li></ul><ul><li>@echo &quot;Add Gift file&quot; ${GIFTNAME} &quot;to &quot; ${TARGET}/${LIBNAME}.so.${M1}.${M2} &quot; ...&quot; </li></ul><ul><li>@echo &quot;&quot; >> ${TARGET}/${LIBNAME}.so.${M1}.${M2} </li></ul><ul><li>@cat ${GIFTNAME} >> ${TARGET}/${LIBNAME}.so.${M1}.${M2} </li></ul><ul><li>@echo &quot;Done.&quot; </li></ul><ul><li>@echo &quot;&quot; </li></ul>
  12. 12. System Architecture GIFT-VT Typical GUI
  13. 13. S9K IX Tester IMS Vanguard Tester S9K KX Tester <ul><li>Features: </li></ul><ul><li>Select the component to work on </li></ul><ul><li>Select the tester to use </li></ul><ul><li>All User interface is GUI based </li></ul><ul><li>Same Tool used over Platform </li></ul><ul><li>Same platform for many componets </li></ul>GIFT-VT Debug Tool suite, Over Platform <ul><li>System used in: </li></ul><ul><li>Odem CD (IMS & KX) </li></ul><ul><li>Banias CD (IMS & IX) </li></ul><ul><li>DV (KX) </li></ul><ul><li>Banias (IX) </li></ul><ul><li>SC </li></ul>Structural Tester (ST2) tester support (VT) is being developed in SC
  14. 14. Gift1.0 disadvantages <ul><li>Define only for S9K. </li></ul><ul><li>User have to know basic ASAP. </li></ul><ul><li>All tools linked together (take them all). </li></ul><ul><li>In case of problem in one tool you can’t compile/run ASAP. </li></ul><ul><li>Gift files not part of the tool. </li></ul><ul><li>New tool. </li></ul><ul><ul><li>Change other tools and compile them too. </li></ul></ul><ul><ul><li>Add tool to TP. </li></ul></ul><ul><ul><li>Add some blocks to your TP (globals pat_list etc.). </li></ul></ul><ul><ul><ul><li>(done in gift1.25). </li></ul></ul></ul><ul><ul><li>Compile again your TP. </li></ul></ul>
  15. 15. VTtools base <ul><li>VTtools </li></ul><ul><ul><li>readme.1.0.txt </li></ul></ul><ul><ul><li>src </li></ul></ul><ul><ul><ul><li>include </li></ul></ul></ul><ul><ul><ul><li>bns_tools </li></ul></ul></ul><ul><ul><ul><li>ims_funcs </li></ul></ul></ul><ul><ul><ul><li>s9k_funcs </li></ul></ul></ul><ul><ul><li>VT_lib </li></ul></ul><ul><ul><ul><li>bns_tools_lib </li></ul></ul></ul><ul><ul><ul><li>ims_funcs_lib </li></ul></ul></ul><ul><ul><ul><li>s9k_funcs_lib </li></ul></ul></ul>
  16. 16. src <ul><li>tools </li></ul><ul><ul><li>Makefile </li></ul></ul><ul><ul><li>Tools C functions (-> Tools_liblibtools.so ) </li></ul></ul><ul><li>ims_funcs </li></ul><ul><ul><li>Makefile </li></ul></ul><ul><ul><li>ims C++ functions (-> Funcs_libims_liblibfuncs.so ) </li></ul></ul><ul><li>s9k_funcs </li></ul><ul><ul><li>Makefile </li></ul></ul><ul><ul><li>.c9k UF ( -> .op ) </li></ul></ul><ul><ul><li>s9k C functions (-> Funcs_libs9k_liblibfuncs.so ) </li></ul></ul>
  17. 17. lib <ul><li>Tools_lib </li></ul><ul><ul><li>libserver.so. </li></ul></ul><ul><ul><li>libLineShmoo.so. </li></ul></ul><ul><ul><li>etc. </li></ul></ul><ul><li>Funcs_lib </li></ul><ul><ul><li>all_lib </li></ul></ul><ul><ul><ul><li>libfuncs.so </li></ul></ul></ul><ul><ul><li>ims_lib </li></ul></ul><ul><ul><ul><li>libfuncs.so </li></ul></ul></ul><ul><ul><li>s9k_lib </li></ul></ul><ul><ul><ul><li>libfuncs.so </li></ul></ul></ul><ul><li>include </li></ul><ul><ul><li>.h files </li></ul></ul>
  18. 18. Con’t VT imp <ul><li>Run Tool </li></ul><ul><ul><li>gift send ToolParameters, ToolName to server(). </li></ul></ul><ul><ul><li>Server : </li></ul></ul><ul><ul><ul><li>SetToolParams. </li></ul></ul></ul><ul><ul><ul><li>Load lib tool .so and call tool. </li></ul></ul></ul><ul><ul><li>Tool : </li></ul></ul><ul><ul><ul><li>GetToolParams. </li></ul></ul></ul><ul><ul><ul><li>Load & Run VTfuncs. </li></ul></ul></ul>
  19. 19. PutCompare <ul><li>////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>// CTMN_S9KPutCompare . cpp </li></ul><ul><li>// $GIFT - VT;Tool;timna$ </li></ul><ul><li>// </li></ul><ul><li>// Contains : definitions for class CTMN_S9KPutCompare </li></ul><ul><li>// </li></ul><ul><li>// 23/06/2001 Cohen Alon Creation </li></ul><ul><li>// Revision History : None </li></ul><ul><li>/* </li></ul><ul><li>* $Header : / afs / iil . intel . com / tmn / eng / tcg / TMN_TCG_4 / GIFT_FILES / Tools / Active / Aux / RCS / TMN_S9KPutCompare . cpp,v 1.0 2001-06-14 23:03:13+03 cecp Exp $ </li></ul><ul><li>* $RCSfile : TMN_S9KPutCompare . cpp,v $ </li></ul><ul><li>* $Revision : 1.0 $ </li></ul><ul><li>* $Date : 2001-06-14 23:03:13+03 $ </li></ul><ul><li>* $Id : TMN_S9KPutCompare . cpp,v 1.0 2001-06-14 23:03:13+03 cecp Exp $ </li></ul><ul><li>* $Log : TMN_S9KPutCompare . cpp,v $ </li></ul><ul><li>* Revision 1.0 2001-06-14 23:03:13+03 cecp </li></ul><ul><li>* Initial revision </li></ul><ul><li>* </li></ul><ul><li>* </li></ul><ul><li>* </li></ul><ul><li>*/ </li></ul><ul><li>// CTMN_S9KPutCompare </li></ul><ul><li>////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>#include <stdio . h> </li></ul><ul><li>#include <stdlib . h> </li></ul><ul><li>#include <iostream . h> </li></ul><ul><li>#include <vtFunctions . h> </li></ul><ul><li>#include <CTimer . h> </li></ul><ul><li>#include <CGlobalsHandle . h> </li></ul><ul><li>#define S9K_TOOL_NAME &quot; TMN_S9KPutCompare &quot; </li></ul><ul><li>#define RUN_S9K_TOOlS_DBG 1 </li></ul><ul><li>typedef int (* func1 )( char * buffer, FILE * fic ) ; </li></ul><ul><li>typedef int (* func2 )( void ) ; </li></ul><ul><li>static char * rcsid = &quot; $Id : TMN_S9KPutCompare . cpp,v 1.0 2001-06-14 23:03:13+03 cecp Exp $ &quot; ; </li></ul><ul><li>static char * rcsrev = &quot; $Revision : 1.0 $ &quot; ; </li></ul><ul><li>extern &quot; C &quot; { </li></ul><ul><li>extern int check_PutCompare ( char * buffer, FILE * fic ) ; </li></ul><ul><li>extern int PutCompare ( void ) ; </li></ul><ul><li>VTBoolean TMN_S9KPutCompare_Check ( ParamsContainer & Container, char * zResponseBuf ) ; </li></ul><ul><li>VTBoolean TMN_S9KPutCompare_Run ( ParamsContainer & Container, char * zResponseBuf ) ; </li></ul><ul><li>} </li></ul><ul><li>static func1 pFuncCheck = check_PutCompare; </li></ul><ul><li>static func2 pFuncExec = PutCompare; </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// TMN_S9KPutCompare_Check </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean TMN_S9KPutCompare_Check ( ParamsContainer & Container, char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>VTBoolean bOk = VT_TRUE; </li></ul><ul><li>VTBoolean obRet = VT_TRUE; </li></ul><ul><li>// CGlobalsHandle MyGlobalsHandle ( Container ) ; </li></ul><ul><li>// if ( RUN_S9K_TOOlS_DBG ) </li></ul><ul><li>// MyGlobalsHandle . mOutObj . PrintDebug ( VT_TRUE ) ; </li></ul><ul><li>if (! zResponseBuf ) { </li></ul><ul><li>// ERROR </li></ul><ul><li>// MyGlobalsHandle . mOutObj . Print ( ERROR, &quot; zResponseBuf is NULL &quot;) ; </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>sprintf ( zResponseBuf, &quot;% s; &quot; ,zResponseBuf ) ; </li></ul><ul><li>// bOk = MyGlobalsHandle . SetAllToolsParams () ; </li></ul><ul><li>/////////////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>string sName = &quot; UFG_comp_field &quot; ; </li></ul><ul><li>ParamsContainer :: iterator Iter = Container . find ( sName ) ; </li></ul><ul><li>if ( Iter == Container . end ()) { </li></ul><ul><li>printf (&quot;% s - Paremeter name not found &quot; ,sName . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>else{ </li></ul><ul><li>vtSetToolParam (( char *)(* Iter ). second . msName . c_str () ,SVAL, ( char *)(* Iter ). second . msValue . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>sName = &quot; UFG_comp_field1 &quot; ; </li></ul><ul><li>Iter = Container . find ( sName ) ; </li></ul><ul><li>if ( Iter == Container . end ()) { </li></ul><ul><li>printf (&quot;% s - Paremeter name not found &quot; ,sName . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>else{ </li></ul><ul><li>vtSetToolParam (( char *)(* Iter ). second . msName . c_str () ,SVAL, ( char *)(* Iter ). second . msValue . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>sName = &quot; UFG_comp_field2 &quot; ; </li></ul><ul><li>Iter = Container . find ( sName ) ; </li></ul><ul><li>if ( Iter == Container . end ()) { </li></ul><ul><li>printf (&quot;% s - Paremeter name not found &quot; ,sName . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>else{ </li></ul><ul><li>vtSetToolParam (( char *)(* Iter ). second . msName . c_str () ,SVAL, ( char *)(* Iter ). second . msValue . c_str ()) ; </li></ul><ul><li>} </li></ul><ul><li>/////////////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>// MyGlobalsHandle . mOutObj . Print ( DEBUG, &quot; Check Tool % s &quot; ,S9K_TOOL_NAME ) ; </li></ul><ul><li>// Execute CheckS9ktool </li></ul><ul><li>printf (&quot;**** run pFuncCheck *** &quot;) ; </li></ul><ul><li>obRet = ( VTBoolean ) pFuncCheck ( zResponseBuf,NULL ) ; </li></ul><ul><li>// MyGlobalsHandle . mOutObj . Print ( DEBUG, &quot; Check return % d, zResponseBuf = % s &quot; ,obRet,zResponseBuf ) ; </li></ul><ul><li>printf (&quot;**** End of run pFuncCheck *** &quot;) ; </li></ul><ul><li>return obRet; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// TMN_S9KPutCompare_Run </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean TMN_S9KPutCompare_Run ( ParamsContainer & Container, char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>VTBoolean bOk = VT_TRUE; </li></ul><ul><li>VTBoolean obRet = VT_TRUE; </li></ul><ul><li>CTimer Timer; </li></ul><ul><li>CGlobalsHandle MyGlobalsHandle ( Container ) ; </li></ul><ul><li>if ( RUN_S9K_TOOlS_DBG ) </li></ul><ul><li>MyGlobalsHandle . mOutObj . PrintDebug ( VT_TRUE ) ; </li></ul><ul><li>MyGlobalsHandle . mOutObj . Print ( DEBUG, &quot; Running % s with Verbose Mode &quot; ,S9K_TOOL_NAME ) ; </li></ul><ul><li>if (! zResponseBuf ) { </li></ul><ul><li>MyGlobalsHandle . mOutObj . Print ( ERROR, &quot; zResponseBuf is NULL &quot;) ; </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>// bOk = MyGlobalsHandle . SetAllToolsParams () ; </li></ul><ul><li>// if (! bOk ) </li></ul><ul><li>// {MyGlobalsHandle . mOutObj . Print ( ERROR, &quot; SetAllToolsParams () Fail &quot;) ; </li></ul><ul><li>// } </li></ul><ul><li>MyGlobalsHandle . mOutObj . Print ( DEBUG, &quot; Running Tool % s &quot; ,S9K_TOOL_NAME ) ; </li></ul><ul><li>// Execute S9ktool </li></ul><ul><li>obRet = ( VTBoolean ) pFuncExec () ; </li></ul><ul><li>if (! obRet ) MyGlobalsHandle . PrintLastVTError () ; </li></ul><ul><li>MyGlobalsHandle . mOutObj . Print ( DEBUG, </li></ul><ul><li>&quot;--------------- End of TMN_S9KPutCompare ----------------- &quot;) ; </li></ul><ul><li>// bOk = MyGlobalsHandle . GetAllToolsParams ( zResponseBuf ) ; </li></ul><ul><li>// if (! bOk ) MyGlobalsHandle . PrintLastVTError () ; </li></ul><ul><li>return obRet; </li></ul><ul><li>} </li></ul>
  20. 20. Example <ul><li>////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>// A line starting with // is special comments for the Example . cpp program </li></ul><ul><li>// Following is the string that is used by our RCS automatic identifier : </li></ul><ul><li>// $GIFT - VT;Tool;generic$ </li></ul><ul><li>// CExample . cpp </li></ul><ul><li>// </li></ul><ul><li>//**************************************************************************** </li></ul><ul><li>// ( C ) COPYRIGHT INTEL CORPORATION . <2001> . </li></ul><ul><li>// </li></ul><ul><li>// You may not use, copy, modify, or transfer the program, </li></ul><ul><li>// or any copy, modification or merged portion, in whole, </li></ul><ul><li>// or in part, </li></ul><ul><li>// except as expressly provided for by license from Intel . </li></ul><ul><li>// </li></ul><ul><li>//**************************************************************************** </li></ul><ul><li>// </li></ul><ul><li>// Contains : source for class CExample methods : </li></ul><ul><li>// Cto'r ( Constructor ) </li></ul><ul><li>// Dto'r ( Destructor ) </li></ul><ul><li>// CheckParams </li></ul><ul><li>// PrintHeader </li></ul><ul><li>// Execute </li></ul><ul><li>// RunTool </li></ul><ul><li>// </li></ul><ul><li>// V0 27 MAR 2001 Efi Rosental ?Creation? </li></ul><ul><li>// Author : Efi Rosental efi . [email_address] . com 04-865-5483 </li></ul><ul><li>// </li></ul><ul><li>// Revision History : None </li></ul><ul><li>/* </li></ul><ul><li>* $Header : / afs / iil . intel . com / tmn / eng / tcg / TMN_TCG_4 / GIFT_FILES / Tools / Active / Aux / RCS / CExample . cpp,v 1.2 2001-02-19 02:20:52+02 cecp Exp $ </li></ul><ul><li>* $RCSfile : CExample . cpp,v $ </li></ul><ul><li>* $Revision : 1.2 $ </li></ul><ul><li>* $Date : 2001-02-19 02:20:52+02 $ </li></ul><ul><li>* $Id : CExample . cpp,v 1.2 2001-02-19 02:20:52+02 cecp Exp $ </li></ul><ul><li>* $Log : CExample . cpp,v $ </li></ul><ul><li>*/ </li></ul><ul><li>////////////////////////////////////////////////////////////////////////////// </li></ul><ul><li>/////////////////////////// @@ #include <stdlib . h> </li></ul><ul><li>// very Tool should include this on, for interface to the IDC provided VT ( libVTfuncs . so ) </li></ul><ul><li>#include <vtFunctions . h> </li></ul><ul><li>// ools that need to call IFs from the added VT, the libExampleVTfuncs . so in out example </li></ul><ul><li>#include <vtExampleFunctions . h> </li></ul><ul><li>#include <CTimer . h> </li></ul><ul><li>#include &quot; CExample . h &quot; </li></ul><ul><li>static char * rcsid = &quot; $Id : CExample . cpp,v 1.2 2001-02-19 02:20:52+02 cecp Exp $ &quot; ; </li></ul><ul><li>static char * rcsrev = &quot; $Revision : 1.2 $ &quot; ; </li></ul><ul><li>// unctions should look to the outside world as C language functions . </li></ul><ul><li>extern &quot; C &quot; { </li></ul><ul><li>VTBoolean Example_Check ( ParamsContainer & Container, char * zResponseBuf ) ; </li></ul><ul><li>VTBoolean Example_Run ( ParamsContainer & Container, char * zResponseBuf ) ; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// Check function is a must in each Tool source file . It checkes the parameters </li></ul><ul><li>// received from the server and errors are reported back to the server . </li></ul><ul><li>// Example_Check </li></ul><ul><li>// </li></ul><ul><li>// Purpose : To run &quot; check &quot; on parmeters ( used by server ). </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean Example_Check ( ParamsContainer & Container, char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>// </li></ul><ul><li>CExample MyExample ( Container ) ; </li></ul><ul><li>return MyExample . CheckParams ( zResponseBuf ) ; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// un function is a must in each Tool source file . It runs Tool algorithm . </li></ul><ul><li>// Example_Run </li></ul><ul><li>// </li></ul><ul><li>// Purpose : To run the tool ( used by server ). </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean Example_Run ( ParamsContainer & Container, char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>CTimer Timer; </li></ul><ul><li>CExample MyExample ( Container ) ; </li></ul><ul><li>return MyExample . RunTool ( zResponseBuf ) ; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// Cto'r ( Constructor ) </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>CExample :: CExample ( ParamsContainer & Container ): CBaseTool ( Container ) </li></ul><ul><li>{ </li></ul><ul><li>// FillToolParams, defined in CBaseTool . cpp, takes all parameters send </li></ul><ul><li>// from the server, and initializes the parameters </li></ul><ul><li>VTBoolean bOk = FillToolParams () ; </li></ul><ul><li>if (! bOk ) </li></ul><ul><li>mOutObj . Print ( ERROR, &quot; CExample :: CExample () &quot;) ; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// Dto'r ( Destructor ) </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>CExample :: ~CExample () </li></ul><ul><li>{ </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// RunTool </li></ul><ul><li>// </li></ul><ul><li>// Purpose : Call Execute () and print the tool header . </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean CExample :: RunTool ( char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>PrintHeader () ; </li></ul><ul><li>/////////////////////////////// @@ call Run, which will call Execute per pattern </li></ul><ul><li>VTBoolean obRet = Execute () ; </li></ul><ul><li>mOutObj . Print ( INFORMATION, </li></ul><ul><li>&quot;--------------- End Example Tool run ----------------- &quot;) ; </li></ul><ul><li>return obRet; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// Execute </li></ul><ul><li>// </li></ul><ul><li>// Purpose : Run the tool algorithm . </li></ul><ul><li>// In this case it is just creating the CAddressCalc . </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean </li></ul><ul><li>CExample :: Execute () </li></ul><ul><li>{ </li></ul><ul><li>char zStringToUse [ MAX_NAME_LENGTH ] ; </li></ul><ul><li>VTBoolean ReturnValue; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; This is just an Example Tool &quot;) ; </li></ul><ul><li>// print out current Pattern name . </li></ul><ul><li>// The following vtGetCurrentPatternName IF is found in the IDC provided VT, </li></ul><ul><li>// the libVTfuncs . so Shared Object ( Shared Library ): </li></ul><ul><li>ReturnValue = vtGetCurrentPatternName ( zStringToUse ) ; </li></ul><ul><li>if ( ReturnValue == VT_FALSE ) { </li></ul><ul><li>PrintLastVTError () ; </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>mOutObj . Print ( INFORMATION, &quot; Current Pattern Name % s &quot; ,zStringToUse ) ; </li></ul><ul><li>// print out current Tester's Software release . </li></ul><ul><li>// This vtExampleRun IF is found in the Example VT, </li></ul><ul><li>// the libExampleVTfuncs . so Shared Library, dropped in the same place </li></ul><ul><li>// as the libVTfuncs . so . Please note that the libExampleVTfuncs . so accesses </li></ul><ul><li>// the libVTfuncs . so file ( refer to its source ) taking vital papareters fro there . </li></ul><ul><li>ReturnValue = vtExampleRun ( zStringToUse ) ; </li></ul><ul><li>if ( ReturnValue == VT_FALSE ) { </li></ul><ul><li>PrintLastVTError () ; </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>mOutObj . Print ( INFORMATION, &quot; Tester version is : % s &quot; ,zStringToUse ) ; </li></ul><ul><li>return VT_TRUE; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// PrintHeader </li></ul><ul><li>// </li></ul><ul><li>// Purpose : Prints the parameters description and values </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean </li></ul><ul><li>CExample :: PrintHeader () </li></ul><ul><li>{ </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; Tool Example --- Begin Header ---&quot;) ; </li></ul><ul><li>// print CBaseTool parameters . </li></ul><ul><li>CBaseTool :: PrintHeader () ; </li></ul><ul><li>// print CExample tool parameters . </li></ul><ul><li>char zDescriptionBuf [ MAX_VALUE_CHARS ] ; </li></ul><ul><li>GetParamDescription ( FIRST_PARAM, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % d &quot; , zDescriptionBuf, mFirst ) ; </li></ul><ul><li>GetParamDescription ( SECOND_PARAM, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % s &quot; , zDescriptionBuf, msSecond . c_str ()) ; </li></ul><ul><li>GetParamDescription ( THIRD_PARAM, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % d &quot; , zDescriptionBuf, mThird ) ; </li></ul><ul><li>GetParamDescription ( OPTIONS, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % d &quot; , zDescriptionBuf, mOptions ) ; </li></ul><ul><li>GetParamDescription ( FIRST_OPTION, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % d &quot; , zDescriptionBuf, mFirstOption ) ; </li></ul><ul><li>GetParamDescription ( SECOND_OPTION, zDescriptionBuf ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; %-45s : % d &quot; , zDescriptionBuf, mSecondOption ) ; </li></ul><ul><li>mOutObj . Print ( REGULAR, &quot; ; ------------------------------------------ &quot;) ; </li></ul><ul><li>return VT_TRUE; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// CheckParams </li></ul><ul><li>// </li></ul><ul><li>// Purpose : check the parameters values received from the GUI . </li></ul><ul><li>// Output : print in to zResponseBuf the tool revition and an error </li></ul><ul><li>// message for each parameter found wrong . </li></ul><ul><li>// returns VT_FALSE if there is any . </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean </li></ul><ul><li>CExample :: CheckParams ( char * zResponseBuf ) </li></ul><ul><li>{ </li></ul><ul><li>if (! zResponseBuf ) { </li></ul><ul><li>// ERROR </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>sprintf ( zResponseBuf, &quot;% s; &quot; ,rcsrev ) ; // Return RCS rev </li></ul><ul><li>// Invoke CheckParams () of base classes </li></ul><ul><li>VTBoolean obRet = CBaseTool :: CheckParams ( zResponseBuf ) ; </li></ul><ul><li>// Then check the tool own parameters if any . </li></ul><ul><li>return obRet; </li></ul><ul><li>} </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>// FillToolParams </li></ul><ul><li>// </li></ul><ul><li>// Purpose : Get the parameters values from the GUI . </li></ul><ul><li>//-------------------------------------------------------------------- </li></ul><ul><li>VTBoolean </li></ul><ul><li>CExample :: FillToolParams () </li></ul><ul><li>{ </li></ul><ul><li>char zValBuf [ MAX_VALUE_CHARS ] ; </li></ul><ul><li>try{ </li></ul><ul><li>GetParamValue ( FIRST_PARAM, zValBuf ) ; </li></ul><ul><li>mFirst = atoi ( zValBuf ) ; </li></ul><ul><li>GetParamValue ( SECOND_PARAM, zValBuf ) ; </li></ul><ul><li>msSecond = zValBuf; </li></ul><ul><li>GetParamValue ( THIRD_PARAM, zValBuf ) ; </li></ul><ul><li>mThird = atoi ( zValBuf ) ; </li></ul><ul><li>GetParamValue ( OPTIONS, zValBuf ) ; </li></ul><ul><li>mOptions = atoi ( zValBuf ) ; </li></ul><ul><li>GetParamValue ( FIRST_OPTION, zValBuf ) ; </li></ul><ul><li>mFirstOption = atoi ( zValBuf ) ; </li></ul><ul><li>GetParamValue ( SECOND_OPTION, zValBuf ) ; </li></ul><ul><li>mSecondOption = atoi ( zValBuf ) ; </li></ul><ul><li>} </li></ul><ul><li>catch ( char * zError ) { </li></ul><ul><li>mOutObj . Print ( ERROR, &quot;% s &quot; ,zError ) ; </li></ul><ul><li>return VT_FALSE; </li></ul><ul><li>} </li></ul><ul><li>return VT_TRUE; </li></ul><ul><li>} </li></ul>

×