Fossil SCM

Replaced the hard-coded 100-iteration test loops with a -trials flag defaulting to 20, to allow restoration of the old count for a longer (i.e. overnight/CI) stress test. This alone cuts over 1 minute from the `make test` time here.

wyoung 2026-11-20 16:24 UTC test-suite-new
Commit 36c9bd5926d4cace632483812c6c8167cdd0a8a6bfd035ff2439f6af8b3fcd7c
--- test/README.md
+++ test/README.md
@@ -28,10 +28,13 @@
2828
* `-verbose` prints the output of every `fossil` command.
2929
* `-strict` counts the failure of a known bug as a failure.
3030
* `-halt` stops at the first failure.
3131
* `-keep` leaves the temporary repositories in place.
3232
* `-prot` also writes the output to the file `prot`.
33
+* `-trials N` sets how many random trials fuzz tests (delta1, merge2, …)
34
+ run per input kind. The default is 20 (5 for expensive `large` /
35
+ `repeats` inputs). Use `-trials 100` for the historical full fuzz.
3336
3437
`make test TESTFLAGS="-quiet update"` passes options and names via `make`.
3538
3639
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
3740
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
3841
--- test/README.md
+++ test/README.md
@@ -28,10 +28,13 @@
28 * `-verbose` prints the output of every `fossil` command.
29 * `-strict` counts the failure of a known bug as a failure.
30 * `-halt` stops at the first failure.
31 * `-keep` leaves the temporary repositories in place.
32 * `-prot` also writes the output to the file `prot`.
 
 
 
33
34 `make test TESTFLAGS="-quiet update"` passes options and names via `make`.
35
36 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
37 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
38
--- test/README.md
+++ test/README.md
@@ -28,10 +28,13 @@
28 * `-verbose` prints the output of every `fossil` command.
29 * `-strict` counts the failure of a known bug as a failure.
30 * `-halt` stops at the first failure.
31 * `-keep` leaves the temporary repositories in place.
32 * `-prot` also writes the output to the file `prot`.
33 * `-trials N` sets how many random trials fuzz tests (delta1, merge2, …)
34 run per input kind. The default is 20 (5 for expensive `large` /
35 `repeats` inputs). Use `-trials 100` for the historical full fuzz.
36
37 `make test TESTFLAGS="-quiet update"` passes options and names via `make`.
38
39 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
40 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
41
--- test/delta1.test
+++ test/delta1.test
@@ -51,11 +51,13 @@
5151
short [fixed_word_lines 4] \
5252
oneline "one line that has no newline" \
5353
]
5454
foreach {base f1} $inputs {
5555
write_file t1 $f1
56
- for {set i 0} {$i<100} {incr i} {
56
+ set ntrials [test_trials \
57
+ [expr {$base eq "large" || $base eq "repeats"}]]
58
+ for {set i 0} {$i<$ntrials} {incr i} {
5759
write_file t2 [random_changes $f1 1 1 0 0.1]
5860
fossil test-delta t1 t2
5961
test delta-$base-$i-1 {[normalize_result]=="ok"}
6062
write_file t2 [random_changes $f1 1 1 0 0.2]
6163
fossil test-delta t1 t2
6264
--- test/delta1.test
+++ test/delta1.test
@@ -51,11 +51,13 @@
51 short [fixed_word_lines 4] \
52 oneline "one line that has no newline" \
53 ]
54 foreach {base f1} $inputs {
55 write_file t1 $f1
56 for {set i 0} {$i<100} {incr i} {
 
 
57 write_file t2 [random_changes $f1 1 1 0 0.1]
58 fossil test-delta t1 t2
59 test delta-$base-$i-1 {[normalize_result]=="ok"}
60 write_file t2 [random_changes $f1 1 1 0 0.2]
61 fossil test-delta t1 t2
62
--- test/delta1.test
+++ test/delta1.test
@@ -51,11 +51,13 @@
51 short [fixed_word_lines 4] \
52 oneline "one line that has no newline" \
53 ]
54 foreach {base f1} $inputs {
55 write_file t1 $f1
56 set ntrials [test_trials \
57 [expr {$base eq "large" || $base eq "repeats"}]]
58 for {set i 0} {$i<$ntrials} {incr i} {
59 write_file t2 [random_changes $f1 1 1 0 0.1]
60 fossil test-delta t1 t2
61 test delta-$base-$i-1 {[normalize_result]=="ok"}
62 write_file t2 [random_changes $f1 1 1 0 0.2]
63 fossil test-delta t1 t2
64
--- test/merge2.test
+++ test/merge2.test
@@ -40,11 +40,13 @@
4040
short [fixed_word_lines 4] \
4141
oneline "one line that has no newline" \
4242
]
4343
foreach {base f1} $inputs {
4444
write_file t1 $f1
45
- for {set i 0} {$i<100} {incr i} {
45
+ set ntrials [test_trials \
46
+ [expr {$base eq "large" || $base eq "repeats"}]]
47
+ for {set i 0} {$i<$ntrials} {incr i} {
4648
expr {srand($i*2)}
4749
write_file t2 [set f2 [random_changes $f1 2 4 0 0.1]]
4850
expr {srand($i*2+1)}
4951
write_file t3 [set f3 [random_changes $f1 2 4 2 0.1]]
5052
expr {srand($i*2+1)}
5153
--- test/merge2.test
+++ test/merge2.test
@@ -40,11 +40,13 @@
40 short [fixed_word_lines 4] \
41 oneline "one line that has no newline" \
42 ]
43 foreach {base f1} $inputs {
44 write_file t1 $f1
45 for {set i 0} {$i<100} {incr i} {
 
 
46 expr {srand($i*2)}
47 write_file t2 [set f2 [random_changes $f1 2 4 0 0.1]]
48 expr {srand($i*2+1)}
49 write_file t3 [set f3 [random_changes $f1 2 4 2 0.1]]
50 expr {srand($i*2+1)}
51
--- test/merge2.test
+++ test/merge2.test
@@ -40,11 +40,13 @@
40 short [fixed_word_lines 4] \
41 oneline "one line that has no newline" \
42 ]
43 foreach {base f1} $inputs {
44 write_file t1 $f1
45 set ntrials [test_trials \
46 [expr {$base eq "large" || $base eq "repeats"}]]
47 for {set i 0} {$i<$ntrials} {incr i} {
48 expr {srand($i*2)}
49 write_file t2 [set f2 [random_changes $f1 2 4 0 0.1]]
50 expr {srand($i*2+1)}
51 write_file t3 [set f3 [random_changes $f1 2 4 2 0.1]]
52 expr {srand($i*2+1)}
53
+31 -1
--- test/tester.tcl
+++ test/tester.tcl
@@ -21,11 +21,11 @@
2121
# tclsh ../test/tester.tcl ./fossil
2222
# tclsh ../test/tester.tcl ./fossil -quiet merge1 update
2323
#
2424
# The first argument is the fossil executable to test, followed by
2525
# the test files, so "update" runs test/update.test. See test/README.md
26
-# for details of options such as -strict, -halt, -prot etc.
26
+# for details of options such as -strict, -halt, -prot, -trials etc.
2727
#
2828
2929
# Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl
3030
# installation. Care is needed to keep compatible with both 8.6 and 9.0.
3131
package require Tcl 8.6-
@@ -68,10 +68,30 @@
6868
set [string toupper $option] [expr {$i >= 0}]
6969
if {$i >= 0} {
7070
set argv [lreplace $argv $i $i]
7171
}
7272
}
73
+
74
+# Default random-trial count for fuzz loops (delta1, merge2, …). Override
75
+# with -trials N. When the flag is omitted, expensive inputs ("large",
76
+# "repeats") use fewer trials; an explicit -trials applies to all inputs.
77
+set TRIALS 20
78
+set TRIALS_EXPLICIT 0
79
+set i [lsearch -exact $argv -trials]
80
+if {$i >= 0} {
81
+ if {$i + 1 >= [llength $argv]} {
82
+ puts stderr "missing value for -trials"
83
+ exit 1
84
+ }
85
+ set TRIALS [lindex $argv [expr {$i + 1}]]
86
+ if {![string is integer -strict $TRIALS] || $TRIALS < 1} {
87
+ puts stderr "-trials requires a positive integer"
88
+ exit 1
89
+ }
90
+ set TRIALS_EXPLICIT 1
91
+ set argv [lreplace $argv $i [expr {$i + 1}]]
92
+}
7393
7494
if {[llength $argv]==0} {
7595
foreach f [lsort [glob $testfiledir/*.test]] {
7696
set base [file root [file tail $f]]
7797
lappend argv $base
@@ -557,10 +577,20 @@
557577
exec $::fossilexe open $filename
558578
exec $::fossilexe set mtime-changes off
559579
}
560580
return $repoPath
561581
}
582
+
583
+# How many random trials to run in a fuzz loop. Pass a true $heavy for
584
+# expensive inputs such as "large" and "repeats": at the default -trials
585
+# scale those use 5 iterations; -trials N uses N for every input kind.
586
+proc test_trials {{heavy 0}} {
587
+ if {$heavy && !$::TRIALS_EXPLICIT} {
588
+ return [expr {min(5, $::TRIALS)}]
589
+ }
590
+ return $::TRIALS
591
+}
562592
563593
# This procedure only returns non-zero if the Tcl integration feature was
564594
# enabled at compile-time and is now enabled at runtime.
565595
proc is_tcl_usable_by_fossil {} {
566596
fossil test-th-eval "hasfeature tcl"
567597
--- test/tester.tcl
+++ test/tester.tcl
@@ -21,11 +21,11 @@
21 # tclsh ../test/tester.tcl ./fossil
22 # tclsh ../test/tester.tcl ./fossil -quiet merge1 update
23 #
24 # The first argument is the fossil executable to test, followed by
25 # the test files, so "update" runs test/update.test. See test/README.md
26 # for details of options such as -strict, -halt, -prot etc.
27 #
28
29 # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl
30 # installation. Care is needed to keep compatible with both 8.6 and 9.0.
31 package require Tcl 8.6-
@@ -68,10 +68,30 @@
68 set [string toupper $option] [expr {$i >= 0}]
69 if {$i >= 0} {
70 set argv [lreplace $argv $i $i]
71 }
72 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
74 if {[llength $argv]==0} {
75 foreach f [lsort [glob $testfiledir/*.test]] {
76 set base [file root [file tail $f]]
77 lappend argv $base
@@ -557,10 +577,20 @@
557 exec $::fossilexe open $filename
558 exec $::fossilexe set mtime-changes off
559 }
560 return $repoPath
561 }
 
 
 
 
 
 
 
 
 
 
562
563 # This procedure only returns non-zero if the Tcl integration feature was
564 # enabled at compile-time and is now enabled at runtime.
565 proc is_tcl_usable_by_fossil {} {
566 fossil test-th-eval "hasfeature tcl"
567
--- test/tester.tcl
+++ test/tester.tcl
@@ -21,11 +21,11 @@
21 # tclsh ../test/tester.tcl ./fossil
22 # tclsh ../test/tester.tcl ./fossil -quiet merge1 update
23 #
24 # The first argument is the fossil executable to test, followed by
25 # the test files, so "update" runs test/update.test. See test/README.md
26 # for details of options such as -strict, -halt, -prot, -trials etc.
27 #
28
29 # Minimum Tcl is 8.6. auto.def should have found us a suitable Tcl
30 # installation. Care is needed to keep compatible with both 8.6 and 9.0.
31 package require Tcl 8.6-
@@ -68,10 +68,30 @@
68 set [string toupper $option] [expr {$i >= 0}]
69 if {$i >= 0} {
70 set argv [lreplace $argv $i $i]
71 }
72 }
73
74 # Default random-trial count for fuzz loops (delta1, merge2, …). Override
75 # with -trials N. When the flag is omitted, expensive inputs ("large",
76 # "repeats") use fewer trials; an explicit -trials applies to all inputs.
77 set TRIALS 20
78 set TRIALS_EXPLICIT 0
79 set i [lsearch -exact $argv -trials]
80 if {$i >= 0} {
81 if {$i + 1 >= [llength $argv]} {
82 puts stderr "missing value for -trials"
83 exit 1
84 }
85 set TRIALS [lindex $argv [expr {$i + 1}]]
86 if {![string is integer -strict $TRIALS] || $TRIALS < 1} {
87 puts stderr "-trials requires a positive integer"
88 exit 1
89 }
90 set TRIALS_EXPLICIT 1
91 set argv [lreplace $argv $i [expr {$i + 1}]]
92 }
93
94 if {[llength $argv]==0} {
95 foreach f [lsort [glob $testfiledir/*.test]] {
96 set base [file root [file tail $f]]
97 lappend argv $base
@@ -557,10 +577,20 @@
577 exec $::fossilexe open $filename
578 exec $::fossilexe set mtime-changes off
579 }
580 return $repoPath
581 }
582
583 # How many random trials to run in a fuzz loop. Pass a true $heavy for
584 # expensive inputs such as "large" and "repeats": at the default -trials
585 # scale those use 5 iterations; -trials N uses N for every input kind.
586 proc test_trials {{heavy 0}} {
587 if {$heavy && !$::TRIALS_EXPLICIT} {
588 return [expr {min(5, $::TRIALS)}]
589 }
590 return $::TRIALS
591 }
592
593 # This procedure only returns non-zero if the Tcl integration feature was
594 # enabled at compile-time and is now enabled at runtime.
595 proc is_tcl_usable_by_fossil {} {
596 fossil test-th-eval "hasfeature tcl"
597

Keyboard Shortcuts

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