@@ -8,6 +8,12 @@ management. In some cases optional features are turned on by mkfs and the
88filesystem image could be mounted, such tests might fail if there's lack of
99support.
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
1319Run 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
201207There'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
203209helper 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
2142201 . Pick the category for the new test or fallback to ` misc-tests ` if not sure. For
215221an 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
217224common scripts and/or prepares the test devices. Other scripts contain examples
218225how to do mkfs, mount, unmount, check, loop device management etc.
219226
@@ -229,22 +236,23 @@ infrastructure.
229236
2302375 . ** 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
2362436 . 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
246254Most 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
248256the test code and kernel of the environment.
249257
250258In 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
295303tests. They are in the top level directory of the testsuite and their path
296304cannot 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