⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 staftest.cmd

📁 Software Testing Automation Framework (STAF)的开发代码
💻 CMD
📖 第 1 页 / 共 4 页
字号:
/*****************************************************************************//* Software Testing Automation Framework (STAF)                              *//* (C) Copyright IBM Corp. 2001                                              *//*                                                                           *//* This software is licensed under the Common Public License (CPL) V1.0.     *//*****************************************************************************//******************************************************************************//* REXX STAFTest Program for Software Testing Automation Framework (STAF)     *//* -------------------------------------------------------------------------- *//* Description: This program tests STAF.                                      *//* Options: See HELP                                                          *//*                                                                            *//*  Note: This program requires RxPP (REXX pre-processor) to be used to       *//*        generate the executable cmd file.                                   *//* -------------------------------------------------------------------------- *//* History:                                                                   *//*  1.00  DHR  02/10/1998  Initial implementation                             *//******************************************************************************/options "EXMODE ETMODE"signal on halt name STAFAbortparse arg requestcall InitParsercall AddOption "GENWLONLY", 1, "NO"call AddOption "NOGENWL", 1, "NO"call AddOption "INTERNALONLY", 1, "NO"call AddOption "EXTERNALONLY", 1, "NO"call AddOption "QUIET", 1, "NO"call AddOption "HELP", 1, "NO"call AddOption "PINGONLY", 1, "NO"call AddOption "PROCESSONLY", 1, "NO"call AddOption "MACHINE", 1, "YES"call AddOption "WHERE", 1, "YES"call AddOption "LOOPS", 1, "YES"call AddOption "MAXERROR", 1, "YES"call AddOptionGroup "GENWLONLY PINGONLY PROCESSONLY INTERNALONLY EXTERNALONLY", 0, 1call AddOptionGroup "NOGENWL GENWLONLY", 0, 1rc = ParseString(request, "errorBuffer")if rc \= 0 then do  say errorBuffer  exitendif optionTimes("HELP") > 0 then do   say "STAFTest [WHERE <where>] [MACHINE <machine>]"   say "         [LOOPS <loops>] [MAXERROR <maxerror>]"   say "         [GENWLONLY] [INTERNALONLY] [EXTERNALONLY] [PINGONLY] [PROCESSONLY]"   say "         [NOGENWL] [QUIET] [HELP]"   exitendif optionTimes("NOGENWL") > 0 then genwl = 0else genwl = 1if optionTimes("WHERE") > 0 then where = OptionValue("WHERE")else where = "LOCAL"if optionTimes("QUIET") > 0 then loud = 0else loud = 1maxerror = optionValue("MAXERROR")if maxerror < 1 | datatype(maxerror,'W') = 0 then maxerror = 25times = optionValue("LOOPS")if times < 1 | datatype(times,'W') = 0 then times = 0else times = times + 1if \ loud then do  say "STAFTest Initiated in QUIET Mode..."endparse source OSType . .if OSType = "OS/2" then shellCommand = "cmd.exe"else if OSType = "AIX" then shellCommand = "ksh"else shellCommand = "command.com"call STAFErrorTextinitiated = time('l')call time('r')crlf = x2c("0D0A")numeric digits 25loop = 1totok = 0error = 0errortxt = crlfcleanup = 0delimit='\'dc = '*'                                 /* Means don't care what is returned */logfile = STAFTest.logtestcase = "STAFTest"||time('s')||random(1,99)call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'call SysLoadFuncscall RxFuncAdd 'STAFLoadFuncs', 'RXSTAF', 'STAFLoadFuncs'call STAFLoadFuncs/* Load the STAF RxThread functions */call RxFuncAdd "RxThreadLoadFuncs", "RxThread", "RxThreadLoadFuncs"call RxThreadLoadFuncscall STAFRegister "STAFTest"if RESULT \= 0 then do  say "Error registering with STAF, rc="RESULT  exitendmachine = optionValue("MACHINE")if machine = '' then do  call autodoit 0 where dc "VAR" "resolve system string {STAF/Config/Machine}"  if STAFRC = 0 then machine = STAFResultendcall autodoit 0 "LOCAL" dc "VAR" "resolve system string {STAF/Config/EffectiveMachine}"if STAFRC = 0 then origmachine = STAFResultinternal = 0external = 0if optionTimes("PROCESSONLY") > 0 then do  do until loop = times    call autodoit 0 where dc "PROCESS" 'start command" shellCommand "title STAFTest-'||origmachine||"-"||loop 'parms "/c dir" wait'    loop = loop + 1  end  call Endit  call STAFUnRegister  exitendif optionTimes("PINGONLY") > 0 then do  do until loop = times    call autodoit 0 where "PONG" "PING" "PING"   loop = loop + 1  end  call Endit  call STAFUnRegister  exitendif optionTimes("GENWLONLY") > 0 then do  call GENWLSetup  do until loop = times    call GENWLRun    loop = loop + 1  end  call EndIt  call STAFUnRegister  exitendexternal = 1if optionTimes("INTERNALONLY") > 0 then external = 0internal = 1if optionTimes("EXTERNALONLY") > 0 then internal = 0if internal then do  if genwl then call GENWLSetup  call autodoit 0 where dc "VAR" "set system var For"||testcase||"={For"||testcase||"{Ever"||testcase||"}}"  call autodoit 0 where dc "VAR" "set system var Ever"||testcase||"={For"||testcase||"}"  call autodoit 0 where dc "VAR" "set var TraceFile={STAF/Config/STAFRoot}\bin\STAF.trc"  call autodoit 10 where dc "PROCESS" "start command" shellCommand "workdir" time('s')endif external then do  timestamp=date('w') date() time('l')  msglen = length(timestamp) + 26  level = substr('0', 1, 32, '0')  level = overlay('1', level, random(18,32))  call autodoit 0 where dc "LOG" "log global logname staftest level" level "message :"||msglen||":Log STAFTest Initiated on" timestamp  call autodoit 0 where dc "LOG" "log machine logname staftest level" level "message :"||msglen||":Log STAFTest Initiated on" timestamp  call autodoit 0 where dc "LOG" "log handle logname staftest level" level "message :"||msglen||":Log STAFTest Initiated on" timestampenddo until loop = times  if loud then do    say ""    do 3      say "==============================================================================="    end    say "Loop" loop "start. " totok "total test iterations run."    say "A total of" error "errors encountered with" maxerror "maximum errors allowed."    do 3      say "==============================================================================="    end    say ""  end  if internal then do    if genwl then call GENWLRun    call autodoit 0 where dc "PROCESS" "start command" shellCommand "title STAFTest-"||origmachine"-"loop "workload STAFTest var STAFVar=AutoVar env STAFEnv=AutoEnv"    if STAFRC > 0 then do      say "Unable to start process"      call STAFUnRegister      exit    end    PROCHandle = STAFResult    call autodoit 0 where dc "MISC" "version"    call autodoit 0 where dc "MISC" "machine "||machine    call autodoit 0 where dc "VAR" "resolve string {TraceFile}"    tracefile=STAFResult    call autodoit 0 where dc "MISC" "trace" "to FILE" tracefile    call autodoit 0 where dc "MISC" "trace" "to STDOUT"    call autodoit 0 where dc "MISC" "trace" "off All"    call autodoit 0 where dc "MISC" "trace" "list"    call autodoit 0 where dc "MISC" "trace" "on ServiceError"    call autodoit 0 where dc "MISC" "trace" "list"    call autodoit 7 where dc "PING" "STAF"    call autodoit 0 where dc "MISC" "trace" "off ServiceError"    call autodoit 0 where dc "MISC" "trace" "on All"    call autodoit 0 where dc "MISC" "trace" "off All"    call autodoit 7 where dc "MISC" "trace" "STAFStuff"    call autodoit 0 where "PONG" "PING" "ping"    call autodoit 0 where dc "VAR" 'set system var Start="'||initiated||'"'    call autodoit 0 where dc "VAR" "set system var When={Start}"    echoval = date('w')    call autodoit 0 where echoval "ECHO" "echo "||echoval    call autodoit 0 where dc "DELAY" "delay 1"    call autodoit 0 where dc "SERVICE" "list"    call autodoit 0 where dc "PROCESS" "query all"    call autodoit 0 where dc "PROCESS" "query handle "||PROCHandle    call autodoit 5 where dc "PROCESS" "query handle "||time('s')||time('s')    call autodoit 12 where dc "PROCESS" "free handle "||PROCHandle    call autodoit 0 where dc "TRUST" "set default level 5"    trustmachine = "STAFTest"||time('s')||random(1,99)    call autodoit 0 where dc "TRUST" "set machine "||trustmachine||" level "||random(1,5)    call autodoit 23 where dc "TRUST" "delete machine "||time('s')    call autodoit 24 where dc "TRUST" "set machine badlevel level 99"    call autodoit 0 where dc "TRUST" "list"    call autodoit 0 where dc "TRUST" "get machine" trustmachine    call autodoit 0 where dc "TRUST" "delete machine" trustmachine    call autodoit 0 where dc "HANDLE" "query all"    call autodoit 0 where dc "HANDLE" "query name STAFTest"    call autodoit 0 where dc "HANDLE" "query all INPROCESS"    call autodoit 0 where dc "VAR" "list"    call autodoit 13 where dc "VAR" "get system var Machine"    call autodoit 0 where dc "VAR" "resolve system string {When}"    call autodoit 16 "ausvmr.austin.ibm.com" dc "PING" "ping"    call autodoit 0 where dc "FS" "copy file {STAF/Config/STAFRoot}\bin\staf.cfg tofile {STAF/Config/STAFRoot}\bin\STAFTest.XXX tomachine" machine    call autodoit 17 where dc "FS" "copy file {STAF/Config/STAFRoot}\bin\staf.cfg tofile {STAF/Config/STAFRoot}\bin\STAFTest.YYY tomachine" machine "FAILIFNEW"    call autodoit 17 where dc "FS" "copy file {STAF/Config/STAFRoot}\bin\staf.cfg tofile {STAF/Config/STAFRoot}\bin\STAFTest.XXX tomachine" machine "FAILIFEXISTS"    call autodoit 17 where dc "FS" "get file {STAF/Config/STAFRoot}\bin\STAFTest.YYY"    call autodoit 0 where dc "FS" "get file {STAF/Config/STAFRoot}\bin\STAFTest.XXX"    call autodoit 2 where dc "UNKNOWNSERVICE" ""    call autodoit 16 time('s')||STAFHandle||time('s') dc "VAR" "GET VAR BADHANDLE"    call autodoit 7 where dc "PING" "INVALIDREQUEST"    call autodoit 13 where dc "VAR" "resolve system string {UNKNOWNVAR"||time('s')||"}"    call autodoit 14 where dc "VAR" "resolve system string {For"||testcase||"}"    call autodoit 15 where dc "VAR" "resolve system string {BadVar"    call autodoit 16 "UNKNOWNMACHINE"||time('s') dc "PING" "ping"    queuepriority = random(1,5000)    if translate(where) = "LOCAL" then QHandle = STAFHandle    else QHandle = PROCHandle    call autodoit 0 where dc "QUEUE" "queue handle" QHandle "message" testcase||"/DefaultTest"    call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" 1 "message" testcase||"/Priority-1-Test"    call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" queuepriority "message" testcase||"/QueueTest"    call autodoit 0 where dc "QUEUE" "list handle" QHandle    if translate(where) = "LOCAL" then    do      call autodoit 0 where dc "QUEUE" "peek handle" QHandle      call autodoit 0 where dc "QUEUE" "peek handle" QHandle "contains Queue"      call autodoit 0 where dc "QUEUE" "peek handle" QHandle "contains Queue contains Test"      call autodoit 0 where dc "QUEUE" "peek handle" QHandle "priority 1"      call autodoit 0 where dc "QUEUE" "get handle" QHandle "priority 1"      call autodoit 0 where dc "QUEUE" "get handle" QHandle "contains Default"      call autodoit 29 where dc "QUEUE" "get handle" time('s')||time('s')      call autodoit 0 where dc "QUEUE" "get handle" QHandle      call autodoit 29 where dc "QUEUE" "get handle" QHandle      call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" queuepriority "message" testcase||"/QueueTest"      call autodoit 0 where 1 "QUEUE" "delete handle" QHandle      call autodoit 29 where dc "QUEUE" "peek handle" QHandle      call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" 1 "message" "STAF/Queue"      call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" 2 "message" testcase||"/QueueTest"      call autodoit 0 where dc "QUEUE" "queue handle" QHandle "priority" 2 "message" testcase||"/QueueTest"      call autodoit 0 where dc "QUEUE" "list handle" QHandle      call autodoit 0 where 2 "QUEUE" "delete handle" QHandle "contains Test"      call autodoit 0 where 1 "QUEUE" "delete handle" QHandle "priority 1"      call autodoit 29 where dc "QUEUE" "peek handle" QHandle      call autodoit 5 where dc "QUEUE" "list handle" QHandle||time('s')||time('s')    end    call autodoit 0 where dc "SEM" "event" testcase "post"    call autodoit 0 where dc "SEM" "event" testcase "query"    call autodoit 0 where dc "SEM" "event" testcase "reset"    call autodoit 0 where dc "SEM" "event" testcase "pulse"    call autodoit 0 where dc "SEM" "list event"    call autodoit 37 where dc "SEM" "event" testcase "wait 100"    call autodoit 0 where dc "SEM" "mutex" testcase "request 100"    call autodoit 0 where dc "SEM" "mutex" testcase "query"    call autodoit 0 where dc "SEM" "list mutex"    call autodoit 0 where dc "SEM" "mutex" testcase "release"    call autodoit 34 where dc "SEM" "mutex" STAFHandle||time('s') "query"    call autodoit 0 where dc "SEM" "event" testcase "delete"    call autodoit 0 where dc "FS" "help"    call autodoit 0 where dc "HANDLE" "help"    call autodoit 0 where dc "MISC" "help"    call autodoit 0 where dc "PROCESS" "help"    call autodoit 0 where dc "QUEUE" "help"    call autodoit 0 where dc "SERVICE" "help"    call autodoit 0 where dc "TRUST" "help"    call autodoit 0 where dc "VAR" "help"    call autodoit 0 where dc "SEM" "help"    call autodoit 12 where dc "process free handle" PROCHandle    call autodoit 0 where dc "process stop handle" PROCHandle    call SysSleep 2    call autodoit 11 where dc "process stop handle" PROCHandle    call autodoit 0 where dc "process free handle" PROCHandle

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -