Skip to content

Commit d12e76e

Browse files
committed
btrfs-progs: tests: update README
Minor fixes and updates that reflect current state. [ci skip] Signed-off-by: David Sterba <[email protected]>
1 parent f6ec4de commit d12e76e

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

Diff for: tests/README.md

+20-10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ management. In some cases optional features are turned on by mkfs and the
88
filesystem image could be mounted, such tests might fail if there's lack of
99
support.
1010

11+
The testsuite follows the principles:
12+
13+
- gather all output to logs
14+
- stop on first failure (do not clean up until the problem is investigated)
15+
- detect available capabilities in the system, skip if missing
16+
1117
## Quick start
1218

1319
Run the tests from the top directory:
@@ -199,7 +205,7 @@ command `losetup` and eventually delete all existing loop devices with `losetup
199205
### Prototyping tests, quick tests
200206

201207
There's a script `test-console.sh` that will run shell commands in a loop and
202-
logs the output with the testing environment set up. It sources the common
208+
log the output with the testing environment set up. It sources the common
203209
helper scripts so the shell functions are available.
204210

205211
### Runtime dependencies
@@ -213,7 +219,8 @@ specific tests need the following packages installed: `acl`, `attr`,
213219

214220
1. Pick the category for the new test or fallback to `misc-tests` if not sure. For
215221
an easy start copy an existing `test.sh` script from some test that might be
216-
close to the purpose of your new test. The environment setup includes the
222+
close to the purpose of your new test, or use one of the templates in the
223+
[tests/template/](template/) directory. The environment setup includes the
217224
common scripts and/or prepares the test devices. Other scripts contain examples
218225
how to do mkfs, mount, unmount, check, loop device management etc.
219226

@@ -229,22 +236,23 @@ infrastructure.
229236

230237
5. **Test your test.** Use the `TEST` variable to jump right to your test:
231238
```shell
232-
$ make TEST=012\* tests-misc # from top directory
233-
$ TEST=012\* ./misc-tests.sh # from tests/
239+
$ make TEST=012\* tests-misc # from the top or tests/ directory
240+
$ TEST=012\* ./misc-tests.sh # alternatively from tests/
234241
```
235242

236243
6. The commit changelog should reference a commit that either introduced or
237-
fixed the bug (or both). Subject line of the shall mention the name of the
238-
new directory for ease of search, e.g. `btrfs-progs: tests: add 012-subvolume-sync-must-wait`
244+
fixed the bug (or both). Subject line of the could mention the name of the
245+
new directory for ease of search (e.g. `btrfs-progs: tests: add 012-subvolume-sync-must-wait`)
246+
or a brief description of the test case (e.g. `btrfs-progs: tests: add case for waiting on subvolume sync after deletion`)
239247

240-
7. A commit that fixes a bug should be applied before the test that verifies
248+
7. A commit that fixes a bug should be applied *before* the test that verifies
241249
the fix. This is to keep the git history bisectable.
242250

243251

244252
### Test images
245253

246254
Most tests should be able to create the test images from scratch, using regular
247-
commands and file operation. The commands also document the test case and use
255+
commands and file operations. The commands also document the test case and use
248256
the test code and kernel of the environment.
249257

250258
In other cases, a pre-created image may be the right way if the above does not
@@ -295,7 +303,8 @@ There are some utilities that are not distributed but are necessary for the
295303
tests. They are in the top level directory of the testsuite and their path
296304
cannot be set.
297305

298-
The tests assume write access to their directories.
306+
The tests assume write access to their directories and an existing `/tmp`
307+
directory.
299308

300309

301310
# Coding style, best practices
@@ -305,9 +314,10 @@ The tests assume write access to their directories.
305314
* quote all variables by default, any path, even the TOP could need that, and
306315
we use it everywhere
307316
* even if the variable is safe, use quotes for consistency and to ease
308-
reading the code
317+
reading the code (syntax highlighting in editors)
309318
* there are exceptions:
310319
* `$SUDO_HELPER` as it might be intentionally unset
320+
* conditionally set options that are stored in a variable
311321
* use `#!/bin/bash` explicitly
312322
* check for all external dependencies (`check_global_prereq`)
313323
* check for internal dependencies (`check_prereq`), though the basic set is

0 commit comments

Comments
 (0)