15.
How to get the standard error from an API-conforming test case to appear in the journal
Question
I have a number of tests where the test program writes to
stderr .
I would like this information to appear in the journal file.
I have been unable to achieve this using the
TET_OUTPUT_CAPTURE
settings.
So I have resorted to redirecting
stderr
to a file and running a small
program which reads in each line of the file and calls the function
tet_infoline() .
Is there a better way to achieve this?
Answer
It is possible to instruct
tcc
to capture
stdout
and
stderr
from a test case and copy it to the journal.
When using this functionality, it is helpful to understand the
interaction between the
TET_OUTPUT_CAPTURE
and
TET_API_COMPLIANT
configuration variables.
You can run your test case with
TET_OUTPUT_CAPTURE=true
in the execute mode configuration.
When you do this,
tcc
will execute test cases with output capture mode enabled.
However, setting
TET_OUTPUT_CAPTURE=true
also has the effect of
providing a default value of
TET_API_COMPLIANT=false .
So if your test case uses the API, you will need to set
TET_API_COMPLIANT=true
explicitly, otherwise you won't get any
information lines or result lines in the journal.
See also
-
"Execute mode processing'' and
"Configuration variables which modify TETware's operation''
in the TETware Programmers Guide.
|