Home Corporate Contacts TETware Knowledgebase |
ProductsSolutionsInformationDatasheetDocumentationFAQKnowledgebase |
Return to Knowledgebase Index33. How to copy executed commands output to the journal
Question I have some test cases that use the C API.
As part of my test program, I need to execute a shell script
using
I tried setting
Is there any other way other than by setting
Answer There are a couple of ways that you can do this -
a simple way where
Method 1 - have tcc do the work for you Recall that the value of
So if you want to run an API-conforming test case with output capture mode enabled, you must set both of these variables explicitly, thus: TET_OUTPUT_CAPTURE=true TET_API_COMPLIANT=true When you do this, tcc
captures all the output from each test case and
inserts it in the journal before any of the API-generated output from
the test case.
The API doesn't indicate which section of the output comes from each
test purpose function.
Method 2 - do the output capture within the test case If you want output from your shell script to appear in the journal
between the appropriate TP Start and TP Result lines, you will need to
redirect your shell script's
For example, the following function will do this on a UNIX system: int system_with_capture(cmd) char *cmd; { static char template[] = "/tmp/capXXXXXX"; char capfile[sizeof template]; char buf[BUFSIZ]; FILE *fp; char *p; int rc; Which method you choose depends on how important it is for the captured output to be identified with a particular test purpose function.
See also
|