Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Complete tesh documentation.
[simgrid.git] / tools / tesh / tesh.1
1 .\" Manpage for tesh
2 .TH tesh 1 "10 Oct 2012" "1.0" "tesh man page"
3 .SH NAME
4 tesh \- testing shell
5 .SH SYNOPSIS
6 .B tesh
7 [\fIOPTION\fR]... [\fIFILE\fR]...
8 .SH DESCRIPTION
9 This is the TESH tool. It constitutes a testing shell, ie a sort of shell specialized to run tests. The list of actions to take is parsed from files files called testsuite.
10 .SH OPTIONS
11   --cd some/directory : ask tesh to switch the working directory before
12                         launching the tests
13   --setenv var=value  : set a specific environment variable
14   --cfg arg           : add parameter --cfg=arg to each command line
15   --enable-coverage   : ignore output lines starting with "profiling:"
16 .SH TESH FILE SYNTAX
17 Here is the syntax of these files:
18
19 The kind of each line is given by the first char (the second char should be
20 blank and is ignored):
21
22  `$' command to run in foreground
23  `&' command to run in background
24  `<' input to pass to the command
25  `>' output expected from the command
26  `!' metacommand, which can be one of:
27      `timeout' <integer>|no
28      `expect signal' <signal name>
29      `expect return' <integer>
30      `output' <ignore|display>
31      `setenv <key>=<val>'
32  `p' a string to print
33  `P' a string to print at the CRITICAL level (ease logging grepping)
34
35 If the expected output do not match what the command spits, TESH will produce
36 an error showing the diff (see OUTPUT below).
37 .SH IO ORDERS
38 The < and > lines add IO to the command defined in the current block (blocks
39 are separated by blank lines). It is possible to place these lines either after
40 the command or before. The difference between the two following chunks is
41 mainly cosmetic in your testsuites, TESH don't care. (cf IO-orders.tesh)
42
43  $ cat
44  < TOTO
45  > TOTO
46
47  > TOTO
48  $ cat
49  < TOTO
50
51 Nevertheless, it is possible to have several commands in the same block, but
52 none of them can have any output. It may seem a bit restrictive, as one could
53 say that a command gets all the IO until the next command, but I'm afraid of
54 errors such as the following:
55
56  $ cd toto
57  > TOTO
58  $ mkfile file
59
60 TOTO will be passed to the cd command, where the user clearly want to pass it
61 to the mkfile built-in command (see below).
62 .SH STREAM REDIRECTION
63 Stream redirections (">", "<" and "|" constructs in sh) are not
64 implemented yet in tesh. This is a bit restrictive, but well, patch
65 welcome...
66
67 The situation in which it is mainly problematic is to create a
68 temporary file. The solution is to use the "mkfile" built-in command,
69 as in the following example:
70 $ mkfile myFile
71 > some content
72 > to the file
73
74 This will create a file called myFile (first argument of the mkfile
75 command). Its content will be all the input provided to the command.
76 .SH RETURN CODE
77 TESH spits an appropriate error message when the child do not return 0 as
78 return code (cf. catch-return.tesh), and returns code+40 itself.
79
80 It is also possible to specify that a given command must return another
81 value. For this, use the "expect return" metacommand, which takes an integer as
82 argument. The change only apply to the next command (cf. set-return.tesh).
83 .SH SIGNALS
84 TESH detects when the child is killed by a signal (like on segfaults), and
85 spits an appropriate error message (cf. catch-signal.tesh).
86
87 It is also possible to specify that a given command must raise a given
88 signal. For this, use the "expect signal" metacommand. It takes the signal name
89 as argument. The change only apply to the next command (cf. set-signal.tesh).
90 .SH TIMEOUTS
91 By default, all commands are given 5 seconds to execute
92 (cf. catch-timeout.tesh). You can change this with the "timeout", which
93 takes an integer as argument. The change only apply to the next command
94 (cf. set-timeout.tesh). If you pass "no" as argument, the command
95 cannot timeout.
96 .SH OUTPUT
97 By default, the commands output is matched against the one expected,
98 and an error is raised on discrepancy. Metacommands to change this:
99  "output ignore"  -> output completely discarded
100  "output display" -> output displayed (but not verified)
101  "output sort"    -> sorts the display before verifying it (see below)
102 .SH SORTING OUTPUT
103 Sorting the output seems to be a strange idea, but it is mandatory in
104 SimGrid since the processes run out of order at any scheduling point
105 (ie, every processes ready to run at simulated time t run in
106 parallel). To ensure that the simulator outputs still match, we have
107 to sort the output back before comparing it.
108
109 We expect the simulators to run with that log formatting argument:
110    --log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n
111 Then, tesh sorts string on the 19 first chars only, and is stable when
112 line beginnings are equal. This should ensure that:
113  (1) tesh is effective (no false positive, no false negative)
114  (2) scheduling points are separated from each other
115  (3) at each scheduling point, processes are separated from each other
116  (4) the order of what a given process says at a given scheduling
117      point is preserved.
118
119 This is of course very SimGrid oriented, breaking the generality of
120 tesh, but who cares, actually?
121
122 If you want to change the length of the prefix used for the sort,
123 simply specify it after the output sort directive, like this:
124
125 ! output sort 22
126 .SH ENVIRONMENT
127 You can add some content to the tested processes environment with the
128 setenv metacommand. It works as expected. For example:
129   "setenv PATH=/bin"
130 .SH BUGS
131 No known bugs.