【问题标题】:Combining C++ Coverage Results from Parallel stages in a Jenkins Pipeline结合 Jenkins 流水线中并行阶段的 C++ 覆盖结果
【发布时间】:2019-05-15 19:12:29
【问题描述】:

我有以下 Jenkinsfile:

pipeline{
   stages
   {
      stage ("Compile Everything") {/**/} // Code coverage flags turned on
                                          // Stashes compiled test binaries. 
      stage ("Parallel Tests"){
         parallel{
            stage ("Run Tests A-L") {/**/} // These stages unstash and run groups of tests,
            stage ("Run Tests L-Z") {/**/} // causing coverage files to be created.
                                           // I analyze those coverage files via
                                           // gcovr and stash the results as xml.
         }
      }

      stage ("Combine and Publish Coverage") {/**/} // Here I can unstash all of the xml
                                                    // code coverage files, but don't know
                                                    // how to combine them.
   }
}

在最后阶段,“合并和发布覆盖率”是否可以合并 gcovr 创建的所有 xml 文件?

有没有人完全解决了并行测试并以另一种方式组合覆盖结果的问题?

【问题讨论】:

    标签: jenkins sonarqube gcov jenkins-declarative-pipeline


    【解决方案1】:

    以下解决方案没有我想的那么优雅,但我能想出的最好的解决方案。

    使用lcov 而不是gcovr 最初生成覆盖率报告。这将创建 .info 文件,lcov 能够将其合并为单个 .info 文件。

    取消存储之前阶段的所有.info 文件,然后使用lcov -a 将它们组合成一个.info 文件。 (Reference)

    接下来,使用lcov-to-cobertura 转换器将此.info 文件转换为可报告给SonarQube 的xml 文件。

    【讨论】:

    • 最好接受解决方案,以便结束任何进一步的讨论。
    猜你喜欢
    • 2023-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-07
    • 1970-01-01
    • 1970-01-01
    • 2019-02-19
    • 2018-11-08
    相关资源
    最近更新 更多