I’m using CTest to launch the tests of my project. I would like to launch only the tests that have failed at the last execution.
Is there a simple way to do that with CTest ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The short answer is no, I think.
However, you can use a simple CMake script to convert the list of last failed tests to a format suitable for CTest’s
-Ioption.CTest writes a file called something like
<your build dir>/Testing/Temporary/LastTestsFailed.logwhich contains a list of failed tests. This list is not cleared if all tests pass on a subsequent run. Also, if CTest is running in dashboard mode (as a dart client), the log file name will include the timestamp as detailed in the file<your build dir>/Testing/TAG.The script below doesn’t take into account the file name including the timestamp, but it should be easy to extend it to do this. It reads the list of failed tests and writes a file called
FailedTests.logto the current build dir.You should then be able to run just the failing tests by doing: