You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2011/12/13 14:57:56 UTC

DO NOT REPLY [Bug 52323] New: Cobertura test code coverage support for build.xml and build.properties.default

https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

             Bug #: 52323
           Summary: Cobertura test code coverage support for build.xml and
                    build.properties.default
           Product: Tomcat 7
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Packaging
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: mhasko@redhat.com
    Classification: Unclassified


Created attachment 28069
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28069
the patch, based on revision 1213685

Cobertura (cobertura.sf.net) is an opensource Java code coverage tool released
(with in dependencies) under The Apache Software License, Version 1.1 and/or
The GNU General Public License, Version 2.0.

It can assess how much of the codebase was actually executed during a program
run.
If the program run means running the test suite, it will produce results
showing how much of the code the tests cover, potentially discover weak spots.

This patch provides support for Cobertura in the build.xml and
build.properties.default files. It introduces four new targets:
 * download-cobertura - downloads and unpacks Cobertura in ${base.path}
 * cobertura-enable - enables Cobertura to be used
 * cobertura-instrument - adds Cobertura instrumentation to compiled bytecode
 * cobertura-report - produces reports from Cobertura results. HTML by default
   (can be overwritten with 'cobertura.report.format' property).

The behavior of this patch doesn't break existing targets in any way.

To use this tool, one simply runs 'ant cobertura-enable test' which will
instrument the compiled classes before running the tests and also supply all
the necessary resources for Cobertura to gather the coverage results.
Once the tests are completed 'ant cobertura-report' will produce lovely HTML
report about the test coverage in '${tomcat.build}/coverage'.

NOTE: Although the result of the test cases should not be affected by
Cobertura, it is not guaranteed.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #4 from Violeta Georgieva <vi...@apache.org> ---
The patch is against trunk (Tomcat 8)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Mark Thomas <ma...@apache.org> 2011-12-13 19:36:05 UTC ---
Marking as an enhancement

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #28069|0                           |1
           is patch|                            |
  Attachment #28069|application/octet-stream    |text/plain
          mime type|                            |

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #3 from Violeta Georgieva <vi...@apache.org> ---
Created attachment 30996
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30996&action=edit
updated patch

Hi,

I touched the script here and there and also updated the version to 2.0.3.
I think it is working now. Can you check? I tested on Windows.

The NPE was because the cobertura instrumented our ClassLoaderLogManager and in
the same time tried to initialize a static Logger field. [1]

Regards
Violeta

[1]
https://github.com/cobertura/cobertura/blob/master/cobertura/src/main/java/net/sourceforge/cobertura/coveragedata/TouchCollector.java

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |---

--- Comment #7 from Konstantin Kolinko <kn...@gmail.com> ---
1. It needs some documentation in BUILDING.txt
E.g. at "(7.3) Other configuration options".


Testing current trunk, with JDK 7u45. Ant 1.9.2
Cobertura is NOT enabled.
Running only NIO tests.
execute.test.nio=true

ant test 1>ant_test.log 2>&1

I see two problems:


2. Cobertura is downloaded even though I have not enabled it.

Apparently the "download-cobertura" target needs if="${test.cobertura}".


3. I see a lot of error messages in the test logs, though the tests themselves
do not fail.

E.g. in 
TEST-org.apache.catalina.core.TestStandardContextResources.NIO.txt

05-Nov-2013 00:35:52.555 SEVERE [localhost-startStop-1]
org.apache.catalina.startup.ContextConfig.processAnnotationsJar Unable to
process Jar entry [com/ibm/icu/impl/data/LocaleElements_zh__PINYIN.class] from
Jar [jar:file:/(...)/libraries/tomcat8/cobertura-2.0.3/lib/icu4j-2.6.1.jar!/]
for annotations
 org.apache.tomcat.util.bcel.classfile.ClassFormatException: Invalid byte tag
in constant pool: 60
    at
org.apache.tomcat.util.bcel.classfile.Constant.readConstant(Constant.java:124)
    at
org.apache.tomcat.util.bcel.classfile.ConstantPool.<init>(ConstantPool.java:60)
    at
org.apache.tomcat.util.bcel.classfile.ClassParser.readConstantPool(ClassParser.java:167)
    at
org.apache.tomcat.util.bcel.classfile.ClassParser.parse(ClassParser.java:91)
    at
org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2027)
    at
org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1958)
    at
org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1926)
    at
org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1877)
    at
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1147)
    at
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:769)
    at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)
    at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5166)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1390)
    at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1380)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #6 from Christopher Schultz <ch...@christopherschultz.net> ---
(In reply to Mark Thomas from comment #5)
> Ah, that makes sense.
> 
> I changed the way the patch worked to make it consistent with how we enable
> things like validation.
> 
> Cobertura support has been added to 8.0.x (8.0.0-RC6 onwards) and 7.0.x
> (7.0.48 onwards).

So... what does our code-coverage look like? Is there a CC-report available
through Jenkins?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #10 from Mark Thomas <ma...@apache.org> ---
1. & 3. have also been fixed in trunk and 7.0.x

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Just tried to enable Cobertura with Tomcat 8 trunk and the tests fail
consistently with NPE's in the instrumented code. Absent a working patch for
this with Tomncat 8, this issue is eventually going to be resolved as WONTFIX.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #8 from Konstantin Kolinko <kn...@gmail.com> ---
(In reply to Konstantin Kolinko from comment #7)
> 2. Cobertura is downloaded even though I have not enabled it.
> 
> Apparently the "download-cobertura" target needs if="${test.cobertura}".
> 

"2." has been fixed in trunk and Tomcat 7.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Mark Thomas <ma...@apache.org> ---
Ah, that makes sense.

I changed the way the patch worked to make it consistent with how we enable
things like validation.

Cobertura support has been added to 8.0.x (8.0.0-RC6 onwards) and 7.0.x (7.0.48
onwards).

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 52323] Cobertura test code coverage support for build.xml and build.properties.default

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52323

--- Comment #9 from Mark Thomas <ma...@apache.org> ---
(In reply to Christopher Schultz from comment #6)
> 
> So... what does our code-coverage look like? Is there a CC-report available
> through Jenkins?

Tomcat doesn't use the ASF's Jenkins server for CI, it uses Buildbot.

I've just enabled Cobertura for the trunk build. If I have got it right,
something should appear here in the next few hours:
http://ci.apache.org/projects/tomcat/tomcat8/coverage

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org