Geoff Clare wrote:
>> I have realized that the test purpose was not run properly
>> with TET_OUTPUT_CAPTURE=True
> 
> If you run a test case that uses the TET API with
> TET_OUTPUT_CAPTURE=True you also need to set TET_API_COMPLIANT=True,
> as the default for TET_API_COMPLIANT is the inverse of
> TET_OUTPUT_CAPTURE (for historical reasons).

I have just tried that and it seems to work to some degree.

This is how the test purpose looks like:

function hflag_basic
{
         tc_id="hflag unit test"
         tc_desc="basic test of -h flag"
         init_test

         tmpf=$( nc_mktemp hflagtest )
         tet_infoline "XXX sleeping"
         print -u 2 "XXX stderr"
         sleep 30

         tet_infoline "running nc with -h and checking if it contains usage"
         eval $NC -h 2>&1 | $GREP '^usage' > /dev/null
         if (( $? != 0 )); then
                 tet_infoline "nc output did not contain usage"
                 tet_result FAIL
                 return
         fi
         $RM -f $tmpf
         tet_infoline "XXX removed"
         finish_test
         tet_infoline "XXX finished"
}

and this is the relevant part of the journal file it produced:

30||TET_EXPAND_CONF_VARS=true
30||TET_OUTPUT_CAPTURE=true
30||TET_API_COMPLIANT=true
30||TET_EXEC_IN_PLACE=true
30||TET_PASS_TC_NAME=True
30||TET_VERSION=3.7-lite
40||Config End
10|0 /tests/hflag/tc_hflag 14:09:09|TC Start, scenario ref 1-0
100|0|XXX stderr
15|0 3.7 1|TCM Start
400|0 1 1 14:09:09|IC Start
200|0 1 14:09:09|TP Start
520|0 1 119 1 1|======================================================
520|0 1 119 1 2|Test purpose 'hflag unit test' - basic test of -h flag
520|0 1 119 1 3|======================================================
520|0 1 119 1 4|XXX sleeping
520|0 1 119 1 5|running nc with -h and checking if it contains usage
520|0 1 119 1 6|XXX removed
520|0 1 119 1 7|XXX finished
220|0 1 0 14:09:39|PASS
410|0 1 1 14:09:39|IC End
80|0 0 14:09:41|TC End, scenario ref 1-0
900|14:09:41|TCC End


Note that the print to stderr is placed outside the test purpose section.

The good thing is that this works nicely with the 'set -x' debugging 
stuff I was trying to add earlier. Thanks for the advice !

> The relationship between these variables is explained in section 5.6
> of the TETware Programmer's guide. Does CTI-TET not have an 
> equivalent guide?

Not that I know of.


v.

Reply via email to