Hello everyone! So I recently started working on a project and in a nutshell, I introduce an infinite loop that expects some commands as user input. It will only break out of the loop if the user input certain keyword.
I would like to include code coverage to the project. After doing some research, I am now using Travis CI with
cargo make and codecov. I noticed that the travis build would succeed for my dummy test project, and it would get stuck for the project I was working on.
Upon further investigation, I concluded that it was most likely of the infinite loop. I introduced an infinite loop in my dummy project and received this in the Travis build output:
This is my
language: rust rust: - stable jobs: fast_finish: true cache: cargo script: - which cargo-make || cargo install cargo-make - cargo make ci-flow env: global: - CARGO_MAKE_RUN_CODECOV="true"
This only happens when I have the lines after
cache: cargo, so I think it might be because of
cargo-make and/or the
kcov in the screenshot.
main() function had several other things, but I put the infinite loop at very top.
While researching on this, I stumbled upon this somewhat related Stack Overflow post. Is it the case that for me to have code coverage, I need to run the code first? If that is the case, how should I introduce code coverage to my project?
Any advice on how to resolve this is appreciated! Thank you!
Edit: I am not actually testing the loop. In my testing suite, I only have several tests which do not involve the infinite loop. So I am uncertain why the infinite loop which resides in
main() (i am not even testing
main) would be called