@@ -56,10 +56,11 @@ Below is a list of configuration values (fields) in the `suite.ini` file.
56
56
* ` core ` — major type of tests in this suite.
57
57
Should have one of the following values:
58
58
59
- * ` tarantool ` — diff-test, a test that reads a file with commands,
59
+ * ` tarantool ` — a test that reads a file with commands
60
60
feeds it line by line to the tarantool console,
61
61
writes requests and responses to an output file,
62
62
and then compares that file with a reference file.
63
+ Often called a "diff-test".
63
64
* ` app ` — a Lua script test.
64
65
Most of such tests produce
65
66
[ TAP13 output] ( http://testanything.org/tap-version-13-specification.html )
@@ -74,7 +75,7 @@ Below is a list of configuration values (fields) in the `suite.ini` file.
74
75
* ` script ` — A file with Tarantool commands.
75
76
It is used to start the default server using ` tarantoolctl ` .
76
77
The value should be a file in the same directory as ` suite.ini ` , like ` box.lua ` or ` master.lua ` .
77
- This setting is mandatory for suites with diff-tests ( ` core = tarantool ` )
78
+ This setting is mandatory for test suites with ` core = tarantool `
78
79
and ignored with other types of tests.
79
80
80
81
* ` config ` — name of a test configuration file, for example, ` engine.cfg ` .
@@ -146,18 +147,29 @@ fragile = {
146
147
Each test consists of the following files:
147
148
148
149
* Test file: ` <name>.test.lua ` , ` <name>_test.lua ` , ` <name>.test.py ` , or ` <name>.test.sql ` .
149
- * Reference file: ` <name>.result ` .
150
- * Skip condition file: ` <name>.skipcond ` .
150
+ * Reference file (optional) : ` <name>.result ` .
151
+ * Skip condition file (optional) : ` <name>.skipcond ` .
151
152
152
153
Reference file contains saved test output.
153
154
It is required for tests with non-TAP13 output.
154
155
Running ` test-run.py ` with ` --update-result ` option will update
155
156
the ` .result ` files with new test output.
156
157
157
158
The optional skip condition file is a Python script.
159
+ It is used to skip a test on some conditions, typically on a certain OS.
158
160
In the local Python environment of a test run there's a ` self ` object,
159
161
which is an instance of the [ ` Test ` class] ( ./lib/test.py ) .
160
162
Set ` self.skip = 1 ` to skip this test.
163
+ For example, to skip ` sometest ` on OpenBSD,
164
+ add the following ` sometest.skipcond ` file:
165
+
166
+ ``` python
167
+ import platform
168
+
169
+ # Disabled on OpenBSD due to fail #XXXX.
170
+ if platform.system() == ' OpenBSD' :
171
+ self .skip = 1
172
+ ```
161
173
162
174
163
175
## Test execution
@@ -172,26 +184,41 @@ Otherwise, test-run compares it with the `.result` file.
172
184
If there's a difference between ` .reject ` and ` .result ` , the test fails and
173
185
the last 15 lines of diff are printed to output.
174
186
175
- Whenever a test fails, the ` .reject ` file is saved in the ` <vardir>/rejects/<suite> `
176
- subdirectory given in options or set locally as ` var/rejects/<suite> ` by default.
177
- If the test is considered successful, the ` .reject ` file is deleted.
187
+ Whenever a test fails, the ` .reject ` file is saved
188
+ and the path to this file is printed to output.
178
189
179
190
## Test configuration
180
191
181
192
Test configuration file contains configuration for multiple runs.
182
193
For each test section, system runs a separate test and compares the result to the common ` .result ` file.
183
- For example, we need to run a test with different DB engines ( ` "*" ` means the default
184
- configuration) :
194
+
195
+ For example, ` my.test.lua ` will run with two different sets of parameters :
185
196
186
197
``` json
187
198
{
188
199
"my.test.lua" : {
189
200
"first" : {"a" : 1 , "b" : 2 },
190
201
"second" : {"a" : 1 , "b" : 3 }
202
+ }
203
+ }
204
+ ```
205
+
206
+ A common case is to run a test with different DB engines.
207
+ In the example below:
208
+
209
+ * ` first.test.lua ` will run only on the memtx engine;
210
+ * ` second.test.lua ` will run as is, without parameterizing;
211
+ * all other tests in the suite (` * ` ) will be parameterized to run on both memtx and vinyl engines.
212
+ *
213
+ ``` json
214
+ {
215
+ "first.test.lua" : {
216
+ "memtx" : {"engine" : " memtx" }
191
217
},
218
+ "second.test.lua" : {},
192
219
"*" : {
193
220
"memtx" : {"engine" : " memtx" },
194
- "sophia " : {"engine" : " sophia " }
221
+ "vinyl " : {"engine" : " vinyl " }
195
222
}
196
223
}
197
224
```
@@ -201,7 +228,7 @@ In the test case we can get configuration from the inspector:
201
228
``` lua
202
229
engine = test_run :get_cfg (' engine' )
203
230
-- first run engine is 'memtx'
204
- -- second run engine is 'sophia '
231
+ -- second run engine is 'vinyl '
205
232
```
206
233
207
234
"engine" value has a special meaning for ` *.test.sql ` files: if it is "memtx" or
0 commit comments