Skip to content

Commit 10ba68e

Browse files
committed
update
1 parent f160970 commit 10ba68e

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

README.md

+38-11
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ Below is a list of configuration values (fields) in the `suite.ini` file.
5656
* `core` — major type of tests in this suite.
5757
Should have one of the following values:
5858

59-
* `tarantool`diff-test, a test that reads a file with commands,
59+
* `tarantool` — a test that reads a file with commands
6060
feeds it line by line to the tarantool console,
6161
writes requests and responses to an output file,
6262
and then compares that file with a reference file.
63+
Often called a "diff-test".
6364
* `app` — a Lua script test.
6465
Most of such tests produce
6566
[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.
7475
* `script` — A file with Tarantool commands.
7576
It is used to start the default server using `tarantoolctl`.
7677
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`
7879
and ignored with other types of tests.
7980

8081
* `config` — name of a test configuration file, for example, `engine.cfg`.
@@ -146,18 +147,29 @@ fragile = {
146147
Each test consists of the following files:
147148

148149
* 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`.
151152

152153
Reference file contains saved test output.
153154
It is required for tests with non-TAP13 output.
154155
Running `test-run.py` with `--update-result` option will update
155156
the `.result` files with new test output.
156157

157158
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.
158160
In the local Python environment of a test run there's a `self` object,
159161
which is an instance of the [`Test` class](./lib/test.py).
160162
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+
```
161173

162174

163175
## Test execution
@@ -172,26 +184,41 @@ Otherwise, test-run compares it with the `.result` file.
172184
If there's a difference between `.reject` and `.result`, the test fails and
173185
the last 15 lines of diff are printed to output.
174186

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.
178189

179190
## Test configuration
180191

181192
Test configuration file contains configuration for multiple runs.
182193
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:
185196

186197
```json
187198
{
188199
"my.test.lua": {
189200
"first": {"a": 1, "b": 2},
190201
"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"}
191217
},
218+
"second.test.lua": {},
192219
"*": {
193220
"memtx": {"engine": "memtx"},
194-
"sophia": {"engine": "sophia"}
221+
"vinyl": {"engine": "vinyl"}
195222
}
196223
}
197224
```
@@ -201,7 +228,7 @@ In the test case we can get configuration from the inspector:
201228
```lua
202229
engine = test_run:get_cfg('engine')
203230
-- first run engine is 'memtx'
204-
-- second run engine is 'sophia'
231+
-- second run engine is 'vinyl'
205232
```
206233

207234
"engine" value has a special meaning for `*.test.sql` files: if it is "memtx" or

0 commit comments

Comments
 (0)