IBM Rational Test RealTime V7.5 Integration with IBM Telelogic Rhapsody V7.4

IBM® Rational® Test RealTime is cross-platform software for component testing and runtime analysis. This article explains how to integrate it with IBM® Telelogic® Rhapsody® and then test the integration.

Luc Auvray (luc.auvray@fr.ibm.com), Staff Software Engineer, IBM

Luc Auvray is an IBM software quality engineer and team lead in the Rational Toulouse development lab, in France. He currently works on IBM Rational Test RealTime, IBM Rational Service Tester for SOA and Performance Tester in the System Verification Team.



28 April 2009

Also available in Chinese

Install the Rational Test RealTime integration for Rhapsody

Installation involves these three steps:

  1. Create Rational Test RealTime menus in Rhapsody.
  2. Create a new Rational Test RealTime configuration in Rhapsody.
  3. Update the batch files for Rational Test RealTime.

Create Rational Test RealTime menus in Rhapsody

  1. Launch Rhapsody by opening the following example that is provided with the product:

    C:\Program Files\Telelogic\Rhapsody 7.4\Samples\CSamples\pacemaker\pacemaker.rpy
  2. In Rhapsody, click Tools > Customize. The Helpers window opens.
  3. Click the New button (new button icon) to create a new customized menu called Test RealTime options.

    In the Command field, type the following line:
  4. C:\Program Files\Rational\TestRealTime\bin\intel\win32\TestRTcl.exe
  5. In Arguments, type: TestRTRhap.opt
  6. Select Show in Tools menu, as shown in Figure 1, and then click Apply.
Figure 1. New Test RealTime options menu
list of menus above Helper parameters

  1. Click the New button (new button icon) to create a new customized menu called Test RealTime Results.
  2. In Command, type the following line: C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe
  3. In Arguments, type: */*/attolccReport.xtp
  4. Select Show in Tools menu, as shown in Figure 2, and then click Apply.
Figure 2. New Test RealTime Results menu
same list of menus above Helper parameters

  1. Click the New button (new button icon) to create a new customized menu called Test RealTime Clean.
  2. In Command, type the following line: C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe
  3. In Arguments, type: -clean */*/attolccReport.xtp
  4. Select Show in the Tools menu, as shown in Figure 3, and then click Apply.
Figure 3. New Test RealTime Clean menu
longer list of menus above Helper parameters

  1. Click the New button (new button icon) to create a new customized menu called Test RealTime Clean All
  2. In Command, type the following line: C:\Program Files\Rational\TestRealTime\bin\intel\win32\studioreport.exe
  3. In Arguments, type: -cleanAll */*/attolccReport.xtp
  4. Select Show in the Tools menu, as shown in Figure 4, and then click OK.
Figure 4. NewTest RealTime CleanAll menu
updated list of menus

Create a new Rational Test RealTime configuration in Rhapsody

  1. In the Rhapsody project tree, right-click <<Executable>> EXE, as shown in Figure 5, and then click Set as Active.
Figure 5. Rhapsody project tree in the Entire Model View
EXE is under pacemaker Components in the tree

  1. To create a new configuration, copy the existing Host configuration and rename the copy Host_Coverage.
  2. Create a copy of the Host configuration in the Configurations node. The new configuration is automatically named Host_copy, as shown in Figure 6.
Figure 6. Copy of Host
Host, Host_copy, and target configurations under EXE

  1. Right-click Host_copy, as shown in Figure 7, and click Set as Active.
Figure 7. Host_copy
Host_copy highlighted in the Rhapsody tree

  1. Double click the Host_copy configuration and rename it Host_Coverage.
Figure 8. Rename the Host copy
Name field on General tab, with 8 other tabs

  1. Click the Settings tab and, in the Environment drop-down list, select the appropriate compiler, as shown in Figure 9.
Figure 9. Select a compiler Click to enlarge
Microsoft selected, Default button on right

  1. Ensure that Instrumentation Mode is set to Animation, as shown in Figure 10.
Figure 10. Set Instrumentation Mode
drop-down list on left, Advanced button on right

Click to enlarge



  1. Click the Properties tab and select View Common > All, as shown in Figure 11.
Figure 11. Select All
menu item

  1. Expand the C_CG properties and select the build environment.
  2. Change the InvokeMake property from msmake.bat to msmakeRTRT.bat, as shown in Figure 12 (or CygwinMake.bat to CygwinMakeRTRT.bat, as appropriate in your environment).
Figure 12. Change the property name
Properties is one of eight tabs

Click to enlarge

  1. Click OK.

Update the "Make batch file" for Rational Test RealTime

This section describes how to update the "Make batch file" for compiling with Cygwin (a Linux®-like environment for Windows) or Microsoft® Visual Studio® Version 6.

  1. For Cygwin: Update the CygwinMake.bat file
  2. For Microsoft Visual Studio V6: Update the msMake.bat file

Update the CygwinMakeRTRT.bat file

  1. Copy and rename the following file: <RhapsodyInstallDir>\Share\etc\CygwinMake.bat into: <RhapsodyInstallDir>\Share\etc\CygwinMakeRTRT.bat
  2. Edit the CygwinMakeRTRT.bat file and make the following changes: Set the environment variable ATLTGT to the selected build environment: set ATLTGT=%TESTRTDIR%\targets\cpcgnu Add the following code: set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT=<RhapsodyInstallDir> -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\Program Files\Telelogic\Rhapsody74\Share" Add this line of code at the end of the make line: CC="attolcc %RT_OPT% -- gcc" LINK_CMD="attolcc %RT_OPT% -- g++"

Listing 1 shows what the CygwinMakeRTRT.bat file should look like:

Troubleshooting

RT_OPT=-opt...
Listing 1. Sample CygwinMakeRTRT.bat file
@echo off
PATH=c:\cygwin\bin;%PATH%
if "%2"=="" set target=all
if "%2"=="build" set target=all
if "%2"=="rebuild" set target=clean all
if "%2"=="clean" set target=clean

set RT_OPT=-opt=../../TestRTRhap.opt 
-act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl 
-env_OMROOT="C:\Progra~1\Telelogic" 
-noinstrdir="C:\ Progra~1\Telelogic\Rhapsody74\Share"

echo Setting environment for Cygwin
echo "make.exe"
make -s %target% -f %1 CC="attolcc %RT_OPT% -- gcc" LINK_CMD="attolcc %RT_OPT% -- g++"

Update the msmakeRTRT.bat file

  1. Copy and rename the following file: <RhapsodyInstallDir>\Share\etc\msmake.bat
    into:
    <RhapsodyInstallDir>\Share\etc\msmakeRTRT.bat
  2. Edit the msmakeRTRT.bat file to perform the following changes:
    • Add the following line:
      set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl -env_OMROOT=<RhapsodyInstallDir> -env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\Program Files\Telelogic\Rhapsody74\Share"
    • Add the followings line at the end of the make line: CC="attolcc %RT_OPT% -- cl" LINK_CMD="attolcc %RT_OPT% -- link"
  3. Edit the Vcvars32.bat file to set the environment variable ATLTGT to the selected build environment: set ATLTGT=%TESTRTDIR%\targets\cvisual6

Troubleshooting

Listing 2 shows what the msmakeRTRT.bat file should look like.

Listing 2. Sample msmakeMakeRTRT.bat file
@echo off
if "%2"=="" set target=all
if "%2"=="build" set target=all
if "%2"=="rebuild" set target=clean all
if "%2"=="clean" set target=clean
rem ensure that the following bolded code is on one line 
set RT_OPT=-opt=../../TestRTRhap.opt -act=../../TestRTRhap.opt_act -treatmt=Rhaptrmt.pl 
-env_OMROOT="C:\Progra~1\Telelogic" -noinstrdir="C:\ Progra~1\Telelogic\Rhapsody74\Share"

set MAKEFLAGS=
call "C:\Program Files\Telelogic\Rhapsody 7.4\Share\etc\Vcvars32.bat" x86
echo ''nmake.exe
rem ensure that the following bolded code is on one line
nmake /nologo /S /F %1 %target% %3 %4 %5 %6 CC="attolcc %RT_OPT% -- cl" LINK_CMD="attolcc 
%RT_OPT% -- link"

Listing 3 shows what the Vcvars32.bat file should look like.

Listing 3. Sample Vcvars32.bat file
@echo off
rem
rem Root of Visual Developer Studio Common files.
....

set VcOsDir=
set VSCommonDir=

rem ATLTGT for TestRealTime
set ATLTGT=%TESTRTDIR%\targets\cvisual6

An example of instrumentation in Rhapsody with Microsoft Visual Studio V6

Edit the Host_Coverage configuration

  1. Open the Host_Coverage configuration and, on the Settings pane, and select Microsoft.
  2. Ensure that the following options are set, as shown in Figure 13.

    • Instrumentation mode is set to Automation;
    • Environment is set to Microsoft
    • Build is set to Debug
Figure 13. Verify the Host_Coverage settings
Specified options shown on Settings tab

Click to enlarge



  1. On the Properties tab, select View all,
  2. In C_CG, under Microsoft®, change the InvokeMake setting from msmake.bat to msmakeRTRT.bat, as shown in Figure 14.
Figure 14. Properties
changed InvokeMake setting

Click to enlarge



  1. Click OK.

Enable Rational Test RealTime instrumentation

  1. From the Rhapsody project, select Tools > Test RealTime options, as shown in Figure 15.
Figure 15. Open tools
menu item

  1. Click Enable, as shown in Figure 16.
Figure 16. Enable button
square button on right side of window

  1. If necessary, you can change the settings. For example, in Other Options add -verbose, as shown in Figure 17.
Figure 17. Specify options
Runtime Analysis Setup options

  1. Click Apply, and then OK.

Add a Rational Test RealTime dump point to the model

Rational Test RealTime is designed for embedded and real-time systems, which are often designed to never stop. In this case, runtime analysis results are evaluated in the target memory endlessly, until you decide to dump them back to the host machine.

Therefore, you must add a dump command in one of the Pacemaker transitions. You can do this:

  • From the Packages tree.
  • From the PaceMaker state chart.

Add a dump command from the Packages tree

  1. Click Enable.
  2. Select the dump command in the Packages tree (Figure 18).
Figure 18. Select "from On"
States Off Incoming transitions from On

  1. On the General tab, in the action code (Action field), add the following statement, as shown in Figure 19. #pragma attol insert _ATCPQ_DUMP(1); printf("TestRT results dumped!\n");
Figure 19. Specify transition action
Name, Stereotype, Target, Trigger, Guard, and Action

Click to enlarge



Add a dump command from the PaceMaker state chart

  1. Select and double-click the evOFF transition, as shown in Figure 20.
Figure 20. The evOFF transition
chart with OFF and AVIMode elements

  1. On the General tab, in the Action code, add the following statement, as shown in Figure 21. #pragma attol insert _ATCPQ_DUMP(1); printf("TestRT results dumped!\n");
Figure 21. Specify transition action
Name, Stereotype, Target, Trigger, Guard, and Action

  1. Click OK.

Generate and build code

  1. To generate the code, select Code > Generate > Ctrl-F7 and click Yes, as shown in Figure 22.
Figure 22. Create Host_Coverage directory
Rhapsody dialog prompting you to create a directory

  1. To build the generated code, select Code > Build > Build EXE.exe (F7), as shown in Figure 23.
Figure 23. Build the code
menu command

Note: only components with the modified configuration will be instrumented.

When the build is complete, the Build tab displays a Build Done status, as shown in Figure 24.

Figure 24. Build Messages
Severity, Model Element, and Description

Run the instrumented application

  1. Click the Exclamation (!) button, as shown in Figure 25.
Figure 25. Exclamation button
button below the Save (diskette) icon

  1. Click on following icon, as shown in Figure 26.
Figure 26. Click the Run button
icon with forward triangle (play) and running figure

  1. Select Tools > Animated State chart, as shown in Figure 27.
Figure 27. Select Animated State chart
menu command

  1. Select the Pacemaker[0] instance, as shown in Figure 28, and then click OK.
Figure 28. Choose the instance
list shows Instance and Class

The state chart opens in the default OFF state, as shown in Figure 29.

Figure 29. State chart in OFF state
chart with nine elements

Click to enlarge



  1. You can interact with the system under test. Click the Event Generator button, as shown in Figure 30.
Figure 30. Click Event Generator
button shows red lightning bolt

  1. Click Select and select the Pacemaker[0] instance. In the Event list, select an event, as shown in Figure 31.
Figure 31. Select an event
evAAIMode selected in drop-down list

  1. Click OK.

View Rational Test RealTime results

  1. Open the Coverage results on the Rational Test RealTime GUI. Click the Stop button to stop the execution, as shown in Figure 32.
Figure 32. Click Stop
button shows open hand over red octagon stop sign

  1. In Rhapsody, select Tools > Test RealTime Results. This opens Rational Test RealTime with the results, as shown in Figure 33.
Figure 33. Code Coverage [attoIccReport]
report tree left, chart middle, project browser right

Click to enlarge



Add instrumentation to the Rhapsody framework for memory profiling

The memory profiling report can show many memory leaks. This is because the Rhapsody framework performs memory allocations that are not visible at the application level. To work around this, you must include the Rhapsody framework in the instrumentation.

  1. Make a copy of the original msbuild.mak file located in C:\Program Files\Telelogic\Rhapsody74\Share\LangC
  2. For Microsoft makefiles, you build instrumented libraries with standard libraries. To do this, duplicate the line that makes the libraries (not the .dll): once to clean existing intermediate files generated by the previous build, and a second time to build the same libraries with Rational Test RealTime instrumentation and a Rational Test RealTime prefix:

Listing 4 shows an example before modifications for the .axf libraries.

Listing 4. Code before modification
oxflibs :
	cd oxf
	$(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET)
	$(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET)
	$(MAKE) -f msoxf.mak CFG="distrib_oxf" $(BUILD_TARGET)
	$(MAKE) -f msoxf.mak CFG="distrib_oxfinst" $(BUILD_TARGET)
	cd ..

Listing 5 shows the same example after modifications.

Listing 5. Code with duplicated lines
oxflibs :
	cd oxf
	$(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET)
	$(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) LIB_PREFIX=RTMS clean
	$(MAKE) -f msoxf.mak CFG="oxf" $(BUILD_TARGET) LIB_PREFIX=RTMS 
	CPP="Attolcc -memprolib --no_sys_include -noTDP -- cl"
	$(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET)
	$(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) LIB_PREFIX=RTMS clean
	$(MAKE) -f msoxf.mak CFG="oxfinst" $(BUILD_TARGET) LIB_PREFIX=RTMS 
	CPP="Attolcc -memprolib --no_sys_include -noTDP -- cl"
	etc ...  
   cd ..
  1. Rebuild the libraries of the Rhapsody framework with the appropriate memory profiling tracking: click Code > Build Framework, as shown in Figure 34.
Figure 34. Rebuild the libraries
menu command

After the framework instrumentation and build process is over (which takes approximately 5 minutes), rebuild the Pacemaker EXE file to integrate the new instrumented libraries of the framework into the final executable code.

Generate more runtime analysis results

  1. In Rhapsody, select Tools > Test RealTime Options.
  2. Select the Runtime Trace, Memory, or Performance Profiling tools that you want to enable, as shown in Figure 35.
Figure 35. Select tools to enable
Code Coverage Levels and Feature Activation (C/C++)

  1. Click OK and click Code > Rebuild to rebuild your component, as shown in Figure 36.
Figure 36. Rebuild
menu command

  1. Run the instrumented application one more time to view the results in the animated state chart. Do not forget to shoot the event evOFF which permits to fire the transition that contains the dump command).
  2. In Rhapsody, select Tools > Test RealTime Results to display the corresponding reports in Rational Test RealTime, as shown in Figure 37.
Figure 37. View results
tree view on left, charts on rightClick to enlarge

Summary of what you have learned

First, to install the Rational Test RealTime integration for Rhapsody, you completed these steps:

  1. Created Rational Test RealTime menus in Rhapsody
  2. Created a new configuration
  3. Updated the make batch files

Next, you enabled and used an example of Rational Test RealTime instrumentation in Rhapsody with Microsoft Visual Studio V6. You completed these tasks:

  1. Edited the Host_Coverage configuration
  2. Enabled Rational Test RealTime instrumentation
  3. Added a Rational Test RealTime dump point to the model
  4. Generated and built code
  5. Ran the instrumented application
  6. Viewed Rational Test RealTime results
  7. Added instrumentation to the Rhapsody Framework for memory profiling
  8. Generated more runtime analysis results

See Resources for further information.

Resources

Learn

Get products and technologies

  • Download IBM Rational Test RealTime V7.5, a cross-platform automated testing solution for systems developers who are creating complex systems for embedded, real-time, and other cross-platform, distributed applications.
  • Try Rhapsody, which enables teams of engineers to develop real-time embedded applications in a collaborative environment, sharing and communicating design artifacts across disciplines.
  • Download trial versions of IBM Rational software.
  • Download these IBM product evaluation versions and get your hands on application development tools and middleware products from DB2®, Lotus®, Tivoli®, and WebSphere®.

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into Rational software on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=385312
ArticleTitle=IBM Rational Test RealTime V7.5 Integration with IBM Telelogic Rhapsody V7.4
publish-date=04282009