I am testing a library that monitors USB stick and allows listening to plugin/plugout events. The target system runs a custom Linux version and debugging is a pain on this system
So, for quick analysis of what is going, I very often use printf
messages.
For unit testing of the library, I have started using Catch
and I generate test reports using JUint reporter.
Problem: If I insert aprintf
message for analysis, it gets added to the xml
report generated by Catch
.
My question: Is there a way to separate printf
messages and the report generated by Catch
?
Thanks.
UPDATE: I want to avoid writing to a file, because I've had problems with it when there are errors and the program crashes before the file is completely written to.
There is an another way.
You could print your debug messages to stderr
instead of stdout
using fprintf
like this:
fprintf(stderr, "%d\n", c);
Since Catch's report is written to stdout
you can then dismiss your output using redirection, e.g. on Linux systems:
./a.out -r junit 2> /dev/null