Hi,

I suspected the publishing of Cobertura coverage report taking way too long.
I upgraded from 1.3 -> 1.5 but no change ( I suspected that since change list 
did not mention anything).

I decided to check how long this step takes so ( after recommendation from Ulli 
H.) I installed 
Timestamper<http://wiki.jenkins-ci.org/display/JENKINS/Timestamper> ( nice 
plugin).

And I found out that it takes ~ 22 minutes to publish Cobertura coverage report!

08:19:08  Publishing Cobertura coverage report...
08:41:07  Publishing Cobertura coverage results...

Since build with tests and reports takes only 6 min I find it strange.

I notice one difference here since we have the coverage.xml in a vob ( 
clearcase). Pattern used to
Search for file is:

*vobs/<path to cobertura xml>/coverage.xml

Will this increase publish of report? Or is there a an operation in the code 
below that is known to take time?


I downloaded src and tried to build 1.5 ( to be able to debug) but got the 
following error:

found   : hudson.model.AbstractBuild<capture#336 of ?,capture#473 of ?>
required: hudson.maven.MavenBuild
        if(build instanceof MavenBuild) {
           ^
/home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:233:
 inconvertible types
found   : hudson.model.AbstractBuild<capture#515 of ?,capture#236 of ?>
required: hudson.maven.MavenBuild
          MavenBuild mavenBuild = (MavenBuild)build;
                                              ^
/home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:238:
 inconvertible types
found   : hudson.model.AbstractBuild<capture#919 of ?,capture#763 of ?>
required: hudson.maven.MavenModuleSetBuild
        } else if(build instanceof MavenModuleSetBuild) {
                  ^
/home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/CoberturaPublisher.java:239:
 inconvertible types
found   : hudson.model.AbstractBuild<capture#858 of ?,capture#685 of ?>
required: hudson.maven.MavenModuleSetBuild
          MavenModuleSetBuild moduleSetBuild = (MavenModuleSetBuild)build;
                                                                    ^
/home/eraonel/git/cobertura-plugin/src/main/java/hudson/plugins/cobertura/targets/CoverageResult.java:446:
 warning: [deprecation] 
generateGraph(org.kohsuke.stapler.StaplerRequest,org.kohsuke.stapler.StaplerResponse,org.jfree.chart.JFreeChart,int,int)
 in hudson.util.ChartUtil has been deprecated
        ChartUtil.generateGraph(req, rsp, createChart(dsb.build()), 500, 200);


Any ideas?


Br,

//mikael

listener.getLogger().println("Publishing Cobertura coverage report...");
        final FilePath[] moduleRoots = build.getModuleRoots();
        final boolean multipleModuleRoots =
            moduleRoots != null && moduleRoots.length > 1;
        final FilePath moduleRoot = multipleModuleRoots ? build.getWorkspace() 
: build.getModuleRoot();
        final File buildCoberturaDir = build.getRootDir();
        FilePath buildTarget = new FilePath(buildCoberturaDir);

        FilePath[] reports = new FilePath[0];
        try {
            reports = moduleRoot.list(coberturaReportFile);

            // if the build has failed, then there's not
            // much point in reporting an error
            if (build.getResult().isWorseOrEqualTo(Result.FAILURE) && 
reports.length == 0)
                return true;

        } catch (IOException e) {
            Util.displayIOException(e, listener);
            e.printStackTrace(listener.fatalError("Unable to find coverage 
results"));
            build.setResult(Result.FAILURE);
        }

        if (reports.length == 0) {
            String msg = "No coverage results were found using the pattern '"
            + coberturaReportFile + "' relative to '"
            + moduleRoot.getRemote() + "'."
            + "  Did you enter a pattern relative to the correct directory?"
            + "  Did you generate the XML report(s) for Cobertura?";
            listener.getLogger().println(msg);
            build.setResult(Result.FAILURE);
            return true;
        }

        for (int i = 0; i < reports.length; i++) {
            final FilePath targetPath = new FilePath(buildTarget, "coverage" + 
(i == 0 ? "" : i) + ".xml");
            try {
                reports[i].copyTo(targetPath);
            } catch (IOException e) {
                Util.displayIOException(e, listener);
                e.printStackTrace(listener.fatalError("Unable to copy coverage 
from " + reports[i] + " to " + buildTarget));
                build.setResult(Result.FAILURE);
            }
        }

        listener.getLogger().println("Publishing Cobertura coverage 
results...");

Reply via email to