Fossil SCM
Tidy up docs ready for merge
Commit
2b8d7a025a806a1876c79aacb876677818b062ba392b30cc7a235d579185b9eb
Parent
ea810b6f00dd360…
1 file changed
+14
-7
+14
-7
| --- test/README.md | ||
| +++ test/README.md | ||
| @@ -13,11 +13,11 @@ | ||
| 13 | 13 | ```sh |
| 14 | 14 | tclsh /path/to/fossil/test/tester.tcl /path/to/fossil |
| 15 | 15 | tclsh /path/to/fossil/test/tester.tcl /path/to/fossil merge1 update |
| 16 | 16 | ``` |
| 17 | 17 | |
| 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`. | |
| 19 | 19 | |
| 20 | 20 | Options are: |
| 21 | 21 | |
| 22 | 22 | * `-quiet` prints only failures, skipped files and the summary. |
| 23 | 23 | * `-verbose` prints the output of every `fossil` command. |
| @@ -26,15 +26,20 @@ | ||
| 26 | 26 | * `-keep` leaves the temporary repositories in place. |
| 27 | 27 | * `-prot` also writes the output to the file `prot`. |
| 28 | 28 | |
| 29 | 29 | `make test TESTFLAGS="-quiet update"` passes options and names via `make`. |
| 30 | 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. | |
| 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 | + | |
| 32 | 37 | |
| 33 | 38 | ## Requirements |
| 34 | 39 | |
| 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. | |
| 36 | 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` |
| 37 | 42 | which writes a session log to wherever it was started from. |
| 38 | 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. |
| 39 | 44 | |
| 40 | 45 | The following tests are skipped when their requirements are missing: |
| @@ -45,18 +50,18 @@ | ||
| 45 | 50 | | `configure --json` | `json` | |
| 46 | 51 | | `configure --with-th1-docs` | `th1-docs` | |
| 47 | 52 | | `configure --with-th1-hooks` | `th1-hooks` | |
| 48 | 53 | | `configure --with-tcl` | `th1-tcl` | |
| 49 | 54 | |
| 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. | |
| 52 | 57 | |
| 53 | 58 | ## Coverage |
| 54 | 59 | |
| 55 | 60 | | Area | Test files | |
| 56 | 61 | | --- | --- | |
| 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` | | |
| 58 | 63 | | Branches and tags | `branch-tag` | |
| 59 | 64 | | Merges, cherrypicks, backouts, and annotate and blame after them | `merge1` to `merge6`, `merge-history`, `merge_exe`, `merge_renames`, `merge_renames_2`, `merge_warn` | |
| 60 | 65 | | Git export and import, bundles, patches, ZIP and tarball archives | `roundtrip` | |
| 61 | 66 | | Diffs and deltas | `delta1`, `diff` | |
| 62 | 67 | | Settings | `settings`, `settings-repo`, `set-manifest` | |
| @@ -66,11 +71,11 @@ | ||
| 66 | 71 | | Parsing and file utilities | `cmdline`, `contains-selector`, `file1`, `glob`, `reserved-names`, `utf` | |
| 67 | 72 | |
| 68 | 73 | ## Writing new tests |
| 69 | 74 | |
| 70 | 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 |
| 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` | |
| 72 | 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` |
| 73 | 78 | reports a few skipped tests while the file continues, and `test_fail_then_return NAME |
| 74 | 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. |
| 75 | 80 | |
| 76 | 81 | ## Maintaining the tests |
| @@ -78,10 +83,12 @@ | ||
| 78 | 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. |
| 79 | 84 | |
| 80 | 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. |
| 81 | 86 | |
| 82 | 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`. | |
| 83 | 90 | |
| 84 | 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`. |
| 85 | 92 | |
| 86 | 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. |
| 87 | 94 | |
| 88 | 95 |
| --- 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 |