TravisCI / Coverity:警告-没有文件发出 [英] TravisCI / Coverity: Warning - No files were emitted

查看:314
本文介绍了TravisCI / Coverity:警告-没有文件发出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个中等大小的github存储库,为此我配置了Travis-CI / Coverity工具。大约一个月前,我的设置运行良好:Travis编译并构建了我的应用程序,然后执行Coverity扫描,我可以在Coverity页面上看到结果。

I have a medium size github repository for which I configured Travis-CI/Coverity tools. About a month ago my setup had worked just fine: Travis compiled and built my application, and then performed the Coverity scan and I could see the results on my Coverity page.

但是最近, Coverity分析停止工作。当构建成功时,我查看了Travis日志文件并与旧日志进行了比较,这就是我发现的内容。

However, lately, the Coverity analysis stopped working. I looked through the Travis log files and compared to the old logs when the builds were successful and that's what I found:

在日志结尾处,失败的版本包含下一个警告:

At the end of the log, the failed version contains the next warning:


[警告]没有发出文件。这可能是由于您的配置出现问题,或者是因为您的构建命令实际上没有编译任何文件。

[WARNING] No files were emitted. This may be due to a problem with your configuration or because no files were actually compiled by your build command.

请确保您已配置了实际在编译中使用的编译器。

Please make sure you have configured the compilers actually used in the compilation.

有关更多详细信息,请查看:/home/travis/build/name/repo-name/build/cov-int/build-log.txt

For more details, please look at: /home/travis/build/name/repo-name/build/cov-int/build-log.txt

提取0个文件的SCM数据...

Extracting SCM data for 0 files...

...

因此, Travis版本正在传递,但Coverity不会产生任何作用。我检查了Travis配置文件,它与Coverity构建成功时的提交相同。

So, the Travis builds are passing, but nothing is generated for the Coverity. I checked my Travis config file and it is identical to the commits when the Coverity builds were successful.

为了进行实验,我克隆了我的项目存储库,当构建成功,并为其建立了Travis / Coverity。你猜怎么着?同样的警告!因此,过去(大约35天前)可用的相同设置不再起作用。因此,我得出结论,由于Travis不会生成某些文件,因此它有所更改。

For the sake of experiment, I cloned my project repository, rolled back to the version when the builds were successful and set up Travis/Coverity for them. And guess what? Same warning! So, the identical setup that worked in the past (about 35 days ago), does not work anymore. Therefore, I make conclusion, something had changed on the part of Travis since it does not generate certain files.

我想知道是否有人遇到此问题?可能是什么?有一些我需要更改的Travis设置吗?

I was wondering if anyone encountered this issue? and what it could be about? Are there some Travis settings I need to change?

一些其他信息:我使用CMake构建项目,它具有两个依赖项:Qt和OpenSceneGraph(我必须为Travis安装) )。

Some additional info: I use CMake to build my project, and it has two dependencies: Qt and OpenSceneGraph (which I have to install for Travis).

这是我 coverity_scan .travis.yml 的近似脚本$ c>分支:

This is the approximate script of my .travis.yml on my coverity_scan branch:

language: cpp
os: linux
compiler: gcc
sudo: required
dist: trusty

addons:
  apt:
    packages:
      - cmake
      - g++-4.8
  coverity_scan:
    project:
      name: "name/project"
      description: "Build submitted via Travis CI"
    notification_email: email@domain.com
    build_command:   "make -j2 VERBOSE=1"
    branch_pattern: coverity_scan

env:
  global:
    - PROJECT_SOURCE=${TRAVIS_BUILD_DIR}/src/
    - PROJECT_BUILD=${TRAVIS_BUILD_DIR}/build/
    # The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
    #   via the "travis encrypt" command using the project repo's public key
   - secure: "...secure..."

before_install:
  # download Qt
  # ...
  # download OpenSceneGraph
  # ...
  # imitate x server
  - export DISPLAY=:99.0
  - /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16
  - sleep 3

install:
  # install Qt
  - sudo apt-get --yes install qt55base qt55imageformats qt55svg 
  # compiler
  - export CXX="g++-4.8"
  - export CC="gcc-4.8"
  # install OpenSceneGraph
  # ...

before_script:
  # Qt location
  # ...
  # OpenSceneGraph variables
  # ...

  # create build folder
  - mkdir $PROJECT_BUILD
  - cd $PROJECT_BUILD 
  # cmake command
  - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/qt54/lib/cmake -DProject_BUILD_TEST=ON -DProject_VERSION=0.0.0 $PROJECT_SOURCE

script:
  - if [[ "${COVERITY_SCAN_BRANCH}" == 1 ]];
    then
      echo "Don't build on coverty_scan branch.";
      exit 0;
    fi
  # compile everything, if not coverity branch
  - make -j2
  # run unit tests
  # ...


推荐答案

经过研究并查看了现有示例,我终于使它起作用了。为了更正警告,并因此确保发出文件进行分析,有必要明确指定编译器二进制文件(根据注释进行更新)。在我的 .travis.yml 中,我必须在 build_command build_command_prepend coverity_scan 附件中的c $ c>。该块的最终外观示例如下:

After some research and looking through existing examples, I finally made it work. To fix the warning, and, therefore, to make sure files are emitted for the analysis, it is necessary to explicitly specify the compiler binary (updated according to the comment) . In my .travis.yml I had to add a build_command_prepend before the build_command of the coverity_scan add-on. An example of the final look for that block is as below:

# ... 
coverity_scan:
    project:
      name: "name/project"
      description: "Build submitted via Travis CI"
    notification_email: name@domain.com

# ! have to specify the binary (updated, thanks to Caleb)
    build_command_prepend: "cov-configure --comptype gcc --compiler gcc-4.8 --template"

    build_command:   "make VERBOSE=1"
    branch_pattern: coverity_scan

# ...

这篇关于TravisCI / Coverity:警告-没有文件发出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆