Gcovr: error: no such option: --html

Hi,

I"m having a problem while building my CMake based C++ project . The problem is with making a target that runs the gcovr. I have no problem on my local machine but Travis CI build throws the following error at the end of making a target:

$ make coverage
[ 30%] Built target Particle
[ 46%] Built target gtest
[ 61%] Built target gtest_main
[ 76%] Built target TestSwarm
[ 92%] Built target TestParticle
Scanning dependencies of target coverage
[100%] Running gcovr to produce HTML code coverage report.
Test project /home/travis/build/MrPoudel/ParticleExplosion/build
    Start 1: TestParticle
1/2 Test #1: TestParticle .....................   Passed    0.00 sec
    Start 2: TestSwarm
2/2 Test #2: TestSwarm ........................   Passed    0.00 sec
100% tests passed, 0 tests failed out of 2
Total Test time (real) =   0.01 sec
Usage: gcovr [options]
gcovr: error: no such option: --html
make[3]: *** [test/CMakeFiles/coverage] Error 2
make[2]: *** [test/CMakeFiles/coverage.dir/all] Error 2
make[1]: *** [test/CMakeFiles/coverage.dir/rule] Error 2
make: *** [coverage] Error 2
The command "make coverage" exited with 2.
0.00s$ cd ..
The command "cd .." exited with 0.

And I’m running the same version of gcovr 2.4 on Travis CI build and on my local machine.

The detail error can be seen here: https://travis-ci.org/github/MrPoudel/ParticleExplosion/builds/720140138

Any suggestions would be appreciated.

--html is new in Gcovr 3.0. gcovr --help confirms that the version in Trusty doesn’t have it.

You must be confusing 2.4 (the ancient version in Trusty) and 4.2 (the latest release as of this writing that you are probably using locally).

1 Like

Thanks a lot. Exactly, it was a confusion between 4.2 and 2.4 :smiley: . I upgraded the gcovr in Trusty image and it works well now.

Following addition to .travis.yml solved the problem.

before_install:
  - pip install -U pip # upgrade pip
  - sudo pip install gcovr
1 Like
Imprint