# CTest: CMake fixtures and background service - no failed test

**URL:** https://discourse.cmake.org/t/ctest-cmake-fixtures-and-background-service-no-failed-test/1869
**Category:** Code
**Created:** [September 21, 2020, 8:09am UTC](https://discourse.cmake.org/t/ctest-cmake-fixtures-and-background-service-no-failed-test/1869 "2020-09-21T08:09:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Acki](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/eada6e/32.png) [@Acki](https://discourse.cmake.org/u/Acki)
#### Post date: [September 21, 2020, 8:09am UTC](https://discourse.cmake.org/t/ctest-cmake-fixtures-and-background-service-no-failed-test/1869/1 "2020-09-21T08:09:19Z")

</div>

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 &

RESULT=$?

```

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:

`$(cat ${SERVICE_LOG_FILE})`

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?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 22, 2020, 7:17pm UTC](https://discourse.cmake.org/t/ctest-cmake-fixtures-and-background-service-no-failed-test/1869/2 "2020-11-22T19:17:40Z")

</div>

> [@Acki](#):
>
> $(cat ${SERVICE\_LOG\_FILE})

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

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [November 22, 2020, 8:43pm UTC](https://discourse.cmake.org/t/ctest-cmake-fixtures-and-background-service-no-failed-test/1869/3 "2020-11-22T20:43:35Z")

</div>

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.
