Fossil SCM

Fix direct fossil exec calls in 3 test files to call the "fossil" and "fossil_raw" the helper procedures in tester.tcl.

danshearer 2026-11-27 22:50 UTC test-suite-new
Commit f9fea473a4540c5ee6fdf5f971410a50b125f6b58c931eaf96c2717d0c8cb567
+1 -1
--- test/README.md
+++ test/README.md
@@ -194,11 +194,11 @@
194194
195195
* Start each test name and each procedure name with the file's name or a short form of it, such as `sync-clone-artifacts` and `sync_commit`. A failure report then says which file to open.
196196
* Comment a procedure only if its name and arguments don't say what it does. Don't repeat the code in a comment.
197197
* Call your global variables what you like. `tester.tcl` removes them when your file ends, so two files can't collide. Don't set a variable that `tester.tcl` owns, such as `RESULT`, `CODE`, `testdir` or `fossilexe`.
198198
* If the file needs something the system might not have, call `test_skip` near the top so the summary shows it.
199
-* `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself.
199
+* `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself, unless the test has to leave `fossil` running in the background.
200200
* Read a file with `read_file` and write one with `write_file`.
201201
* If a test needs a program to stand in for a server, `ssh` or a merge tool, look in `standin/` before writing another script inside a Tcl string. `test_standin NAME DESTINATION` copies one into the test's directory.
202202
* Keep lines within 80 columns.
203203
204204
A command that fails under `fossil_raw` isn't reported as an error, so
205205
--- test/README.md
+++ test/README.md
@@ -194,11 +194,11 @@
194
195 * Start each test name and each procedure name with the file's name or a short form of it, such as `sync-clone-artifacts` and `sync_commit`. A failure report then says which file to open.
196 * Comment a procedure only if its name and arguments don't say what it does. Don't repeat the code in a comment.
197 * Call your global variables what you like. `tester.tcl` removes them when your file ends, so two files can't collide. Don't set a variable that `tester.tcl` owns, such as `RESULT`, `CODE`, `testdir` or `fossilexe`.
198 * If the file needs something the system might not have, call `test_skip` near the top so the summary shows it.
199 * `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself.
200 * Read a file with `read_file` and write one with `write_file`.
201 * If a test needs a program to stand in for a server, `ssh` or a merge tool, look in `standin/` before writing another script inside a Tcl string. `test_standin NAME DESTINATION` copies one into the test's directory.
202 * Keep lines within 80 columns.
203
204 A command that fails under `fossil_raw` isn't reported as an error, so
205
--- test/README.md
+++ test/README.md
@@ -194,11 +194,11 @@
194
195 * Start each test name and each procedure name with the file's name or a short form of it, such as `sync-clone-artifacts` and `sync_commit`. A failure report then says which file to open.
196 * Comment a procedure only if its name and arguments don't say what it does. Don't repeat the code in a comment.
197 * Call your global variables what you like. `tester.tcl` removes them when your file ends, so two files can't collide. Don't set a variable that `tester.tcl` owns, such as `RESULT`, `CODE`, `testdir` or `fossilexe`.
198 * If the file needs something the system might not have, call `test_skip` near the top so the summary shows it.
199 * `fossil ARGS` counts output on standard error as a failure and can't tell a crash from an error. If your test expects either, reads the output as bytes, gives `fossil` input or needs a time limit, use `fossil_raw ARGS`, which sets `CODE` to the exit status, `crash` or `timeout`. Don't call `exec $::fossilexe` yourself, unless the test has to leave `fossil` running in the background.
200 * Read a file with `read_file` and write one with `write_file`.
201 * If a test needs a program to stand in for a server, `ssh` or a merge tool, look in `standin/` before writing another script inside a Tcl string. `test_standin NAME DESTINATION` copies one into the test's directory.
202 * Keep lines within 80 columns.
203
204 A command that fails under `fossil_raw` isn't reported as an error, so
205
+1 -2
--- test/login.test
+++ test/login.test
@@ -237,12 +237,11 @@
237237
238238
###############################################################################
239239
# test-ishuman labels User-Agent strings read from standard input.
240240
241241
proc login_ishuman {agent} {
242
- write_file agent.txt "$agent\n"
243
- set ::RESULT [exec $::fossilexe test-ishuman < agent.txt]
242
+ fossil_raw -input "$agent\n" test-ishuman
244243
return [lindex [split [string trim $::RESULT]] 0]
245244
}
246245
test_eq login-ishuman-firefox [login_ishuman "Mozilla/5.0 Firefox/122"] HUMAN
247246
test_eq login-ishuman-spider [login_ishuman "something spider"] ROBOT
248247
test_eq login-ishuman-url [login_ishuman "agent http://x"] ROBOT
249248
--- test/login.test
+++ test/login.test
@@ -237,12 +237,11 @@
237
238 ###############################################################################
239 # test-ishuman labels User-Agent strings read from standard input.
240
241 proc login_ishuman {agent} {
242 write_file agent.txt "$agent\n"
243 set ::RESULT [exec $::fossilexe test-ishuman < agent.txt]
244 return [lindex [split [string trim $::RESULT]] 0]
245 }
246 test_eq login-ishuman-firefox [login_ishuman "Mozilla/5.0 Firefox/122"] HUMAN
247 test_eq login-ishuman-spider [login_ishuman "something spider"] ROBOT
248 test_eq login-ishuman-url [login_ishuman "agent http://x"] ROBOT
249
--- test/login.test
+++ test/login.test
@@ -237,12 +237,11 @@
237
238 ###############################################################################
239 # test-ishuman labels User-Agent strings read from standard input.
240
241 proc login_ishuman {agent} {
242 fossil_raw -input "$agent\n" test-ishuman
 
243 return [lindex [split [string trim $::RESULT]] 0]
244 }
245 test_eq login-ishuman-firefox [login_ishuman "Mozilla/5.0 Firefox/122"] HUMAN
246 test_eq login-ishuman-spider [login_ishuman "something spider"] ROBOT
247 test_eq login-ishuman-url [login_ishuman "agent http://x"] ROBOT
248
--- test/merge5.test
+++ test/merge5.test
@@ -19,16 +19,17 @@
1919
#
2020
2121
# Verify the results of a check-out
2222
#
2323
proc checkout-test {testid expected_content} {
24
+ global RESULT
2425
set flist {}
25
- foreach {status filename} [exec $::fossilexe ls -l] {
26
+ fossil ls -l
27
+ foreach {status filename} $RESULT {
2628
if {$status!="DELETED"} {lappend flist $filename}
2729
}
2830
eval fossil sha1sum [lsort $flist]
29
- global RESULT
3031
regsub -all {\n *} [string trim $expected_content] "\n " expected
3132
regsub -all {\n *} [string trim $RESULT] "\n " result
3233
if {$result!=$expected} {
3334
protOut " Expected:\n $expected"
3435
protOut " Got:\n $result"
@@ -40,15 +41,15 @@
4041
4142
require_no_open_checkout; test_setup ""
4243
4344
# Construct a test repository
4445
#
45
-exec $::fossilexe sqlite3 --no-repository m5.fossil \
46
- <$testfiledir/${testfile}_repo.sql
46
+fossil_raw -input [read_file $testfiledir/${testfile}_repo.sql] \
47
+ sqlite3 --no-repository m5.fossil
4748
# The SQL is a dump of a repository from 2010, whose config table has no
4849
# mtime column, and "fossil rebuild" writes to config.mtime.
49
-exec $::fossilexe sqlite3 --no-repository m5.fossil \
50
+fossil_raw sqlite3 --no-repository m5.fossil \
5051
"ALTER TABLE config ADD COLUMN mtime INTEGER;"
5152
fossil rebuild m5.fossil
5253
fossil open m5.fossil
5354
fossil user default drh --user drh
5455
fossil update baseline
@@ -219,11 +220,12 @@
219220
proc conflict-test {testid} {
220221
global RESULT
221222
set reported [string match "*WARNING: 1 merge conflicts*" $RESULT]
222223
test merge5-$testid-reported $reported
223224
set flist {}
224
- foreach {status filename} [exec $::fossilexe ls -l] {
225
+ fossil ls -l
226
+ foreach {status filename} $RESULT {
225227
if {$status!="DELETED"} {lappend flist $filename}
226228
}
227229
test merge5-$testid-files {[lsort $flist] eq "four.txt three.txt two.txt"}
228230
set four [read_file four.txt]
229231
set marked [string match "*BEGIN MERGE CONFLICT*END MERGE CONFLICT*" $four]
230232
--- test/merge5.test
+++ test/merge5.test
@@ -19,16 +19,17 @@
19 #
20
21 # Verify the results of a check-out
22 #
23 proc checkout-test {testid expected_content} {
 
24 set flist {}
25 foreach {status filename} [exec $::fossilexe ls -l] {
 
26 if {$status!="DELETED"} {lappend flist $filename}
27 }
28 eval fossil sha1sum [lsort $flist]
29 global RESULT
30 regsub -all {\n *} [string trim $expected_content] "\n " expected
31 regsub -all {\n *} [string trim $RESULT] "\n " result
32 if {$result!=$expected} {
33 protOut " Expected:\n $expected"
34 protOut " Got:\n $result"
@@ -40,15 +41,15 @@
40
41 require_no_open_checkout; test_setup ""
42
43 # Construct a test repository
44 #
45 exec $::fossilexe sqlite3 --no-repository m5.fossil \
46 <$testfiledir/${testfile}_repo.sql
47 # The SQL is a dump of a repository from 2010, whose config table has no
48 # mtime column, and "fossil rebuild" writes to config.mtime.
49 exec $::fossilexe sqlite3 --no-repository m5.fossil \
50 "ALTER TABLE config ADD COLUMN mtime INTEGER;"
51 fossil rebuild m5.fossil
52 fossil open m5.fossil
53 fossil user default drh --user drh
54 fossil update baseline
@@ -219,11 +220,12 @@
219 proc conflict-test {testid} {
220 global RESULT
221 set reported [string match "*WARNING: 1 merge conflicts*" $RESULT]
222 test merge5-$testid-reported $reported
223 set flist {}
224 foreach {status filename} [exec $::fossilexe ls -l] {
 
225 if {$status!="DELETED"} {lappend flist $filename}
226 }
227 test merge5-$testid-files {[lsort $flist] eq "four.txt three.txt two.txt"}
228 set four [read_file four.txt]
229 set marked [string match "*BEGIN MERGE CONFLICT*END MERGE CONFLICT*" $four]
230
--- test/merge5.test
+++ test/merge5.test
@@ -19,16 +19,17 @@
19 #
20
21 # Verify the results of a check-out
22 #
23 proc checkout-test {testid expected_content} {
24 global RESULT
25 set flist {}
26 fossil ls -l
27 foreach {status filename} $RESULT {
28 if {$status!="DELETED"} {lappend flist $filename}
29 }
30 eval fossil sha1sum [lsort $flist]
 
31 regsub -all {\n *} [string trim $expected_content] "\n " expected
32 regsub -all {\n *} [string trim $RESULT] "\n " result
33 if {$result!=$expected} {
34 protOut " Expected:\n $expected"
35 protOut " Got:\n $result"
@@ -40,15 +41,15 @@
41
42 require_no_open_checkout; test_setup ""
43
44 # Construct a test repository
45 #
46 fossil_raw -input [read_file $testfiledir/${testfile}_repo.sql] \
47 sqlite3 --no-repository m5.fossil
48 # The SQL is a dump of a repository from 2010, whose config table has no
49 # mtime column, and "fossil rebuild" writes to config.mtime.
50 fossil_raw sqlite3 --no-repository m5.fossil \
51 "ALTER TABLE config ADD COLUMN mtime INTEGER;"
52 fossil rebuild m5.fossil
53 fossil open m5.fossil
54 fossil user default drh --user drh
55 fossil update baseline
@@ -219,11 +220,12 @@
220 proc conflict-test {testid} {
221 global RESULT
222 set reported [string match "*WARNING: 1 merge conflicts*" $RESULT]
223 test merge5-$testid-reported $reported
224 set flist {}
225 fossil ls -l
226 foreach {status filename} $RESULT {
227 if {$status!="DELETED"} {lappend flist $filename}
228 }
229 test merge5-$testid-files {[lsort $flist] eq "four.txt three.txt two.txt"}
230 set four [read_file four.txt]
231 set marked [string match "*BEGIN MERGE CONFLICT*END MERGE CONFLICT*" $four]
232
--- test/merge_exe.test
+++ test/merge_exe.test
@@ -30,11 +30,12 @@
3030
# WARNING: This is a hack for setting and testing a file's execute bit
3131
# on Windows. Never operate directly on Fossil database files like this
3232
# unless you really need to and really know what you're doing.
3333
3434
proc query {sql} {
35
- return [exec $::fossilexe sqlite3 --no-repository _FOSSIL_ $sql]
35
+ fossil_raw sqlite3 --no-repository _FOSSIL_ $sql
36
+ return [string trim $::RESULT]
3637
}
3738
3839
proc setx {fn isexe} {
3940
set isexe [expr {bool($isexe)}]
4041
query "UPDATE vfile SET isexe=$isexe WHERE pathname='$fn'"
4142
--- test/merge_exe.test
+++ test/merge_exe.test
@@ -30,11 +30,12 @@
30 # WARNING: This is a hack for setting and testing a file's execute bit
31 # on Windows. Never operate directly on Fossil database files like this
32 # unless you really need to and really know what you're doing.
33
34 proc query {sql} {
35 return [exec $::fossilexe sqlite3 --no-repository _FOSSIL_ $sql]
 
36 }
37
38 proc setx {fn isexe} {
39 set isexe [expr {bool($isexe)}]
40 query "UPDATE vfile SET isexe=$isexe WHERE pathname='$fn'"
41
--- test/merge_exe.test
+++ test/merge_exe.test
@@ -30,11 +30,12 @@
30 # WARNING: This is a hack for setting and testing a file's execute bit
31 # on Windows. Never operate directly on Fossil database files like this
32 # unless you really need to and really know what you're doing.
33
34 proc query {sql} {
35 fossil_raw sqlite3 --no-repository _FOSSIL_ $sql
36 return [string trim $::RESULT]
37 }
38
39 proc setx {fn isexe} {
40 set isexe [expr {bool($isexe)}]
41 query "UPDATE vfile SET isexe=$isexe WHERE pathname='$fn'"
42

Keyboard Shortcuts

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