Fossil SCM

Update roundtrip.test now that "fossil patch" no longer depends on a a "hostname" executable.

danshearer 2026-11-17 22:38 UTC test-suite-new
Commit 3ed251ad36013415fd6925616c0db05eb3979bea590fb28069c3c45ed70bb3cb
--- test/README.md
+++ test/README.md
@@ -78,10 +78,12 @@
7878
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.
7979
8080
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.
8181
8282
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`.
8385
8486
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.
8587
8688
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
8789
problem.
8890
--- 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
--- test/roundtrip.test
+++ test/roundtrip.test
@@ -268,27 +268,17 @@
268268
set changesBefore [normalize_result]
269269
set filesBefore [roundtrip_dir_files . {rt.patch}]
270270
271271
fossil patch create rt.patch
272272
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.
278276
#
279277
fossil sqlite3 --no-repository rt.patch \
280278
"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+$}
290280
291281
fossil revert
292282
file delete new.txt
293283
fossil changes
294284
test_eq roundtrip-patch-reverted [normalize_result] ""
295285
--- 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

Keyboard Shortcuts

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