CTest: CMake fixtures and background service - no failed test

I use CTest fixtures.
In my FIXTURES_SETUP I call a bash script, wich is starting a service in the background via:

"$@" > ${SERVICE_LOG_FILE} 2>&1 &


You see how I store the log output via a text file

Then in the FIXTURES_CLEANUP step I print the output of the logfile:


However, even when the logfile contains text like this:
“[2020-09-18′ ’15:07:05.978]’ ‘[error]’ ‘FAILED!'”

Ctest does not mark my FIXTURES_CLEANUP test a failed.
What is the problem?

Note that this executes the output of the file. Are you sure you didn’t mean just cat ${SERVICE_LOG_FILE}?

If you want the test to be marked as failed based on the test output, then you need to set the test property FAIL_REGULAR_EXPRESSION to an appropriate value that will match the output according to your criteria.