Coveralls.io coverage for _all_ source files?


#1

Following some other questions, i have the following in my Travis.yml

after_success: |
  sudo apt-get install libcurl4-openssl-dev libelf-dev libdw-dev &&
  wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
  tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make &&
  sudo make install && cd ../.. &&
  kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/imagecli-*

I’m struggling to get it to run coverage for the entire src folder. Currently I get src/main.rs but my tests reside in src/lib.rs. What am I doing wrong here?


#2

I think the coverage only covers whatever files your test suite is using?

I never tried having a test suite not triggering some files though, so I am not 100% on this.


#3

EDIT :
I might be being silly here now that I think about it, but I do recall having issues similar to yours, and that solved it. I can try a version without loop a bit later if using the loop doesn’t work for you.

======

Oh my apologies, I thought it’s codecov.

To get coveralls working, you need to have a loop I think, see here (line 50)

But this is for a library, hopefully the same for a binary.


#4

Thanks, I haven’t got my mac to hand. But when I do i’ll try this loop - Thanks!


#5

While I don’t have a direct answer to your question, I’d recommend also considering using cargo-coveralls to simplify management of your .travis.yml.