Fossil SCM

More work...

mistachkin 2016-03-02 06:45 testerCleanup
Commit 29f0328cd9954ee4ea3691dfc4ee0cd3495193b5
--- test/amend.test
+++ test/amend.test
@@ -401,5 +401,9 @@
401401
########################################
402402
# Test: NULL UUID #
403403
########################################
404404
fossil amend {} -close -expectError
405405
test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
406
+
407
+###############################################################################
408
+
409
+test_cleanup
406410
--- test/amend.test
+++ test/amend.test
@@ -401,5 +401,9 @@
401 ########################################
402 # Test: NULL UUID #
403 ########################################
404 fossil amend {} -close -expectError
405 test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
 
 
 
 
406
--- test/amend.test
+++ test/amend.test
@@ -401,5 +401,9 @@
401 ########################################
402 # Test: NULL UUID #
403 ########################################
404 fossil amend {} -close -expectError
405 test amend-null-uuid {$CODE && [string first "no such check-in" $RESULT] != -1}
406
407 ###############################################################################
408
409 test_cleanup
410
--- test/clean.test
+++ test/clean.test
@@ -185,5 +185,9 @@
185185
186186
###############################################################################
187187
188188
fossil extra
189189
test clean-31 {[normalize_result] eq {}}
190
+
191
+###############################################################################
192
+
193
+test_cleanup
190194
--- test/clean.test
+++ test/clean.test
@@ -185,5 +185,9 @@
185
186 ###############################################################################
187
188 fossil extra
189 test clean-31 {[normalize_result] eq {}}
 
 
 
 
190
--- test/clean.test
+++ test/clean.test
@@ -185,5 +185,9 @@
185
186 ###############################################################################
187
188 fossil extra
189 test clean-31 {[normalize_result] eq {}}
190
191 ###############################################################################
192
193 test_cleanup
194
--- test/cmdline.test
+++ test/cmdline.test
@@ -26,5 +26,9 @@
2626
incr i
2727
}
2828
}
2929
cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
3030
cmd-line 101 * * *.* *.*
31
+
32
+###############################################################################
33
+
34
+test_cleanup
3135
--- test/cmdline.test
+++ test/cmdline.test
@@ -26,5 +26,9 @@
26 incr i
27 }
28 }
29 cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
30 cmd-line 101 * * *.* *.*
 
 
 
 
31
--- test/cmdline.test
+++ test/cmdline.test
@@ -26,5 +26,9 @@
26 incr i
27 }
28 }
29 cmd-line 100 abc abc a\"bc a\"bc \"abc\" \"abc\"
30 cmd-line 101 * * *.* *.*
31
32 ###############################################################################
33
34 test_cleanup
35
--- test/comment.test
+++ test/comment.test
@@ -314,5 +314,9 @@
314314
315315
###############################################################################
316316
317317
fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
318318
test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
319
+
320
+###############################################################################
321
+
322
+test_cleanup
319323
--- test/comment.test
+++ test/comment.test
@@ -314,5 +314,9 @@
314
315 ###############################################################################
316
317 fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
318 test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
 
 
 
 
319
--- test/comment.test
+++ test/comment.test
@@ -314,5 +314,9 @@
314
315 ###############################################################################
316
317 fossil test-comment-format --width 81 --indent 9 --decode --trimcrlf --origbreak "00:00:00 " "\[0000000000\] *CURRENT* $orig" $orig
318 test comment-60 {$RESULT eq "00:00:00 \[0000000000\] *CURRENT* \n xxxx xx xxxxxxx xxxx xxxxxx xxxxxxx, xxxxxxx, x xxxx xxxxxx xx xxxx xxxx\n xxxxxxx xxxxx xxxx xxxx xx xxxxxxx xxxxxxx (xxxxxx xxxxxxxxx x xxxxx).\n xxx'x xxx xxx xx xxxxx xxxx xxx xxx --xxxxxxxxxxx xxxxxx xx xx xxxx. x\n xxxxx x xxxxxx xxxx xxxx xxxx xxxx xxxx x xxxxx xx xxx x xxxxxxxx\n xxxxxxx.\n(6 lines output)"}
319
320 ###############################################################################
321
322 test_cleanup
323
--- test/contains-selector.test
+++ test/contains-selector.test
@@ -45,5 +45,9 @@
4545
.d 0
4646
{.c.d} 0
4747
{.c .d} 1
4848
.e 1
4949
}
50
+
51
+###############################################################################
52
+
53
+test_cleanup
5054
--- test/contains-selector.test
+++ test/contains-selector.test
@@ -45,5 +45,9 @@
45 .d 0
46 {.c.d} 0
47 {.c .d} 1
48 .e 1
49 }
 
 
 
 
50
--- test/contains-selector.test
+++ test/contains-selector.test
@@ -45,5 +45,9 @@
45 .d 0
46 {.c.d} 0
47 {.c .d} 1
48 .e 1
49 }
50
51 ###############################################################################
52
53 test_cleanup
54
--- test/delta1.test
+++ test/delta1.test
@@ -41,5 +41,9 @@
4141
write_file t2 [random_changes $f1 1 1 0 0.4]
4242
fossil test-delta t1 t2
4343
test delta-$base-$i-3 {$RESULT=="ok"}
4444
}
4545
}
46
+
47
+###############################################################################
48
+
49
+test_cleanup
4650
--- test/delta1.test
+++ test/delta1.test
@@ -41,5 +41,9 @@
41 write_file t2 [random_changes $f1 1 1 0 0.4]
42 fossil test-delta t1 t2
43 test delta-$base-$i-3 {$RESULT=="ok"}
44 }
45 }
 
 
 
 
46
--- test/delta1.test
+++ test/delta1.test
@@ -41,5 +41,9 @@
41 write_file t2 [random_changes $f1 1 1 0 0.4]
42 fossil test-delta t1 t2
43 test delta-$base-$i-3 {$RESULT=="ok"}
44 }
45 }
46
47 ###############################################################################
48
49 test_cleanup
50
--- test/file1.test
+++ test/file1.test
@@ -96,5 +96,9 @@
9696
9797
catch {file delete test1/test2}
9898
catch {file delete test1}
9999
100100
if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd}
101
+
102
+###############################################################################
103
+
104
+test_cleanup
101105
--- test/file1.test
+++ test/file1.test
@@ -96,5 +96,9 @@
96
97 catch {file delete test1/test2}
98 catch {file delete test1}
99
100 if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd}
 
 
 
 
101
--- test/file1.test
+++ test/file1.test
@@ -96,5 +96,9 @@
96
97 catch {file delete test1/test2}
98 catch {file delete test1}
99
100 if {[info exists savedPwd]} {cd $savedPwd; unset savedPwd}
101
102 ###############################################################################
103
104 test_cleanup
105
--- test/glob.test
+++ test/glob.test
@@ -180,5 +180,9 @@
180180
glob-parse 119 "'o*,two three,four'" "one,two three,four" \
181181
[string map [list \r\n \n] \
182182
{SQL expression: (x GLOB 'o*,two three,four')
183183
pattern[0] = [o*,two three,four]
184184
1 one,two three,four}]
185
+
186
+###############################################################################
187
+
188
+test_cleanup
185189
--- test/glob.test
+++ test/glob.test
@@ -180,5 +180,9 @@
180 glob-parse 119 "'o*,two three,four'" "one,two three,four" \
181 [string map [list \r\n \n] \
182 {SQL expression: (x GLOB 'o*,two three,four')
183 pattern[0] = [o*,two three,four]
184 1 one,two three,four}]
 
 
 
 
185
--- test/glob.test
+++ test/glob.test
@@ -180,5 +180,9 @@
180 glob-parse 119 "'o*,two three,four'" "one,two three,four" \
181 [string map [list \r\n \n] \
182 {SQL expression: (x GLOB 'o*,two three,four')
183 pattern[0] = [o*,two three,four]
184 1 one,two three,four}]
185
186 ###############################################################################
187
188 test_cleanup
189
--- test/json.test
+++ test/json.test
@@ -845,5 +845,9 @@
845845
# Fossil repository db file is not valid.
846846
write_file nope.fossil {
847847
This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
848848
but it is actually just a block of text.
849849
}
850
+
851
+###############################################################################
852
+
853
+test_cleanup
850854
--- test/json.test
+++ test/json.test
@@ -845,5 +845,9 @@
845 # Fossil repository db file is not valid.
846 write_file nope.fossil {
847 This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
848 but it is actually just a block of text.
849 }
 
 
 
 
850
--- test/json.test
+++ test/json.test
@@ -845,5 +845,9 @@
845 # Fossil repository db file is not valid.
846 write_file nope.fossil {
847 This is not a fossil repo. It ought to be a SQLite db with a well-known schema,
848 but it is actually just a block of text.
849 }
850
851 ###############################################################################
852
853 test_cleanup
854
--- test/merge1.test
+++ test/merge1.test
@@ -398,5 +398,9 @@
398398
STUV
399399
XYZ.
400400
}
401401
fossil 3-way-merge t1 t2 t3 a23
402402
test merge1-7.2 {[same_file t23 a23]}
403
+
404
+###############################################################################
405
+
406
+test_cleanup
403407
--- test/merge1.test
+++ test/merge1.test
@@ -398,5 +398,9 @@
398 STUV
399 XYZ.
400 }
401 fossil 3-way-merge t1 t2 t3 a23
402 test merge1-7.2 {[same_file t23 a23]}
 
 
 
 
403
--- test/merge1.test
+++ test/merge1.test
@@ -398,5 +398,9 @@
398 STUV
399 XYZ.
400 }
401 fossil 3-way-merge t1 t2 t3 a23
402 test merge1-7.2 {[same_file t23 a23]}
403
404 ###############################################################################
405
406 test_cleanup
407
--- test/merge2.test
+++ test/merge2.test
@@ -38,5 +38,9 @@
3838
test merge-$base-$i-23 {[same_file a23 t23]}
3939
fossil 3-way-merge t1 t3 t2 a32
4040
test merge-$base-$i-32 {[same_file a32 t32]}
4141
}
4242
}
43
+
44
+###############################################################################
45
+
46
+test_cleanup
4347
--- test/merge2.test
+++ test/merge2.test
@@ -38,5 +38,9 @@
38 test merge-$base-$i-23 {[same_file a23 t23]}
39 fossil 3-way-merge t1 t3 t2 a32
40 test merge-$base-$i-32 {[same_file a32 t32]}
41 }
42 }
 
 
 
 
43
--- test/merge2.test
+++ test/merge2.test
@@ -38,5 +38,9 @@
38 test merge-$base-$i-23 {[same_file a23 t23]}
39 fossil 3-way-merge t1 t3 t2 a32
40 test merge-$base-$i-32 {[same_file a32 t32]}
41 }
42 }
43
44 ###############################################################################
45
46 test_cleanup
47
--- test/merge3.test
+++ test/merge3.test
@@ -633,5 +633,9 @@
633633
} {
634634
1 2 3 4 5 7 8 9b
635635
} {
636636
1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END
637637
}
638
+
639
+###############################################################################
640
+
641
+test_cleanup
638642
--- test/merge3.test
+++ test/merge3.test
@@ -633,5 +633,9 @@
633 } {
634 1 2 3 4 5 7 8 9b
635 } {
636 1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END
637 }
 
 
 
 
638
--- test/merge3.test
+++ test/merge3.test
@@ -633,5 +633,9 @@
633 } {
634 1 2 3 4 5 7 8 9b
635 } {
636 1 2 3 4 5 7 8 MINE: 9b a b c d e COM: 9 YOURS: 9b END
637 }
638
639 ###############################################################################
640
641 test_cleanup
642
--- test/merge4.test
+++ test/merge4.test
@@ -93,5 +93,9 @@
9393
} {
9494
2b 3b 4c 5c 6c 7b 8b
9595
} {
9696
2b 3b 4c 5c 6c 7b 8b
9797
}
98
+
99
+###############################################################################
100
+
101
+test_cleanup
98102
--- test/merge4.test
+++ test/merge4.test
@@ -93,5 +93,9 @@
93 } {
94 2b 3b 4c 5c 6c 7b 8b
95 } {
96 2b 3b 4c 5c 6c 7b 8b
97 }
 
 
 
 
98
--- test/merge4.test
+++ test/merge4.test
@@ -93,5 +93,9 @@
93 } {
94 2b 3b 4c 5c 6c 7b 8b
95 } {
96 2b 3b 4c 5c 6c 7b 8b
97 }
98
99 ###############################################################################
100
101 test_cleanup
102
--- test/merge5.test
+++ test/merge5.test
@@ -301,5 +301,9 @@
301301
checkout-test 142 {
302302
7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt
303303
98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
304304
e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
305305
}
306
+
307
+###############################################################################
308
+
309
+test_cleanup
306310
--- test/merge5.test
+++ test/merge5.test
@@ -301,5 +301,9 @@
301 checkout-test 142 {
302 7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt
303 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
304 e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
305 }
 
 
 
 
306
--- test/merge5.test
+++ test/merge5.test
@@ -301,5 +301,9 @@
301 checkout-test 142 {
302 7eaf64a2c9141277b4c24259c7766d6a77047af7 one.txt
303 98e47f99bb9fed4fdcd407f553615ca7f15a38a2 three.txt
304 e58c5da3e6007d0e30600ea31611813093ad180f two-rename.txt
305 }
306
307 ###############################################################################
308
309 test_cleanup
310
--- test/merge6.test
+++ test/merge6.test
@@ -63,5 +63,9 @@
6363
6464
test merge_multi-4 {[normalize_result] eq {f1
6565
f2
6666
f3
6767
f4}} knownBug
68
+
69
+###############################################################################
70
+
71
+test_cleanup
6872
--- test/merge6.test
+++ test/merge6.test
@@ -63,5 +63,9 @@
63
64 test merge_multi-4 {[normalize_result] eq {f1
65 f2
66 f3
67 f4}} knownBug
 
 
 
 
68
--- test/merge6.test
+++ test/merge6.test
@@ -63,5 +63,9 @@
63
64 test merge_multi-4 {[normalize_result] eq {f1
65 f2
66 f3
67 f4}} knownBug
68
69 ###############################################################################
70
71 test_cleanup
72
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -203,5 +203,9 @@
203203
# Tests for troubles not specifically linked with renames but that I'd like to
204204
# write:
205205
# [c26c63eb1b] - 'merge --backout' does not handle conflicts properly
206206
# [953031915f] - Lack of warning when overwriting extra files
207207
# [4df5f38f1e] - Troubles merging a file delete with a file change
208
+
209
+###############################################################################
210
+
211
+test_cleanup
208212
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -203,5 +203,9 @@
203 # Tests for troubles not specifically linked with renames but that I'd like to
204 # write:
205 # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly
206 # [953031915f] - Lack of warning when overwriting extra files
207 # [4df5f38f1e] - Troubles merging a file delete with a file change
 
 
 
 
208
--- test/merge_renames.test
+++ test/merge_renames.test
@@ -203,5 +203,9 @@
203 # Tests for troubles not specifically linked with renames but that I'd like to
204 # write:
205 # [c26c63eb1b] - 'merge --backout' does not handle conflicts properly
206 # [953031915f] - Lack of warning when overwriting extra files
207 # [4df5f38f1e] - Troubles merging a file delete with a file change
208
209 ###############################################################################
210
211 test_cleanup
212
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -383,5 +383,9 @@
383383
test rm-hard-absolute-6 {
384384
[normalize_result] eq "REVERT f8${undoMsg}"
385385
}
386386
387387
cd $rootDir
388
+
389
+###############################################################################
390
+
391
+test_cleanup
388392
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -383,5 +383,9 @@
383 test rm-hard-absolute-6 {
384 [normalize_result] eq "REVERT f8${undoMsg}"
385 }
386
387 cd $rootDir
 
 
 
 
388
--- test/mv-rm.test
+++ test/mv-rm.test
@@ -383,5 +383,9 @@
383 test rm-hard-absolute-6 {
384 [normalize_result] eq "REVERT f8${undoMsg}"
385 }
386
387 cd $rootDir
388
389 ###############################################################################
390
391 test_cleanup
392
--- test/revert.test
+++ test/revert.test
@@ -186,5 +186,9 @@
186186
test 3-mv-2 {![file exists f1new]}
187187
revert-test 3-1 {} {
188188
REVERT f1
189189
DELETE f1new
190190
} -exists {f1} -notexists {f1n}
191
+
192
+###############################################################################
193
+
194
+test_cleanup
191195
--- test/revert.test
+++ test/revert.test
@@ -186,5 +186,9 @@
186 test 3-mv-2 {![file exists f1new]}
187 revert-test 3-1 {} {
188 REVERT f1
189 DELETE f1new
190 } -exists {f1} -notexists {f1n}
 
 
 
 
191
--- test/revert.test
+++ test/revert.test
@@ -186,5 +186,9 @@
186 test 3-mv-2 {![file exists f1new]}
187 revert-test 3-1 {} {
188 REVERT f1
189 DELETE f1new
190 } -exists {f1} -notexists {f1n}
191
192 ###############################################################################
193
194 test_cleanup
195
--- test/stash.test
+++ test/stash.test
@@ -389,5 +389,9 @@
389389
# fossil stash goto ?STASHID?
390390
# fossil stash rm|drop ?STASHID? ?-a|--all?
391391
392392
#fossil checkout --force c1
393393
#fossil clean
394
+
395
+###############################################################################
396
+
397
+test_cleanup
394398
--- test/stash.test
+++ test/stash.test
@@ -389,5 +389,9 @@
389 # fossil stash goto ?STASHID?
390 # fossil stash rm|drop ?STASHID? ?-a|--all?
391
392 #fossil checkout --force c1
393 #fossil clean
 
 
 
 
394
--- test/stash.test
+++ test/stash.test
@@ -389,5 +389,9 @@
389 # fossil stash goto ?STASHID?
390 # fossil stash rm|drop ?STASHID? ?-a|--all?
391
392 #fossil checkout --force c1
393 #fossil clean
394
395 ###############################################################################
396
397 test_cleanup
398
+34 -10
--- test/tester.tcl
+++ test/tester.tcl
@@ -202,10 +202,33 @@
202202
set localRoot [string trim $localRoot]
203203
error "Detected an open checkout of project \"$projectName\",\
204204
rooted at \"$localRoot\", testing halted"
205205
}
206206
}
207
+
208
+proc get_script_or_fail {} {
209
+ set fileName [file normalize [info script]]
210
+ if {[string length $fileName] == 0 || ![file exists $fileName]} {
211
+ error "Failed to obtain the file name of the test being run."
212
+ }
213
+ return $fileName
214
+}
215
+
216
+proc test_cleanup {} {
217
+ if {![info exists ::tempRepoPath]} {return}
218
+ if {![file exists $::tempRepoPath]} {return}
219
+ if {![file isdirectory $::tempRepoPath]} {return}
220
+ set tempPathEnd [expr {[string length $::tempPath] - 1}]
221
+ if {[string length $::tempPath] == 0 || \
222
+ [string range $::tempRepoPath 0 $tempPathEnd] ne $::tempPath} {
223
+ error "Temporary repository path has wrong parent during cleanup."
224
+ }
225
+ catch {file delete -force $::tempRepoPath}
226
+ if {[info exists ::tempSavedPwd]} {
227
+ cd $::tempSavedPwd; unset ::tempSavedPwd
228
+ }
229
+}
207230
208231
proc is_home_elsewhere {} {
209232
return [expr {[info exists ::env(FOSSIL_HOME)] && \
210233
$::env(FOSSIL_HOME) eq $::tempHomePath}]
211234
}
@@ -213,30 +236,31 @@
213236
proc set_home_to_elsewhere {} {
214237
#
215238
# Fossil will write data on $HOME (or $FOSSIL_HOME). We need not
216239
# to clutter the real $HOME (or $FOSSIL_HOME) of the test caller.
217240
#
218
- if {[is_home_elsewhere]} {
219
- protOut "***** FOSSIL_HOME is already elsewhere"
220
- return
221
- }
241
+ if {[is_home_elsewhere]} {return}
222242
set ::env(FOSSIL_HOME) $::tempHomePath
223243
}
224244
225245
#
226246
# Create and open a new Fossil repository and clean the checkout
227247
#
228248
proc repo_init {{filename ".rep.fossil"}} {
229
- if {![is_home_elsewhere]} {
230
- require_no_open_checkout
231
- set_home_to_elsewhere
249
+ set_home_to_elsewhere
250
+ set ::tempRepoPath [file join \
251
+ $tempPath repo_[pid] [string trim [clock seconds] -] \
252
+ [file tail [get_script_or_fail]]]
253
+ if {[catch {
254
+ file mkdir $::tempRepoPath
255
+ } error] != 0} {
256
+ error "could not make directory \"$::tempRepoPath\",\
257
+please set TEMP variable in environment: $error"
232258
}
233
- catch {exec $::fossilexe close -f}
234
- file delete $filename
259
+ set ::tempSavedPwd [pwd]; cd $::tempRepoPath
235260
exec $::fossilexe new $filename
236261
exec $::fossilexe open $filename
237
- exec $::fossilexe clean -f
238262
exec $::fossilexe set mtime-changes off
239263
}
240264
241265
# This procedure only returns non-zero if the Tcl integration feature was
242266
# enabled at compile-time and is now enabled at runtime.
243267
--- test/tester.tcl
+++ test/tester.tcl
@@ -202,10 +202,33 @@
202 set localRoot [string trim $localRoot]
203 error "Detected an open checkout of project \"$projectName\",\
204 rooted at \"$localRoot\", testing halted"
205 }
206 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
208 proc is_home_elsewhere {} {
209 return [expr {[info exists ::env(FOSSIL_HOME)] && \
210 $::env(FOSSIL_HOME) eq $::tempHomePath}]
211 }
@@ -213,30 +236,31 @@
213 proc set_home_to_elsewhere {} {
214 #
215 # Fossil will write data on $HOME (or $FOSSIL_HOME). We need not
216 # to clutter the real $HOME (or $FOSSIL_HOME) of the test caller.
217 #
218 if {[is_home_elsewhere]} {
219 protOut "***** FOSSIL_HOME is already elsewhere"
220 return
221 }
222 set ::env(FOSSIL_HOME) $::tempHomePath
223 }
224
225 #
226 # Create and open a new Fossil repository and clean the checkout
227 #
228 proc repo_init {{filename ".rep.fossil"}} {
229 if {![is_home_elsewhere]} {
230 require_no_open_checkout
231 set_home_to_elsewhere
 
 
 
 
 
 
232 }
233 catch {exec $::fossilexe close -f}
234 file delete $filename
235 exec $::fossilexe new $filename
236 exec $::fossilexe open $filename
237 exec $::fossilexe clean -f
238 exec $::fossilexe set mtime-changes off
239 }
240
241 # This procedure only returns non-zero if the Tcl integration feature was
242 # enabled at compile-time and is now enabled at runtime.
243
--- test/tester.tcl
+++ test/tester.tcl
@@ -202,10 +202,33 @@
202 set localRoot [string trim $localRoot]
203 error "Detected an open checkout of project \"$projectName\",\
204 rooted at \"$localRoot\", testing halted"
205 }
206 }
207
208 proc get_script_or_fail {} {
209 set fileName [file normalize [info script]]
210 if {[string length $fileName] == 0 || ![file exists $fileName]} {
211 error "Failed to obtain the file name of the test being run."
212 }
213 return $fileName
214 }
215
216 proc test_cleanup {} {
217 if {![info exists ::tempRepoPath]} {return}
218 if {![file exists $::tempRepoPath]} {return}
219 if {![file isdirectory $::tempRepoPath]} {return}
220 set tempPathEnd [expr {[string length $::tempPath] - 1}]
221 if {[string length $::tempPath] == 0 || \
222 [string range $::tempRepoPath 0 $tempPathEnd] ne $::tempPath} {
223 error "Temporary repository path has wrong parent during cleanup."
224 }
225 catch {file delete -force $::tempRepoPath}
226 if {[info exists ::tempSavedPwd]} {
227 cd $::tempSavedPwd; unset ::tempSavedPwd
228 }
229 }
230
231 proc is_home_elsewhere {} {
232 return [expr {[info exists ::env(FOSSIL_HOME)] && \
233 $::env(FOSSIL_HOME) eq $::tempHomePath}]
234 }
@@ -213,30 +236,31 @@
236 proc set_home_to_elsewhere {} {
237 #
238 # Fossil will write data on $HOME (or $FOSSIL_HOME). We need not
239 # to clutter the real $HOME (or $FOSSIL_HOME) of the test caller.
240 #
241 if {[is_home_elsewhere]} {return}
 
 
 
242 set ::env(FOSSIL_HOME) $::tempHomePath
243 }
244
245 #
246 # Create and open a new Fossil repository and clean the checkout
247 #
248 proc repo_init {{filename ".rep.fossil"}} {
249 set_home_to_elsewhere
250 set ::tempRepoPath [file join \
251 $tempPath repo_[pid] [string trim [clock seconds] -] \
252 [file tail [get_script_or_fail]]]
253 if {[catch {
254 file mkdir $::tempRepoPath
255 } error] != 0} {
256 error "could not make directory \"$::tempRepoPath\",\
257 please set TEMP variable in environment: $error"
258 }
259 set ::tempSavedPwd [pwd]; cd $::tempRepoPath
 
260 exec $::fossilexe new $filename
261 exec $::fossilexe open $filename
 
262 exec $::fossilexe set mtime-changes off
263 }
264
265 # This procedure only returns non-zero if the Tcl integration feature was
266 # enabled at compile-time and is now enabled at runtime.
267
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -57,5 +57,9 @@
5757
}
5858
5959
test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
6060
test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]}
6161
test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
62
+
63
+###############################################################################
64
+
65
+test_cleanup
6266
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -57,5 +57,9 @@
57 }
58
59 test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
60 test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]}
61 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
 
 
 
 
62
--- test/th1-docs.test
+++ test/th1-docs.test
@@ -57,5 +57,9 @@
57 }
58
59 test th1-docs-1a {[regexp {<title>Fossil: test/fileStat.th1</title>} $RESULT]}
60 test th1-docs-1b {[regexp {>\[[0-9a-f]{40}\]<} $RESULT]}
61 test th1-docs-1c {[regexp { contains \d+ files\.} $RESULT]}
62
63 ###############################################################################
64
65 test_cleanup
66
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -195,5 +195,9 @@
195195
{<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
196196
197197
###############################################################################
198198
199199
restoreTh1SetupFile
200
+
201
+###############################################################################
202
+
203
+test_cleanup
200204
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -195,5 +195,9 @@
195 {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
196
197 ###############################################################################
198
199 restoreTh1SetupFile
 
 
 
 
200
--- test/th1-hooks.test
+++ test/th1-hooks.test
@@ -195,5 +195,9 @@
195 {<h1><b>command_hook http webpage_hook test1 webpage_notify test1</b></h1>}}
196
197 ###############################################################################
198
199 restoreTh1SetupFile
200
201 ###############################################################################
202
203 test_cleanup
204
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -82,5 +82,9 @@
8282
test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
8383
test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
8484
test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"}
8585
test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
8686
test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
87
+
88
+###############################################################################
89
+
90
+test_cleanup
8791
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -82,5 +82,9 @@
82 test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
83 test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
84 test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"}
85 test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
86 test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
 
 
 
 
87
--- test/th1-repo.test
+++ test/th1-repo.test
@@ -82,5 +82,9 @@
82 test th1-dir-3.8 {[lindex [lindex $RESULT 2] 1] == 2}
83 test th1-dir-3.9 {[regexp -- $dateTime [lindex [lindex $RESULT 2] 2]]}
84 test th1-dir-3.10 {[lindex [lindex $RESULT 3] 0] eq "subdirC/f10.md"}
85 test th1-dir-3.11 {[lindex [lindex $RESULT 3] 1] == 3}
86 test th1-dir-3.12 {[regexp -- $dateTime [lindex [lindex $RESULT 3] 2]]}
87
88 ###############################################################################
89
90 test_cleanup
91
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -173,5 +173,9 @@
173173
174174
###############################################################################
175175
176176
fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
177177
test th1-tcl-17 {[normalize_result] eq {x}}
178
+
179
+###############################################################################
180
+
181
+test_cleanup
178182
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -173,5 +173,9 @@
173
174 ###############################################################################
175
176 fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
177 test th1-tcl-17 {[normalize_result] eq {x}}
 
 
 
 
178
--- test/th1-tcl.test
+++ test/th1-tcl.test
@@ -173,5 +173,9 @@
173
174 ###############################################################################
175
176 fossil test-th-eval "tclMakeSafe; tclEval set x 2; tclEval info vars x"
177 test th1-tcl-17 {[normalize_result] eq {x}}
178
179 ###############################################################################
180
181 test_cleanup
182
--- test/th1.test
+++ test/th1.test
@@ -1451,5 +1451,9 @@
14511451
}
14521452
14531453
fossil test-th-source $th1FileName
14541454
test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}}
14551455
file delete $th1FileName
1456
+
1457
+###############################################################################
1458
+
1459
+test_cleanup
14561460
--- test/th1.test
+++ test/th1.test
@@ -1451,5 +1451,9 @@
1451 }
1452
1453 fossil test-th-source $th1FileName
1454 test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}}
1455 file delete $th1FileName
 
 
 
 
1456
--- test/th1.test
+++ test/th1.test
@@ -1451,5 +1451,9 @@
1451 }
1452
1453 fossil test-th-source $th1FileName
1454 test th1-source-1 {$RESULT eq {TH_RETURN: 0 1 2 3 4 5 6 7 8 9}}
1455 file delete $th1FileName
1456
1457 ###############################################################################
1458
1459 test_cleanup
1460
--- test/utf.test
+++ test/utf.test
@@ -23490,5 +23490,9 @@
2349023490
Has flag LOOK_SHORT: no}
2349123491
2349223492
############################ END GENERATED SECTION ############################
2349323493
2349423494
deleteTestFiles $tempPath 100
23495
+
23496
+###############################################################################
23497
+
23498
+test_cleanup
2349523499
--- test/utf.test
+++ test/utf.test
@@ -23490,5 +23490,9 @@
23490 Has flag LOOK_SHORT: no}
23491
23492 ############################ END GENERATED SECTION ############################
23493
23494 deleteTestFiles $tempPath 100
 
 
 
 
23495
--- test/utf.test
+++ test/utf.test
@@ -23490,5 +23490,9 @@
23490 Has flag LOOK_SHORT: no}
23491
23492 ############################ END GENERATED SECTION ############################
23493
23494 deleteTestFiles $tempPath 100
23495
23496 ###############################################################################
23497
23498 test_cleanup
23499

Keyboard Shortcuts

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