Fossil SCM

Tidy up docs ready for merge

danshearer 2026-11-18 09:58 UTC test-suite-new
Commit 2b8d7a025a806a1876c79aacb876677818b062ba392b30cc7a235d579185b9eb
1 file changed +14 -7
+14 -7
--- test/README.md
+++ test/README.md
@@ -13,11 +13,11 @@
1313
```sh
1414
tclsh /path/to/fossil/test/tester.tcl /path/to/fossil
1515
tclsh /path/to/fossil/test/tester.tcl /path/to/fossil merge1 update
1616
```
1717
18
-The names after the executable select test files, eg `update` runs `test/update.test`.
18
+Where `merge1` and `update` are names of test files, eg `test/update.test`.
1919
2020
Options are:
2121
2222
* `-quiet` prints only failures, skipped files and the summary.
2323
* `-verbose` prints the output of every `fossil` command.
@@ -26,15 +26,20 @@
2626
* `-keep` leaves the temporary repositories in place.
2727
* `-prot` also writes the output to the file `prot`.
2828
2929
`make test TESTFLAGS="-quiet update"` passes options and names via `make`.
3030
31
-A full run normally takes a few minutes. `tester.tcl` exits with status 0 when every test passes, and 1 when one or more tests fail. Failed tests are reported with what it expected vs what it got. The summary lists each skipped file with a reason, and known bugs. A known bug is a test for a fault that isn't fixed yet, marked `knownBug` in its test file; its failure is reported as `FAILED (knownBug)` and does not change the exit status unless `-strict` is given.
31
+A full run normally takes a few minutes. `tester.tcl` exits with status 0 when all tests pass, 1 when one or more tests fail. Failed tests are reported with
32
+what it expected vs what it got. The summary lists skipped files with a reason, and all known bugs reported as `FAILED (knownBug)`. Skips and known bugs do not
33
+change the exit status unless `-strict` is given.
34
+
35
+A new test should only require adding another `.test` file.
36
+
3237
3338
## Requirements
3439
35
-* Tcl 8.6 or later. `configure` finds `tclsh`, and `make test` fails if it finds none.
40
+* Tcl 8.6 or later, we also test with Tcl 9.0 which is now common. `configure` finds `tclsh`, and `make test` fails if it finds none.
3641
* A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
3742
which writes a session log to wherever it was started from.
3843
* `src/` which must be next to `test/`, just as it is in the source tree. Otherwise `settings.test` and `settings-repo.test` can't read the settings from the source.
3944
4045
The following tests are skipped when their requirements are missing:
@@ -45,18 +50,18 @@
4550
| `configure --json` | `json` |
4651
| `configure --with-th1-docs` | `th1-docs` |
4752
| `configure --with-th1-hooks` | `th1-hooks` |
4853
| `configure --with-tcl` | `th1-tcl` |
4954
50
-None of the tests need network access (but that doesn't mean all network-related tests will work, some isolated environments don't even have loopback and the test
51
-suite accounts for that.)
55
+None of the tests need network access. That doesn't mean all network-related tests will work, because some isolated environments don't even have loopback and
56
+the test suite detects this.
5257
5358
## Coverage
5459
5560
| Area | Test files |
5661
| --- | --- |
57
-| Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `update` |
62
+| Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` |
5863
| Branches and tags | `branch-tag` |
5964
| Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` |
6065
| Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
6166
| Diffs and deltas | `delta1`, `diff` |
6267
| Settings | `settings`, `settings-repo`, `set-manifest` |
@@ -66,11 +71,11 @@
6671
| Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` |
6772
6873
## Writing new tests
6974
7075
Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
71
-executable being tested and sets `RESULT` to its output and `CODE` to its exit status. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
76
+executable being tested and sets `RESULT` to its output and `CODE` to 0 if the command succeeded and did not write anything to standard error, or 1 otherwise. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
7277
report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
7378
reports a few skipped tests while the file continues, and `test_fail_then_return NAME
7479
REASON` records a failed setup step and stops the file. A last argument of `knownBug` to any of the `test` procedures marks a known bug as described above.
7580
7681
## Maintaining the tests
@@ -78,10 +83,12 @@
7883
First step is noticing bugs. One pattern is when Fossil's output changes causing tests that rely on changed output to fail. `tester.tcl` prints the expected and the actual text for each but this won't always be obvious. It's possible that output changes may mask a code failure too.
7984
8085
If you suspect an output-change bug, use `-verbose` to print the output of every command, and `-keep` to leave test repos in place for inspection. `rewrite-test-output.tcl` replaces hashes, process IDs and temporary paths in the output of a run with fixed strings, so you can use `diff` to compare two runs. You should then be able to update the expected output text.
8186
8287
When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
88
+
89
+If the known bug is the exit status of a `fossil` command, add `-knownBug` to that command too. Otherwise the command prints an `ERROR` line on every run, even with `-quiet`. With `-knownBug` you only see that line under `-strict`.
8390
8491
A known bug should fail on every system. If the fault only shows up in some environments, have the test set up that environment itself. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
8592
8693
Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
8794
8895
--- test/README.md
+++ test/README.md
@@ -13,11 +13,11 @@
13 ```sh
14 tclsh /path/to/fossil/test/tester.tcl /path/to/fossil
15 tclsh /path/to/fossil/test/tester.tcl /path/to/fossil merge1 update
16 ```
17
18 The names after the executable select test files, eg `update` runs `test/update.test`.
19
20 Options are:
21
22 * `-quiet` prints only failures, skipped files and the summary.
23 * `-verbose` prints the output of every `fossil` command.
@@ -26,15 +26,20 @@
26 * `-keep` leaves the temporary repositories in place.
27 * `-prot` also writes the output to the file `prot`.
28
29 `make test TESTFLAGS="-quiet update"` passes options and names via `make`.
30
31 A full run normally takes a few minutes. `tester.tcl` exits with status 0 when every test passes, and 1 when one or more tests fail. Failed tests are reported with what it expected vs what it got. The summary lists each skipped file with a reason, and known bugs. A known bug is a test for a fault that isn't fixed yet, marked `knownBug` in its test file; its failure is reported as `FAILED (knownBug)` and does not change the exit status unless `-strict` is given.
 
 
 
 
 
32
33 ## Requirements
34
35 * Tcl 8.6 or later. `configure` finds `tclsh`, and `make test` fails if it finds none.
36 * A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
37 which writes a session log to wherever it was started from.
38 * `src/` which must be next to `test/`, just as it is in the source tree. Otherwise `settings.test` and `settings-repo.test` can't read the settings from the source.
39
40 The following tests are skipped when their requirements are missing:
@@ -45,18 +50,18 @@
45 | `configure --json` | `json` |
46 | `configure --with-th1-docs` | `th1-docs` |
47 | `configure --with-th1-hooks` | `th1-hooks` |
48 | `configure --with-tcl` | `th1-tcl` |
49
50 None of the tests need network access (but that doesn't mean all network-related tests will work, some isolated environments don't even have loopback and the test
51 suite accounts for that.)
52
53 ## Coverage
54
55 | Area | Test files |
56 | --- | --- |
57 | Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `update` |
58 | Branches and tags | `branch-tag` |
59 | Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` |
60 | Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
61 | Diffs and deltas | `delta1`, `diff` |
62 | Settings | `settings`, `settings-repo`, `set-manifest` |
@@ -66,11 +71,11 @@
66 | Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` |
67
68 ## Writing new tests
69
70 Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
71 executable being tested and sets `RESULT` to its output and `CODE` to its exit status. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
72 report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
73 reports a few skipped tests while the file continues, and `test_fail_then_return NAME
74 REASON` records a failed setup step and stops the file. A last argument of `knownBug` to any of the `test` procedures marks a known bug as described above.
75
76 ## Maintaining the tests
@@ -78,10 +83,12 @@
78 First step is noticing bugs. One pattern is when Fossil's output changes causing tests that rely on changed output to fail. `tester.tcl` prints the expected and the actual text for each but this won't always be obvious. It's possible that output changes may mask a code failure too.
79
80 If you suspect an output-change bug, use `-verbose` to print the output of every command, and `-keep` to leave test repos in place for inspection. `rewrite-test-output.tcl` replaces hashes, process IDs and temporary paths in the output of a run with fixed strings, so you can use `diff` to compare two runs. You should then be able to update the expected output text.
81
82 When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
 
 
83
84 A known bug should fail on every system. If the fault only shows up in some environments, have the test set up that environment itself. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
85
86 Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
87
88
--- test/README.md
+++ test/README.md
@@ -13,11 +13,11 @@
13 ```sh
14 tclsh /path/to/fossil/test/tester.tcl /path/to/fossil
15 tclsh /path/to/fossil/test/tester.tcl /path/to/fossil merge1 update
16 ```
17
18 Where `merge1` and `update` are names of test files, eg `test/update.test`.
19
20 Options are:
21
22 * `-quiet` prints only failures, skipped files and the summary.
23 * `-verbose` prints the output of every `fossil` command.
@@ -26,15 +26,20 @@
26 * `-keep` leaves the temporary repositories in place.
27 * `-prot` also writes the output to the file `prot`.
28
29 `make test TESTFLAGS="-quiet update"` passes options and names via `make`.
30
31 A full run normally takes a few minutes. `tester.tcl` exits with status 0 when all tests pass, 1 when one or more tests fail. Failed tests are reported with
32 what it expected vs what it got. The summary lists skipped files with a reason, and all known bugs reported as `FAILED (knownBug)`. Skips and known bugs do not
33 change the exit status unless `-strict` is given.
34
35 A new test should only require adding another `.test` file.
36
37
38 ## Requirements
39
40 * Tcl 8.6 or later, we also test with Tcl 9.0 which is now common. `configure` finds `tclsh`, and `make test` fails if it finds none.
41 * A writable temporary directory, from `TMPDIR`, `TEMP` or `TMP`, falling back to `/tmp`. All writes are made to the temporary directory, except with `-prot`
42 which writes a session log to wherever it was started from.
43 * `src/` which must be next to `test/`, just as it is in the source tree. Otherwise `settings.test` and `settings-repo.test` can't read the settings from the source.
44
45 The following tests are skipped when their requirements are missing:
@@ -45,18 +50,18 @@
50 | `configure --json` | `json` |
51 | `configure --with-th1-docs` | `th1-docs` |
52 | `configure --with-th1-hooks` | `th1-hooks` |
53 | `configure --with-tcl` | `th1-tcl` |
54
55 None of the tests need network access. That doesn't mean all network-related tests will work, because some isolated environments don't even have loopback and
56 the test suite detects this.
57
58 ## Coverage
59
60 | Area | Test files |
61 | --- | --- |
62 | Check-ins and the working tree | `amend`, `clean`, `commit-warning`, `mv-rm`, `revert`, `stash`, `symlinks`, `unicode-pathnames`, `update` |
63 | Branches and tags | `branch-tag` |
64 | Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` |
65 | Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` |
66 | Diffs and deltas | `delta1`, `diff` |
67 | Settings | `settings`, `settings-repo`, `set-manifest` |
@@ -66,11 +71,11 @@
71 | Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` |
72
73 ## Writing new tests
74
75 Each `NAME.test` file is a Tcl script sourced by `tester.tcl`. `test_setup` creates and opens a repository in a temporary directory. `fossil ARGS` runs the
76 executable being tested and sets `RESULT` to its output and `CODE` to 0 if the command succeeded and did not write anything to standard error, or 1 otherwise. `test_eq NAME ACTUAL EXPECTED` and `test_match NAME ACTUAL PATTERN`
77 report both values when they fail, and `test NAME EXPRESSION` gives the report. `test_skip REASON` skips the rest of the file, `test_skip_part REASON`
78 reports a few skipped tests while the file continues, and `test_fail_then_return NAME
79 REASON` records a failed setup step and stops the file. A last argument of `knownBug` to any of the `test` procedures marks a known bug as described above.
80
81 ## Maintaining the tests
@@ -78,10 +83,12 @@
83 First step is noticing bugs. One pattern is when Fossil's output changes causing tests that rely on changed output to fail. `tester.tcl` prints the expected and the actual text for each but this won't always be obvious. It's possible that output changes may mask a code failure too.
84
85 If you suspect an output-change bug, use `-verbose` to print the output of every command, and `-keep` to leave test repos in place for inspection. `rewrite-test-output.tcl` replaces hashes, process IDs and temporary paths in the output of a run with fixed strings, so you can use `diff` to compare two runs. You should then be able to update the expected output text.
86
87 When a test finds a fault that is not yet fixed, add `knownBug` as the test's last argument, so that the suite still exits with status 0. A known bug that passes is reported as `OK (knownBug)?`. Don't forget to remove `knownBug` when you're sure the fault is fixed.
88
89 If the known bug is the exit status of a `fossil` command, add `-knownBug` to that command too. Otherwise the command prints an `ERROR` line on every run, even with `-quiet`. With `-knownBug` you only see that line under `-strict`.
90
91 A known bug should fail on every system. If the fault only shows up in some environments, have the test set up that environment itself. If a test needs something the system might not have, that's a requirement, so use `test_skip`.
92
93 Stray files in `test/` can be confusing because `delta1.test` and `merge2.test` run their tests on every file and the counts may differ from what is expected. A different total is not a failure.
94
95

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button