Virtual Tester as a Thread or Task
Automated Testing
·
Configuration of Virtual Tester execution.
Virtual Tester as a Thread or Task
When using a flat-memory RTOS model, the Virtual Testers can run as a process
thread or as a task in order to avoid conflicts with the application under test's global
variables.
Moreover, the Target Deployment Port is fully reentrant. Therefore, you can run
multiple instances of a Virtual Tester in the same process. The system runs each
process as a different process thread.
In this case, the Test Script Compiler generates the virtual tester source code without
a
ma n )
function, but with a user function.
i (
To configure System Testing to run in multi-threaded mode, select the Not shared
option in Test Script Compiler Settings.
Multiple Instances of a Same Virtual Tester
Multiple instances of a same Virtual Tester can run simultaneously on a same target.
In this case, you need to protect the Virtual Tester threads in the same process against
access to global variables.
The Not Shared setting in Test Script Compiler Settings allows you to specify global
variables in the test script that should remain unshared by separate Virtual Tester
threads. When selected, multiple instances of a Virtual Tester can all run in the same
process.
You can share some global static variables in order to reuse data among different
Virtual Testers by using the SHARE command in the .pts test script. See the Rational
Test RealTime Reference Manual for information about the System Testing Language.
Virtual Tester Thread Starter Program
In a multi-thread environment, the only way to start the Virtual Tester threads is to
write a program, specifying:
The name of the execution trace file
The name of the instance to be started
To do this, use the ATL_T_ARG structure, defined in the ats.h header file of the
Target Deployment Port.
Example
#include <stdio.h>
#include <sched.h>
#include <pthread.h>
#include <errno.h>
#include "TP.h"
extern ATL_T_THREAD_RETURN *start(ATL_PT_ARG);
int main(int argc, char *argv[])
199