Enabling dynamic instrumented code coverage and generating statistics in the command line

You can enable code coverage and instrument your application from the command line.

About this task

You can only instrument code from a command line if you are working on the same computer where the you installed the product.

Procedure

  1. Configure your environment:
    1. Set the following environment variables:
      • ECLIPSE_HOME - The installation directory for eclipse. If not defined, this environment variable defaults to the default Rational® installation directory.
      • JAVA_HOME - The installation directory for Java™. <JAVA_HOME>/bin must contain java.exe. If not defined, this environment variable defaults to the default RAD JRE directory.
    2. Add the RLC.jar file to the classpath: <RAD_PLUGINS>\com.ibm.rational.llc.engine_<version&date>\RLC.jar)
  2. Run the appinfo script: appinfo.bat/sh -in <class-dir> -probescript <probescript-file> [-baseline <baseline-file>]
    • <class-dir>: "Path separated" list of the directories which contain the class files that are to be analyzed.
    • <probescript-file>: Probescript file output location.
    • <baseline-file>: Baseline file output location. Use only if you intend to generate code coverage reports from outside the workbench.
  3. Run the program and generating the code coverage statistics: The general format of the command to run is:
    java    -agentpath:<absolute_path_to_org.eclipse.tptp.platform.jvmti.runtime>/agent_files/<platform>/JPIBootLoader=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=<absolute_path_to_probescript>
       -Dcoverage.out.file=<absolute_path_to_output>
       -cp <path to RLC.jar> <class to execute>
    The following examples use sample values for Windows and Linux:
    • On Windows:
      -agentpath:D:\Program Files\IBM\IBMIMShared\plugins\org.eclipse.tptp.platform.jvmti.runtime_4.6.0.v201005141900\agent_files\win_ia32\JPIBootLoader=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=${probescriptFile}
      
    • On Linux:
      agentpath:/opt/IBM/IBMIMShared/plugins/org.eclipse.tptp.platform.jvmti.runtime_4.6.0.v201005141900/agent_files/linux_ia32/libJPIBootLoader.so=JPIAgent:server=standalone,file=;ProbekitAgent:ext-pk-BCILibraryName=BCIEngProbe,ext-pk-probescript=${probescriptFile}

Feedback