A basic TRUT file looks something like this (see e.g. Timba/doc/Courses/Workshop2007/ME1/TRUT):
-
# this is a comment tdlconf = trut.tdl.conf TDL demo1-predict-ps.py # another comment TDL demo2-predict-ps-image.py TDL demo3-predict-ps-gain.py
TRUT files consist of:
Options, of the form "option = value"
Directives, of the form "directive [arguments]"
comments preceded by '#'
empty lines, which are ignored
Directives
A directives specifies a test to be run. Currently (31/05/07), the only recognized directive is "TDL". This tells trut to compile the given TDL script.
Note that trut changes to the directory of the TRUT file before running any tests, so all filenames are relative to the current directory.
Options
Options can modify the behaviour of tests. Options may be nested:
tdlconf = .tdl.conf # this applies to all tests TDL demo1.py # uses .tdl.conf as per global option TDL demo2.py tdlconf = demo2.tdl.conf # this only applies to demo2.py TDL demo3.py # uses .tdl.conf as per global option tdlconf = trut.tdl.conf # changes the global option from this point on TDL demo4.py # uses trut.tdl.conf
Here, we specify a different, nested, option for the TDL demo2.py directive. To specify a nested option for a directive, indent the option and place it after the directive. Indentation follows the Python rules (i.e. any indent is OK as long as it remains consistent).
tdlconf option
This applies to TDL directives. tdlconf specifies a config file to be loaded prior to compiling the script. Config files are where all the compile-time and run-time TDL options are stored. The default is .tdl.conf, which is the same location as used by meqbrowser. Since this .tdl.conf is subject to change every time you change an option in the browser, you will usually want to make a separate "testing-only" config file containing TDL options to be used during testing. Copy .tdl.conf to something else (e.g. trut.tdl.conf), modify options, and check it into subversion.
Note that when compiling a script, trut will use the exact name of the script as given in the TRUT file (i.e. usually without a path) to look up the relevant tdl.conf section. The browser uses the full pathname of the script (which is behaviour I may change in the future...) When you make a copy of tdl.conf, check your section names and remove absolute pathnames. For example:
Your .tdl.conf may look like this:
[/home/user/some/directory/example9-clar-shortcut.py] imaging_mode = channel model_func = star8_model grid_step = 2 grid_size = 3
Copy it to trut.tdl.conf, and fix the section name:
[example9-clar-shortcut.py] imaging_mode = channel model_func = star8_model grid_step = 2 grid_size = 3
Add tdlconf = trut.tdl.conf to your TRUT file.
Check the TRUT file and trut.tdl.conf into svn.
Nested directives
Directives may be nested too (i.e. subtests within tests). In the near future, I will add the capability to run TDL jobs. You would then specify them as follows:
TDL script.py option = value Job _test_forest option = value Job _another_tdl_job
This specifies a TDL script to be compiled, and TDL jobs to be executed. Options again may be nested; the same rules apply (i.e. you can have settings that are local to a particular job, etc.)
In principle this syntax allows nesting of test directives to any level. For example, I anticipate sub-sub-tests, such as testing for particular node states within TDL jobs.
