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

JVMPI agent incorrectly merge coverage datafile with different types

XMLWordPrintable

    • 1.1
    • generic
    • generic
    • Verified



      Name: dkR10031 Date: 06/23/2003



      Current JCOV User Guide contains in section "4.3.4 Usage Notes"
      description of the following feature:
      "When gathered data is saved to an existing JCov data file, it is merged
      (on a per-class basis) with the corresponding data found in the file. If
      the data types of two classes being merged dont match, then both classes
      are saved in the resulting JCov data file."

      However, current implementation of the JVMPI agent does
      not merge coverage data for the different datafile format.

      To reproduce this bug please run the following example using script
      below. This script contains the next stages:

       1. Compilation of the test source
       2. Execution of the test program using JVMPI agent invoked
          with the 't=M' option (coverage datafile bm.jcov of format 'M'
          should be generated).
       3. Execution of the test program JVMPI agent invoked
          with the 't=B' option (both coverage data should be saved to
          the bm.jcov file, but they are not).
       4. Execution of the test program using JVMPI agent invoked
          with the 't=B' option (coverage datafile mb.jcov of format 'B'
          should be generated).
       5. Execution of the test program JVMPI agent invoked
          with the 't=M' option (both coverage data should be saved to
          the mb.jcov file, but they are not).
       6. Dump bm.jcov, dump mb.jcov


      -------------------------- test.java source begin --------------------
      public class test { // +
              public static void main(String[] args) {

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

      CLASSPATH=${JCOV_JAR}
      CLASSPATH=${CLASSPATH}:.
      export CLASSPATH

      # Compile the test program
      $TESTED_JAVAC -Xjcov test.java

      # Generate reference datafile of type M
      $TESTED_JAVA -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:t=M,file=bm.jcov,i=test test

      # Execute the program using the JCov support in the
      # JVM with the type(t)=B option
      $TESTED_JAVA -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:t=B,file=bm.jcov,i=test test

      # Generate reference datafile of type B
      $TESTED_JAVA -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:t=B,file=mb.jcov,i=test test

      # Execute the program using the JCov support in the
      # JVM with the type(t)=M option
      $TESTED_JAVA -XX:+EnableJVMPIInstructionStartEvent -Xrunjcov:t=M,file=mb.jcov,i=test test


      echo "------- Begin of the bm.jcov dump ------"
      cat bm.jcov
      echo "------- End of the bm.jcov dump --------"
      echo "------- Begin of the mb.jcov dump ------"
      cat mb.jcov
      echo "------- End of the mb.jcov dump --------"
      -------------------------- script end --------------------------------
      -------------------------- output begin ------------------------------
      [gary@linux-11 #xxxxxxxx(agent incorrectly merge datafile with the
      different types)]# ./run.ksh
      Linux linux-11 2.4.18-14 #1 Wed Sep 4 13:35:50 EDT 2002 i686 i686 i386
      GNU/Linux
      -----------
      -----------
      -----------
      -----------
      ------- Begin of the bm.jcov dump ------
      JCOV-DATA-FILE-VERSION: 2.0
      CLASS: test [public]
      SRCFILE: test.java
      TIMESTAMP: 1056111372491
      DATA: M
      #kind line position count
      METHOD: <init>()V [public]
      1 1 0 0
      METHOD: main([Ljava/lang/String;)V [public static]
      1 4 0 1
      ------- End of the bm.jcov dump --------
      ------- Begin of the mb.jcov dump ------
      JCOV-DATA-FILE-VERSION: 2.0
      CLASS: test [public]
      SRCFILE: test.java
      TIMESTAMP: 1056111372491
      DATA: C
      #kind start end count
      METHOD: <init>()V [public]
      1 1024 0 0
      3 1024 0 0
      METHOD: main([Ljava/lang/String;)V [public static]
      1 2096 5129 1
      3 4113 4145 1
      ------- End of the mb.jcov dump --------
      -------------------------- output end --------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: