Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7900359

JVMPI agent invoked with 'ce' option generates incorrect coverage data

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: dkR10031 Date: 06/19/2003



      Current implementation of JVMPI agent does not correctly gather data
      when it is called with the 'ce' option. In certain cases
      execution counters differ from those expected according to the
      documentation.

      Jcov User Guide reads in section "B.1 JCov Syntax and Options":
      "caller_exclude(ce)=class name prefix: (JDK version 1.3.1 and later.)
      Gather coverage data only for the methods invoked, not from the specified
      class or classes not beloning to the specified package. This option can be
      used multiple times. Class or package names should use a period (.) as a
      package separator.

      Note that if this option is used with data format B,the -Xint JVM option
      must also be specified."

      To reproduce this bug please run the following example using script
      below. This script compiles the sources, run the test class using JVMPI
      agent which is called with the 'ce' option, and finally, dumps generated
      java.jcov datafile. Please see java.jcov file. For the test.main() method
      counters should be set to '1' since it is not excluded by the
      'ce=p.subp.A' option, however they are '0'.
      -------------------------- test.java source begin --------------------
      import p.subp.A;

      public class test {

          public static void main(String[] args) {

              A.foo();
              System.out.println("-----------");
          }
      }
      -------------------------- test.java source end ----------------------
      -------------------------- p/subp/A.java source begin ----------------
      package p.subp;


      public class A {

          public static void foo() {

              System.out.println("A");
          }
      }
      -------------------------- p/subp/A.java source end ------------------
      -------------------------- script begin ------------------------------
      # Setting the classpath
      TESTED_JAVAC=/export/home/jdk1.4.1/linux/bin/javac
      TESTED_JAVA=/export/home/jdk1.4.1/linux/bin/java
      JCOV_JAR=/export/home/gary/QA.JCOV/ws-test/test.linux-x86/lib/jcov.jar

      CLASSPATH=${JCOV_JAR}
      CLASSPATH=${CLASSPATH}:.
      CLASSPATH=${CLASSPATH}:p/subp

      # Compile the test program
      $TESTED_JAVAC -Xjcov test.java p/subp/A.java

      # Execute the program using the JCov support in
      the JVM with the caller_exclude (ce) option
      # specifying a specific class from a package
      with several classes
      $TESTED_JAVA -version -Xrunjcov:V
      $TESTED_JAVA -Xint -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:ce=p.subp.A test

      echo "-------- java.jcov begin ------------"
      cat java.jcov
      echo "-------- java.jcov end --------------"
      -------------------------- script end --------------------------------
      -------------------------- output begin ------------------------------
      [gary@linux-11 #xxxxxxxx(3)]# uname -a
      Linux linux-11 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
      GNU/Linux
      [gary@linux-11 #xxxxxxxx(3)]# ./run.ksh
      java version "1.4.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
      Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)
      A
      -----------
      -------- java.jcov begin ------------
      JCOV-DATA-FILE-VERSION: 2.0
      CLASS: test [public]
      SRCFILE: test.java
      TIMESTAMP: 1056015692174
      DATA: C
      #kind start end count
      METHOD: <init>()V [public]
      1 3072 0 0
      3 3072 0 0
      METHOD: main([Ljava/lang/String;)V [public static]
      1 5164 9221 0
      3 7177 7183 0
      CLASS: p/subp/A [public]
      SRCFILE: A.java
      TIMESTAMP: 1056015692180
      DATA: C
      #kind start end count
      METHOD: <init>()V [public]
      1 4096 0 0
      3 4096 0 0
      METHOD: foo()V [public static]
      1 6174 9221 1
      3 8201 8223 1
      -------- java.jcov end --------------
      -------------------------- output end --------------------------------

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            afedorch Alexey Fedorchenko (Inactive)
            Reporter:
            klooney Kevin Looney (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: