Skip to main content

Testing an Ada package with the pragma 'preelaborate'

Technote (FAQ)


Question

How can you test an Ada package with Component Testing for Ada in Rational Test RealTime. The package contains the package 'preelaborate'.

Cause

If an Ada package contains a pragma preelaborate, all the packages that this package uses also require a pragma preelaborate.

The Component Testing for Ada runtime library does not support this pragma. Therefore any dependency from the code under test to the runtime library causes a compiler error.

Answer

The following methods can avoid the dependencies.

  1. Instrument the code under test without the option -INIT_UNSUPPORTED.
    Then the instrumentor comments out the pragma preelaborate.

    Now the runtime library no longer needs to contain the pragma preelaborate. You get a warning message to indicate that the instrumentor commented out the pragma.

    TestRT Coverage Ada - WARNING: Option -INIT_UNSUPPORTED should be used to not comment the pragma Preelaborate

  2. Test the code as a black box.
    This means that the test entry point is outside the package under test. Use the instruction Begin, without any parameters, in the test script. Now you can test the code without instrumenting it. However you cannot access private elements of the package under test..

Copyright and trademark information

IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.

Document information

Rational Test RealTime

Component Testing: Ada


Software version:
7.5.0.3


Operating system(s):
AIX, HP-UX, Linux, Solaris, Windows


Reference #:
1417683


Modified date:
2010-11-23

Translate my page

Content navigation