Fossil SCM

Change merge2.test to do 3-way-merge on generated input rather than whatever is under test/. Runs thousands fewer tests with same gcov coverage. Fix 2/2 of speeding up test suite 3x.

danshearer 2026-11-20 10:22 UTC test-suite-new
Commit 6862ed1333dc1c3bb4f06f2b43e82161d10afe24bb705381def095a8c15794ad
1 file changed +22 -7
+22 -7
--- test/merge2.test
+++ test/merge2.test
@@ -13,21 +13,36 @@
1313
# [email protected]
1414
# http://www.hwaci.com/drh/
1515
#
1616
############################################################################
1717
#
18
-# Tests of the delta mechanism.
18
+# Tests of the "3-way-merge" command on generated text of several
19
+# kinds: ASCII text, a large file, long lines, CR/LF line endings,
20
+# UTF-8 text in Greek, in Chinese and in four-byte characters, a file
21
+# of four lines and a line that has no newline.
1922
#
2023
2124
test_setup ""
2225
23
-set filelist [lsort [glob $testdir/*]]
24
-foreach f $filelist {
25
- if {[file isdir $f]} continue
26
- set base [file root [file tail $f]]
27
- if {[string match "utf16*" $base]} continue
28
- set f1 [read_file $f]
26
+set fourbyte {}
27
+for {set i 0} {$i<40} {incr i} {
28
+ set char [binary format H6c f0a080 [expr {0x80+$i}]]
29
+ append fourbyte [string repeat $char [expr {$i%7+3}]]\n
30
+}
31
+set inputs [list \
32
+ ascii [fixed_word_lines 400] \
33
+ large [fixed_word_lines 5000] \
34
+ longlines [fixed_word_lines 60 97 150] \
35
+ crlf [string map [list \n \r\n] [fixed_word_lines 100]] \
36
+ repeats [fixed_word_lines 4000 97 1 1] \
37
+ utf8 [encoding convertto utf-8 [fixed_word_lines 200 0x3b1]] \
38
+ cjk [encoding convertto utf-8 [fixed_word_lines 200 0x4e00]] \
39
+ fourbyte $fourbyte \
40
+ short [fixed_word_lines 4] \
41
+ oneline "one line that has no newline" \
42
+]
43
+foreach {base f1} $inputs {
2944
write_file t1 $f1
3045
for {set i 0} {$i<100} {incr i} {
3146
expr {srand($i*2)}
3247
write_file t2 [set f2 [random_changes $f1 2 4 0 0.1]]
3348
expr {srand($i*2+1)}
3449
--- test/merge2.test
+++ test/merge2.test
@@ -13,21 +13,36 @@
13 # [email protected]
14 # http://www.hwaci.com/drh/
15 #
16 ############################################################################
17 #
18 # Tests of the delta mechanism.
 
 
 
19 #
20
21 test_setup ""
22
23 set filelist [lsort [glob $testdir/*]]
24 foreach f $filelist {
25 if {[file isdir $f]} continue
26 set base [file root [file tail $f]]
27 if {[string match "utf16*" $base]} continue
28 set f1 [read_file $f]
 
 
 
 
 
 
 
 
 
 
 
 
29 write_file t1 $f1
30 for {set i 0} {$i<100} {incr i} {
31 expr {srand($i*2)}
32 write_file t2 [set f2 [random_changes $f1 2 4 0 0.1]]
33 expr {srand($i*2+1)}
34
--- test/merge2.test
+++ test/merge2.test
@@ -13,21 +13,36 @@
13 # [email protected]
14 # http://www.hwaci.com/drh/
15 #
16 ############################################################################
17 #
18 # Tests of the "3-way-merge" command on generated text of several
19 # kinds: ASCII text, a large file, long lines, CR/LF line endings,
20 # UTF-8 text in Greek, in Chinese and in four-byte characters, a file
21 # of four lines and a line that has no newline.
22 #
23
24 test_setup ""
25
26 set fourbyte {}
27 for {set i 0} {$i<40} {incr i} {
28 set char [binary format H6c f0a080 [expr {0x80+$i}]]
29 append fourbyte [string repeat $char [expr {$i%7+3}]]\n
30 }
31 set inputs [list \
32 ascii [fixed_word_lines 400] \
33 large [fixed_word_lines 5000] \
34 longlines [fixed_word_lines 60 97 150] \
35 crlf [string map [list \n \r\n] [fixed_word_lines 100]] \
36 repeats [fixed_word_lines 4000 97 1 1] \
37 utf8 [encoding convertto utf-8 [fixed_word_lines 200 0x3b1]] \
38 cjk [encoding convertto utf-8 [fixed_word_lines 200 0x4e00]] \
39 fourbyte $fourbyte \
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

Keyboard Shortcuts

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