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 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.
My 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
the reason is because cargo-make doesn't know which executables are test and which are not.
some test executables are your integration tests, some are unit tests and also you have the real app.
so it by default runs everything.
so what you need to do, is to exclude the real app executable and leave only the integration/unit tests.
in order to do that, you can modify the regular expression used by cargo-make to find those files: