Home Corporate Contacts

TETware Knowledgebase


Products
Solutions

Information

Datasheet
Documentation
FAQ
Knowledgebase

Return to Knowledgebase Index

25. Displaying scenario trees with tetscpp

There is a useful program that you can build which shows you how the tcc scenario parser interprets a scenario file. It is not part of the official TETware release (and therefore is not supported) but it enables you to look at the scenario tree without having to go to the trouble of getting tcc to execute the scenario and then digging around in journal and debug output.

The program is called tetscpp and can be built in the tcc source directory.

To build this program:


cd $TET_ROOT/src/tet3/tcc
make tetscpp


The syntax of tetscpp is as follows:

tetscpp [-P] [-c compat-mode] [-o output-file] [-r] [-s scenario] [-t tabwidth] [-y string] [-n string] [ files . . .]

tetscpp reads scenarios from the named files. If no files are specified, tetscpp reads scenarios from the standard input.

The following options are understood:

-P

Do not emit cpp-style line control directives.


-c  compat-mode

Select compatibility mode.
compat-mode should be one of d (for dTET2 mode) or e (for ETET mode).


-o  output-file

Leave the output in the specified output-file instead of printing it on the standard output.


-r

Include scenario reference numbers in the output.


-s  scenario

Parse the specified scenario instead of the one named all.


-t  tabwidth

Specifies the width of a tab when indenting output.
Defaults to 4 spaces.


-y  string



-n  string

Meanings are the same as for tcc.




In addition, trace options may be specified using -T in the usual way. When the tet_Tscen flag (flag indicator p) is non-zero, the output includes the address of the scentab element from which each output line is derived. (Trace options are described in the appendix entitled ``Trace and debugging facilities'' in the TETware User Guide.)

tetscpp does not have a concept of a test suite root directory, so its handling of scenario include files is rather primitive. If a scenario contains an include file name, tetscpp simply interprets the name relative to its current working directory.

Example 1

Here is the scenario from the distributed demonstration test suite that is described in the TETware Programmers Guide:


all
	"starting scenario"
	:remote,000,001:
	/ts/tc1
	/ts/tc2
	"next is the last test case"
	/ts/tc3
	:endremote:
	"done"



The following output is generated when this scenario is processed by tetscpp -P:

scenario("all")
{
    sceninfo("starting scenario");
    remote(0, 1)
    {
	testcase("/ts/tc1", "all");
	testcase("/ts/tc2", "all");
	sceninfo("next is the last test case");
	testcase("/ts/tc3", "all");
    }
    sceninfo("done");
}

Example 2

Consider the following two scenarios. At first inspection they appear to be different but analysis with tetscpp shows that tcc would process them in exactly the same way.

Scenario 1:


all
	:timed_loop,18000:
	    :parallel:
	        :repeat,10:
	            /tset/test1/tc1
	            /tset/test2/tc2
	            /tset/test3/tc3
	        :endrepeat:
	        :repeat,30:
	            :random:
	                /tset/test4/tc4
	                /tset/test5/tc5
	                /tset/test6/tc6
	                /tset/test7/tc7
	            :endrandom:
	        :endrepeat:
	    :endparallel:
	:endtimed_loop:


Scenario 2:

all
	:timed_loop,18000:^loop1
loop1
	:parallel:^list1
loop2
	:repeat,10:^list2
loop3
	:repeat,30;random:^list3
list1
	^loop2
	^loop3
list2
	/tset/test1/tc1
	/tset/test2/tc2
	/tset/test3/tc3
list3
	/tset/test4/tc4
	/tset/test5/tc5
	/tset/test6/tc6
	/tset/test7/tc7


The way that tcc would process either of these scenarios can be shown by executing the following command:

tetscpp -Pce  scenario-file


The output from tetscpp is as follows:

scenario("all")
{
    timed_loop(18000)
    {
	parallel(1)
	{
	    sequential()
	    {
		repeat(10)
		{
		    testcase("/tset/test1/tc1", "all");
		    testcase("/tset/test2/tc2", "all");
		    testcase("/tset/test3/tc3", "all");
		}
	    }
	    sequential()
	    {
		repeat(30)
		{
		    random()
		    {
			testcase("/tset/test4/tc4", "all");
			testcase("/tset/test5/tc5", "all");
			testcase("/tset/test6/tc6", "all");
			testcase("/tset/test7/tc7", "all");
		    }
		}
	    }
	}
    }
}

See also

  • "The scenario file'' in the TETware Programmers Guide.

 


Home Contacts Legal Copyright Corporate News

Copyright © The Open Group 1995-2012, All Rights Reserved