Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-11354

CppCheck plugin cannot find CppCheck report

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Major Major
    • cppcheck-plugin
    • None
    • * RedHat Linux
      * Jenkins 1.424
      * Jenkins Cppcheck Plug-in 1.0.2

      For easier investigation, we reproduced our problem in the following minimal scenario:

      1. We create a file main.c (attached to this report):

      int main()

      { return 0; }

      2. We create a CppCheck report, cppcheck-result.xml, on main.c:

      cppcheck --xml main.c 2> cppcheck-result.xml

      Contents of cppcheck-result.xml (attached to this report):

      <?xml version="1.0" encoding="UTF-8"?>
      <results>
      </results>

      3. We create a Jenking job for CppCheck.

      4. We place cppcheck-result.xml (created in step 2) in the workspace of the Jenkins job.

      5. In the Jenkins job configuration page:
      5a. We specify no command for the build.
      5b. We select "Publish Cppcheck results".
      5c. In the box "Cppcheck report XMLs", we enter "**/cppcheck-result.xml".
      5d. We leave the CppCheck plugin boxes "Use the workspace as root path to look for reports" and "Ignore blank files" unchecked.
      5e. We do not touch the CppCheck plugin's "Advanced..." settings.
      5f. We save the Jenkins job configuration.

      6. We build manually the Jenking CppCheck job ("Build Now"). The build fails. The console output shows:

      [Cppcheck] Processing 1 files with the pattern '**/cppcheck-result.xml'.
      FATAL: java.io.IOException: method <init>(Ljava/lang/Throwable;)V not found
      java.lang.NoSuchMethodError: java.io.IOException: method <init>(Ljava/lang/Throwable;)V not found
      at org.jenkinsci.plugins.cppcheck.parser.CppcheckParser.parse(CppcheckParser.java:57)
      at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:65)
      at org.jenkinsci.plugins.cppcheck.CppcheckParserResult.invoke(CppcheckParserResult.java:21)
      at hudson.FilePath.act(FilePath.java:758)
      at hudson.FilePath.act(FilePath.java:740)
      at org.jenkinsci.plugins.cppcheck.CppcheckPublisher.perform(CppcheckPublisher.java:62)
      at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:682)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:657)
      at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:635)
      at hudson.model.Build$RunnerImpl.post2(Build.java:161)
      at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:604)
      at hudson.model.Run.run(Run.java:1400)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:175)

      7. In the Jenkins job configuration page, we change the contents of the box "Cppcheck report XMLs" so it contains the absolute path to cppcheck-result.xml, and we save the Jenkins job configuration.

      8. We build manually the Jenking CppCheck job ("Build Now"). The build fails again. The console output now shows a different error message:

      [Cppcheck] Starting the cppcheck analysis.
      [Cppcheck] Parsing throws exceptions. No cppcheck test report file(s) were found with the pattern '/absolute/path/to/cppcheck-result.xml' relative to '/absolute/path/to/workspace'. Did you enter a pattern relative to the correct directory? Did you generate the XML report(s) for Cppcheck?
      Build step 'Publish Cppcheck results' changed build result to FAILURE
      Build step 'Publish Cppcheck results' marked build as failure
      Finished: FAILURE

      What is wrong?

      Note that we are using the Cobertura Jenkins plugin (which also reads an XML input file), and it works perfectly.

      – dave

        1. config.xml
          1 kB
        2. config.xml
          1 kB
        3. cppcheck-result.xml
          0.1 kB
        4. main.c
          0.0 kB

            mixalturek Michal Turek
            dohlsson Dave Ohlsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: