0

In a quite simple test-case, the output of printf() is not shown, if the test fails. I use µunit as a framework and the test routine itself is trivial:

static MunitResult test(...)
{
    // Some variable initialisation
    printf("Test running...\n");

    //Do the test
    bool bResult = tested_method();
    munit_assert(bResult == true);
}

If I comment out the assertion, i.e. the test succeeds, the printf-output is shown. It isn't if the test fails. Running other test routines works as expected and shows their output from printf() correctly.

I invoke ctest like this to run the test:

ctest -V --output-on-failure -R '.*nameoftest.*'

The whole is running inside a docker container on Windows 10.

How can I make ctest display all output the test-routine sends on stdout? Thanks for your help and have a nice day!

Alex_S42
  • 26
  • 4

1 Answers1

0

The solution, in my case, was, to call the generated elf-executable directly, and not via ctest. It seems that ctest adds another layer of output-redirection which I wasn't able to circumvent. By calling the binary directly, I could get all the output and logs I desired. This is not a direct solution to the problem, but a workaround I found acceptable.

Alex_S42
  • 26
  • 4