Hi Lucas
Your advice is really helpful, I understood the reason under your
illustration.
The reason is that I was starting STAF by calling
". /usr/local/staf/startSTAFProc.sh" in runTest.sh
unfortunately, according to the man page, '.' reads and executes
commands from filename in the current shell environment.
The "current shell environment" seems contains current parameters.
so, actually I was calling
"/usr/local/staf/startSTAFProc.sh <testName>"
and startSTAFProc.sh passed "testName: to STAFEnv.sh because
it is calling ". /usr/local/staf/STAFEnv.sh".
Cao Yu
Sharon Lucas wrote:
> The default root logging directory where the LOG service stores log files
> is described in section "8.8.3 Parameters" in the STAF User's Guide as
> {STAF/DataDir}/service/<Service Name (lower-case)>. The {STAF/DataDir}
> variable is set based on the DATADIR operational parameter, which in
> section "4.7 Operational parameters" in the STAF User's Guide defaults to
> {STAF/Config/STAFRoot}/data/{STAF/Config/InstanceName}. So, it would
> appear that you're setting the STAF_INSTANCE_NAME environment variable to
> Filesystem_Basic_1_1_maintance somewhere (overriding its default value of
> STAF), not setting the DATADIR operational parameter, but since the
> DATADIR operational parameter is set depending on the
> {STAF/Config/InstanceName} STAF variable (which is based on the value of
> the STAF_INSTANCE_NAME environment variable)..
>
> You didn't provide the full content of your runTest.sh script. I'm
> guessing that it is running STAFEnv.sh to set the environment variables
> to use for STAF. STAFEnv.sh accepts an optional argument that specifies
> the STAF instance name you want to use. So, it would appear that somehow
> you're accidently passing STAFEnv.sh the testcase name that was passed in
> as an argument to runTest.sh). Note that STAFEnv.sh does the following to
> determine STAF_INSTANCE_NAME:
>
> if [ $# = 0 ]
> then
> STAF_INSTANCE_NAME=STAF
> else
> if [ $1 != "start" ]
> then
> STAF_INSTANCE_NAME=$1
> else
> # Ignore "start" STAF_INSTANCE_NAME
> STAF_INSTANCE_NAME=STAF
> fi
> fi
>
> So, maybe the argument that you're pasing to runTest.sh is also being
> passed to STAFEnv.sh. If you want STAF to be the STAF_INSTANCE_NAME,
> maybe try running STAFEnv.sh passing it STAF (e.g. . ./STAFEnv.sh STAF) in
> your bash script.
>
> For more information on the STAFEnv.sh script, see section "5.1.1 Running
> Multiple Instances of STAFProc" in the STAF User's Guide and section "3.7
> STAFEnv script" in the STAF Installation Guide at
> http://staf.sourceforge.net/current/STAFInstall.pdf.
>
> --------------------------------------------------------------
> Sharon Lucas
> IBM Austin, [email protected]
> (512) 286-7313 or Tieline 363-7313
>
>
>
>
> Cao Yu <[email protected]>
> 04/29/2009 01:04 AM
>
> To
> [email protected]
> cc
>
> Subject
> [staf-users] How does STAF decide where to save logs
>
>
>
>
>
>
> Hello Eeryone.
>
> I'm trying to write a bash script to make it possible that user could
> specify a special test to run. The aim is that when user gives a
> parameter, the parameter will be treat as a test name and only
> testcases with exactly the same name will be run. If user does not
> set any parameter, all test cases will be run.
>
> --------bash script begins---------
> #!/bin/bash
> #filename: runTest.sh
> ....
>
> START_FILE=`pwd`/run.xml
>
> ....
>
> ARGS="'stafScriptsRoot': '$STAF_SCRIPTS_ROOT'"
> if [ "$1" != "" ]; then
> ARGS="$ARGS, 'testCode': '$1'"
> fi
> if [ "$2" != "" ]; then
> ARGS="$ARGS, 'incCode': '$2'"
> fi
>
> echo $ARGS
>
> echo "Now starting to run STAF tests ..."
> STAF LOCAL STAX EXECUTE FILE $START_FILE ARGS "{$ARGS}" JOBNAME QAAF
> CLEARLOGS ENABLED WAIT RETURNRESULT
>
> ....
>
> --------bash script ends---------
> *The content of run.xml please refer to the attachment.
>
> But I met a strange problem in saving logs.
> when I simply execute "./runTest.sh", all logs would be
> saved to /usr/local/staf/data/STAF/service/log/MACHINE/rplcli/GLOBAL/
> but when I give a parameter like "./runTest.sh
> Filesystem_Basic_1_1_maintance" , all logs would be saved to
>
> /usr/local/staf/data/Filesystem_Basic_1_1_maintance/service/log/MACHINE/rplcli/GLOBAL/
>
> I have refered to the manual, it said that the log directory was
> decided by DATADIR, but I did not change the DATADIR setting.
> so it should be
> {STAF/Config/STAFRoot}/data/{STAF/Config/InstanceName}.
> and "STAF/Config/InstanceName"'s default value is "STAF".
>
> so usr/local/staf/data/STAF/service/log/ is correct,
> but where dose
> /usr/local/staf/data/Filesystem_Basic_1_1_maintance/service/log/ come
> from?
>
>
>
>
>
>
>
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE stax SYSTEM "stax.dtd">
> <stax>
> <defaultcall function="testSequence"/>
>
> <function name="testSequence" scope="global">
> <function-map-args>
> <function-optional-arg name="stafScriptsRoot"
> default="'/home/xxxxx/STAFscripts'"/>
> <function-optional-arg name="testCode"
> default="''">
> Code of test to be executed. If not
> specified all tests will be executed.
> </function-optional-arg>
> <function-optional-arg name="incCode"
> default="''">
> Code of test incarnation to be executed.
> If not specified all incarnations will be executed.
> </function-optional-arg>
> </function-map-args>
>
> <sequence>
> <import machine="'local'" file="'library.xml'"/>
> <call function="'preTest'"/>
>
> <script>
> hydraServerAN2IP="xxx.xxx.xxx.xxx"
>
> from suit_jdom import *
> from staf_util import *
> suit = testsuit('generic.pro.xml');
> #testsuit is class that parse generic.pro.xml and
> #
> testList = suit.testList;
> </script>
> <!--script>
> testList = suit.get().testList
> </script-->
> <iterate var="test" in="testList">
> <sequence>
> <testcase name="test.testName">
> <sequence>
> <log>"testName = %s"%(test.testName)</log>
> <if expr="testCode == '' or test.testName
> == testCode">
> <sequence>
> <if expr="incCode == '' or
> test.incarnation == incCode">
> <sequence>
> <log>"testName = %s; testInc = %s"
> %(test.testName, test.incarnation)</log>
> <script>
> testFile=test.testFile
> testScript=stafScriptsRoot+"/tests.staf/tests/"+testFile
> userParaList =
> getParaListFromTestScript(testScript)
>
> if
> userParaList.count('testCaseName') == 1:
> if not
> test.args.has_key('testCaseName'):
> test.args['testCaseName'] = test.testName;
>
> if
> userParaList.count('windowsServer') == 1:
> if not
> test.args.has_key('windowsServer'):
> test.args['windowsServer'] = suit.config.windowsServerName;
> if
> userParaList.count('hydraServer') == 1:
> if not
> test.args.has_key('hydraServer'):
> test.args['hydraServer'] = suit.config.hydraServerIP;
> if
> userParaList.count('guiAddress') == 1:
> if not
> test.args.has_key('guiAddress'):
> test.args['guiAddress'] = suit.config.GUIAddr;
> if
> userParaList.count('backupServer') == 1:
> if not
> test.args.has_key('backupServer'):
> test.args['backupServer'] = suit.config.backupServer;
>
> if userParaList.count('winServer')
> == 1:
> if not
> test.args.has_key('winServer'):
> test.args['winServer'] = suit.config.windowsServerName;
> if
> userParaList.count('backupServerIP') == 1:
> if not
> test.args.has_key('backupServerIP'):
> test.args['backupServerIP'] = suit.config.backupServer;
> if
> userParaList.count('hydraServerIP') == 1:
> if not
> test.args.has_key('hydraServerIP'):
> test.args['hydraServerIP'] = suit.config.hydraServerIP;
> if userParaList.count('GUIAddr')
> == 1:
> if not
> test.args.has_key('GUIAddr'):
> test.args['GUIAddr'] = suit.config.GUIAddr;
> </script>
> <call function="'execJob'">{'testName':
> test.testName,'testScript': testScript, 'xmlArgs':test.args}</call>
> </sequence>
> </if>
> </sequence>
> </if>
> </sequence>
> </testcase>
> </sequence>
> </iterate>
>
> <call function="'postTest'">{'gui':
> suit.config.GUIAddr}</call>
> </sequence>
>
> </function>
> </stax>
>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> staf-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/staf-users
>
>
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations
Conference from O'Reilly Media. Velocity features a full day of
expert-led, hands-on workshops and two days of sessions from industry
leaders in dedicated Performance & Operations tracks. Use code vel09scf
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
staf-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/staf-users