Using Test Script Services from an External C or C++ Program
|

Arguments of TSSEnvironmentOp()
The following table describes the valid values of the first argument (envVar
) of TSSEnvironmentOp()
. Note the following about EVAR_LogData_control
and EVAR_LogEvent_control
:
- They correspond to the check boxes in the TestManager TSS Environment Variables dialog box. Use this dialog box to set logging and reporting options at the suite rather than the script level.
- They are more flexible alternatives to
EVAR_Log_level
and EVAR_Report_level
.
Name
|
Type/Values/(default)
|
Contains
|
EVAR_Delay_dly_scale |
integer 0-2000000000 percent (100) |
The scaling factor applied globally to all timing delays. A value of 100%, which is the default, means no change. A value of 50% means one-half the delay, which is twice as fast as the original; 200% means twice the delay, which is half as fast. A value of zero means no delay. |
EVAR_LogData_control |
NONE ,
PASS ,
FAIL ,
WARNING ,
STOPPED ,
INFORMATIONAL ,
COMPLETED ,
UNEVALUATED ANYRESULT |
Flags indicating the level of detail to log. Specify one or more. These result flags (except the last, which specifies everything) correspond to flags entered with the TSSLogEvent, TSSLogMessage, TSSTestCaseResult, TSSCommandEnd, and TSSLogCommand functions. For example, specifying FAIL selects everything logged by functions that specified flag FAIL. |
EVAR_LogEvent_controlL |
NONE ,
PASS ,
FAIL ,
WARNING ,
STOPPED ,
INFORMATIONAL ,
COMPLETED ,
UNEVALUATED ,
TIMERS ,
COMMANDS ,
ENVIRON ,
STUBS ,
TSSERROR ,
TSSPROXYERROR ANYRESULT |
Flags indicating the level of detail to log for reports. Specify one or more. The first nine result flags (NONE through UNEVALUATED) correspond to flags specified with the TSSLogEvent, TSSLogMessage, TSSTestCaseResult, TSSCommandEnd, and TSSLogCommand functions. The other flags (TIMERS through TSSPROXYERROR) indicate the event objects. For example, FAIL plus COMMANDS selects for reporting all commands that recorded a failed result. ANYRESULTS selects everything. |
EVAR_Log_level |
string "OFF" ("TIMEOUT") "UNEXPECTED" "ERROR" "ALL" |
The level of detail to log:
-
OFF - Log nothing.
-
TIMEOUT - Log emulation command time-outs.
-
UNEXPECTED - Log time-outs and unexpected responses from emulation commands.
-
ERROR - Log all emulation commands that set IV_error to a nonzero value. Log entries include IV_error and IV_error_text .
-
ALL - Log everything: emulation command types and IDs, script IDs, source files, and line numbers.
|
EVAR_Record_level |
"MINIMAL" "TIMER" "FAILURE" ("COMMAND") "ALL" |
The level of detail to log for reporting:
-
MINIMAL - Record only items necessary for reports to run. Use this value when you do not want user activity to be reported.
-
TIMER - MINIMAL plus start_time and stop_time emulation commands. Reports do not contain response times for each emulation command, emulation command failure does not appear, and the result file for each virtual tester is small. Use this setting if you are not concerned with the response times or pass/fail status of individual emulation commands.
-
FAILURE - TIMER plus emulation command failures and some environment variable changes. Use this setting if you want the advantages of a small result file but to show also that no emulation command failed.
-
COMMAND - FAILURE plus emulation command successes and some environment variable changes.
-
ALL - COMMAND plus all environment variable changes. Complete recording.
|
EVAR_Suspend_check |
string ("ON") "OFF" |
Controls whether you can suspend a virtual tester from a Monitor view:
-
ON - A suspend request is checked before beginning the think time interval by each send emulation command.
- OFF - Disable suspend checking.
|
EVAR_Think_avg |
integer 0-2000000000 ms (5000) |
The average think-time delay (the amount of time that, on average, a user delays before performing an action). |
EVAR_Think_cpu_dly_scale |
integer 0-2000000000 ms (100) |
The scaling factor applied globally to CPU (processing time) delays. Used instead of EVAR_ Think_dly_scale if EVAR_ Think_avg is less than EVAR_ Think_cpu_threshold. Delay scaling is performed before truncation (if any) by EVAR_ Think_max. |
EVAR_Think_cpu_threshold |
integer 0-2000000000 ms (0) |
The threshold value used to distinguish CPU delays from think-time delays. |
EVAR_Think_def |
string "FS" "LS" "FR" ("LR") "FC" "LC" |
The starting point of the think-time interval:
-
FS - the submission time of the previous send emulation command
-
LS - the completion time of the previous send emulation command
-
FR - the time the first data of the previous receive emulation command was received
-
LR - the time the last data of the previous receive emulation command was received, or LS if there was no intervening receive emulation command
-
FC - the submission time of the previous connect emulation command (uses the IV_fc_ts internal variable)
-
LC - the completion time of the previous connect emulation command (uses the IV_lc_ts internal variable)
|
EVAR_Think_dist |
string ("CONSTANT") "UNIFORM" "NEGEXP" |
The think-time distribution:
-
CONSTANT - sets a constant distribution equal to Think_avg
-
UNIFORM - sets a random think-time interval distributed uniformly in the range: [EVAR_Think_avg - EVAR_Think_sd , EVAR_Think_avg + EVAR_Think_sd ]
-
NEGEXP - sets a random think-time interval approximating a bell curve with EVAR_Think_avg equal to standard deviation
|
EVAR_Think_dly_scale |
integer 0 - 2000000000 ms (100) |
The scaling factor applied globally to think-time delays. Used instead of EVAR_ Think_cpu_dly_scale if EVAR_ Think_avg is greater than EVAR_ Think_cpu_threshold. Delay scaling is performed before truncation (if any) by EVAR_Think_max. |
EVAR_Think_max |
integer 0-2000000000 ms (2000000000) |
A maximum threshold for think times that replaces any larger setting. |
EVAR_Think_sd |
integer 0-2000000000 ms (0) |
Where EVAR_ Think_dist is set to UNIFORM, specifies the think-time standard deviation. |
The following table describes the valid values of the second argument (envOp
) of TSSEnvironmentOp()
.
EVOP_eval |
Operate on the value at the top of the variable's stack. |
EVOP_pop |
Remove the variable value at the top of the stack. |
EVOP_push |
Push a value to the top of a variable's stack. |
EVOP_reset |
Set the value of a variable to the default and discard any other values in the stack. |
EVOP_restore |
Set the saved value to the current value. |
EVOP_save |
Save the value of a variable. |
EVOP_set |
Set a variable to the specified value. |
Example: Manipulating Environment Variables
This example illustrates how to manipulate environment variables.
#include
#include
void errorexit(void);
int main(int argc, char *argv[])
{
EvarValue ev;
if (s = getenv("RTTSS_HOST"))
thinfo.host = s;
else {
fprintf(stderr, "Environment variable RTTSS_HOST is not
defined\n");
exit(1);
}
thinfo.port = 0;
if (s = getenv("RTTSS_PORT"))
thinfo.port = (u16) strtoul(s, NULL, 10);
thinfo.vtid = 0;
if (s = getenv("RTTSS_VTID"))
thinfo.vtid = strtol(s, NULL, 10);
if ((rc = TSSConnect(thinfo.host, thinfo.port, thinfo.vtid))
!= TSS_OK) {
fprintf(stderr, "TSSConnect failed\n");
exit(-1);
}
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("At start, value is \xd4 %s\xd5 \n", ev.envStr);
ev.envStr = "NEGEXP";
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_push, &ev) != TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("After push, value is \xd4 %s\xd5 \n", ev.envStr);
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_pop, NULL) != TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("After pop, value is \xd4 %s\xd5 \n", ev.envStr);
ev.envStr = "NEGEXP";
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_set, &ev) != TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("After set, value is \xd4 %s\xd5 \n", ev.envStr);
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_save, NULL) != TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_reset, NULL) != TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("After save and reset, value is \xd4 %s\xd5 \n", ev.envStr);
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_restore, NULL) !=
TSS_OK)
errorexit();
if (TSSEnvironmentOp
(EVAR_Think_dist, EVOP_eval, &ev) != TSS_OK)
errorexit();
printf("After restore, value is \xd4 %s\xd5 \n", ev.envStr);
return 0;
}
void errorexit(void)
{
char msg[256];
int msglen;
int r;
msglen = sizeof(msg);
r = TSSErrorDetail(msg, &msglen);
fprintf(stderr, "TSS call failed, code %d: %s\n", r, msg);
exit(1);
}
