Fossil SCM
Update roundtrip.test now that "fossil patch" no longer depends on a a "hostname" executable.
Commit
3ed251ad36013415fd6925616c0db05eb3979bea590fb28069c3c45ed70bb3cb
Parent
0b3f9b31aa328d4…
2 files changed
+2
+4
-14
+2
| --- test/README.md | ||
| +++ test/README.md | ||
| @@ -78,10 +78,12 @@ | ||
| 78 | 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 | 79 | |
| 80 | 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 | 81 | |
| 82 | 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`. | |
| 83 | 85 | |
| 84 | 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. |
| 85 | 87 | |
| 86 | 88 | Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this |
| 87 | 89 | problem. |
| 88 | 90 |
| --- test/README.md | |
| +++ test/README.md | |
| @@ -78,10 +78,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 | 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. |
| 85 | |
| 86 | Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this |
| 87 | problem. |
| 88 |
| --- test/README.md | |
| +++ test/README.md | |
| @@ -78,10 +78,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 | Beware of global variables! If you must create a new global variable, be sure there isn't a collision with other files. Some future design should avoid this |
| 89 | problem. |
| 90 |
+4
-14
| --- test/roundtrip.test | ||
| +++ test/roundtrip.test | ||
| @@ -268,27 +268,17 @@ | ||
| 268 | 268 | set changesBefore [normalize_result] |
| 269 | 269 | set filesBefore [roundtrip_dir_files . {rt.patch}] |
| 270 | 270 | |
| 271 | 271 | fossil patch create rt.patch |
| 272 | 272 | |
| 273 | -# The patch records the name of the computer it was made on. fossil | |
| 274 | -# reads the name from the "hostname" program, so where that program is | |
| 275 | -# missing, the name is empty and the shell's error appears on standard | |
| 276 | -# error. The name that the program prints can differ from Tcl's | |
| 277 | -# "info hostname", for example in letter case or in its domain. | |
| 273 | +# The patch data contains the name of the computer it was made on. Tcl | |
| 274 | +# "info hostname" can give multiple results for the same computer (eg with | |
| 275 | +# a domain added) so we're not using it. | |
| 278 | 276 | # |
| 279 | 277 | fossil sqlite3 --no-repository rt.patch \ |
| 280 | 278 | "SELECT value FROM cfg WHERE key='hostname'" |
| 281 | -if {[auto_execok hostname] eq ""} { | |
| 282 | - set hostname [info hostname] | |
| 283 | - set hostnameConstraint knownBug | |
| 284 | -} else { | |
| 285 | - set hostname [string trim [exec hostname]] | |
| 286 | - set hostnameConstraint "" | |
| 287 | -} | |
| 288 | -test_eq roundtrip-patch-hostname [normalize_result] $hostname \ | |
| 289 | - $hostnameConstraint | |
| 279 | +test_match roundtrip-patch-hostname [normalize_result] {^\S+$} | |
| 290 | 280 | |
| 291 | 281 | fossil revert |
| 292 | 282 | file delete new.txt |
| 293 | 283 | fossil changes |
| 294 | 284 | test_eq roundtrip-patch-reverted [normalize_result] "" |
| 295 | 285 |
| --- test/roundtrip.test | |
| +++ test/roundtrip.test | |
| @@ -268,27 +268,17 @@ | |
| 268 | set changesBefore [normalize_result] |
| 269 | set filesBefore [roundtrip_dir_files . {rt.patch}] |
| 270 | |
| 271 | fossil patch create rt.patch |
| 272 | |
| 273 | # The patch records the name of the computer it was made on. fossil |
| 274 | # reads the name from the "hostname" program, so where that program is |
| 275 | # missing, the name is empty and the shell's error appears on standard |
| 276 | # error. The name that the program prints can differ from Tcl's |
| 277 | # "info hostname", for example in letter case or in its domain. |
| 278 | # |
| 279 | fossil sqlite3 --no-repository rt.patch \ |
| 280 | "SELECT value FROM cfg WHERE key='hostname'" |
| 281 | if {[auto_execok hostname] eq ""} { |
| 282 | set hostname [info hostname] |
| 283 | set hostnameConstraint knownBug |
| 284 | } else { |
| 285 | set hostname [string trim [exec hostname]] |
| 286 | set hostnameConstraint "" |
| 287 | } |
| 288 | test_eq roundtrip-patch-hostname [normalize_result] $hostname \ |
| 289 | $hostnameConstraint |
| 290 | |
| 291 | fossil revert |
| 292 | file delete new.txt |
| 293 | fossil changes |
| 294 | test_eq roundtrip-patch-reverted [normalize_result] "" |
| 295 |
| --- test/roundtrip.test | |
| +++ test/roundtrip.test | |
| @@ -268,27 +268,17 @@ | |
| 268 | set changesBefore [normalize_result] |
| 269 | set filesBefore [roundtrip_dir_files . {rt.patch}] |
| 270 | |
| 271 | fossil patch create rt.patch |
| 272 | |
| 273 | # The patch data contains the name of the computer it was made on. Tcl |
| 274 | # "info hostname" can give multiple results for the same computer (eg with |
| 275 | # a domain added) so we're not using it. |
| 276 | # |
| 277 | fossil sqlite3 --no-repository rt.patch \ |
| 278 | "SELECT value FROM cfg WHERE key='hostname'" |
| 279 | test_match roundtrip-patch-hostname [normalize_result] {^\S+$} |
| 280 | |
| 281 | fossil revert |
| 282 | file delete new.txt |
| 283 | fossil changes |
| 284 | test_eq roundtrip-patch-reverted [normalize_result] "" |
| 285 |