How do you control the dump of coverage result with IBM Rational Test RealTime (TestRT)?
The Coverage dump happens, when the program under test exits. If program contains a loop and never terminate, it is necessary to make the dump manually.
To control the dump, you need to customise the Target Deployment Port (TDP) with the macro RTRT_OPEN_MODE and add the pragma _ATCPQ_DUMP within your code.
How data retrieval mechanism works
First here is short description about how Test RealTime uses the data retrieval mechanism.
The running application (test driver or instrumented application) opens the file or connection at initialization time using priv_init/usr_init. Then it fulfils the atl_buffer with ASCII characters on each error detection or on dump request.
As soon as the atl_buffer is full, Test RealTime cllas the priv_writeln/usr_writeln to flush the data on the file or connection. Then Test RealTime continues the application or the dump report without closing the file or connection. Once the dump report ends, the application continues normally.
At the end of the test driver or end of the application (on exit) the file/connection is then closed executing priv_close/usr_close.
In your case, to control the dump you force the dump at a specific location in your code using the following things.
This macro override the open mode used to open the result file by priv_open() method when RTRT_IO = RTRT_STD.
This is an instrumentation pragma that you must add into your source code to introduce a manual trace dump, when required for runtime analysis tools.
- Open your XDP file with the TDP editor.
- Click Library Settings > Data retrieval and Error message output > IO Settings > set RTRT_OPEN_MODE.
- Add the pragma in your source, where you want to start the dump
#pragma attol insert _ATCPQ_DUMP(<reset>);
Where <reset> can be one of the following value or combination of them with binary OR.
|_ATCPQ_RESET||does a dump And when the execution will finish a new dump will be done.|
|_ATCPQ_CLOSE||closes the result file at the end of the requested dump.|
|_ATCPQ_COV||dumps coverage results.|
|_ATCPQ_RESET_COV||resets the coverage status after the dump.|
|_ATCPQ_QTF||dumps performance results|
|_ATCPQ_RESET_QTF||resets the performance status after the dump|
|_ATCPQ_FREE_FRQ||frees all old memory blocks after the dump.|
|_ATCPQ_PRF||dumps memory profiling report.|
|_ATCPQ_CHK_WL||dumps ABWL, and FMWL report|
|_ATCPQ_ALL||to dump all of them|
_ATCP_RESET is set to _ATCPQ_ALL as default but can be defined on compilation command.
0 or 1 does the same action as _ATCPQ_ALL.
You can insert this pragma automatically by clicking the Insert Dump button in the Text Editor toolbar.
Alternatively, do a right click, where you want to add the pragma.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
Once RTRT_OPEN_MODE has been set, find in your source code where it's the best place to make the dump.
FIRST CODE EXAMPLE
SECOND CODE EXAMPLE
This example uses _ATCPQ_RESET and _ATCPQ_CLOSE Therefore the code does an open action on the next result dump with the runtime priv_open method.