Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Centralize early-return handling from the tests, always calling the test cleanup (which is harmless if not needed). |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | testerCleanup |
| Files: | files | file ages | folders |
| SHA1: |
b01a51f43ae0e9f4890ec78fae6c5384 |
| User & Date: | mistachkin 2016-03-03 18:49:37.358 |
Context
|
2016-03-03
| ||
| 21:50 | Improve handling of setting up the initial temporary directory. check-in: e6e79ac6fb user: mistachkin tags: testerCleanup | |
| 18:49 | Centralize early-return handling from the tests, always calling the test cleanup (which is harmless if not needed). check-in: b01a51f43a user: mistachkin tags: testerCleanup | |
| 06:46 | When possible, don't call test_setup until after any checks that may cause a test script to exit early. Otherwise, test_cleanup should be called before returning. check-in: 314e9b3566 user: joel tags: testerCleanup | |
Changes
Changes to test/amend.test.
| ︙ | ︙ | |||
53 54 55 56 57 58 59 |
########################################
# Setup: Add file and commit #
########################################
if {![uuid_from_checkout UUIDINIT]} {
test amend-checkout-failure false
| | < | < | 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
########################################
# Setup: Add file and commit #
########################################
if {![uuid_from_checkout UUIDINIT]} {
test amend-checkout-failure false
test_cleanup_then_return
}
write_file datafile "data"
fossil add datafile
fossil commit -m "c1"
if {![uuid_from_commit $RESULT UUID]} {
test amend-setup-failure false
test_cleanup_then_return
}
########################################
# Test: -branch #
########################################
set UUIDB UUIDB
write_file datafile "data.file"
|
| ︙ | ︙ |
Changes to test/json.test.
| ︙ | ︙ | |||
22 23 24 25 26 27 28 |
# is not stubbed out. This assumes the current (as of 2016-01-27)
# practice of eliminating all trace of the fossil json command when
# not configured. If that changes, these conditions might not prevent
# the rest of this file from running.
fossil test-th-eval "hasfeature json"
if {$::RESULT ne "1"} then {
| | > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# is not stubbed out. This assumes the current (as of 2016-01-27)
# practice of eliminating all trace of the fossil json command when
# not configured. If that changes, these conditions might not prevent
# the rest of this file from running.
fossil test-th-eval "hasfeature json"
if {$::RESULT ne "1"} then {
puts "Fossil was not compiled with JSON support."
test_cleanup_then_return
}
# We need a JSON parser to effectively test the JSON produced by
# fossil. It looks like the one from tcllib is exactly what we need.
# On ActiveTcl, add it with teacup. On other platforms, YMMV.
# teacup install json
# teacup install json::write
|
| ︙ | ︙ | |||
45 46 47 48 49 50 51 |
return $result
}
# and that the json itself smells ok and has the expected API error code in it
fossil json -expectError
set JR [json2dict $RESULT]
if {$JR eq ""} {
| | > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
return $result
}
# and that the json itself smells ok and has the expected API error code in it
fossil json -expectError
set JR [json2dict $RESULT]
if {$JR eq ""} {
puts "Fossil was not compiled with JSON support (bad JSON)."
test_cleanup_then_return
}
test json-1 {[dict exists $JR resultCode]
&& [dict get $JR resultCode] eq "FOSSIL-4102"}
# Use the CLI interface to execute a JSON command. Sets the global
# RESULT to the response text, and JR to a Tcl dict conversion of the
# response body.
|
| ︙ | ︙ |
Changes to test/tester.tcl.
| ︙ | ︙ | |||
229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
return
}
}
after [expr {$try * 100}]
}
error "Could not delete \"$path\", error: $error"
}
proc test_cleanup {} {
if {![info exists ::tempRepoPath]} {return}
if {![file exists $::tempRepoPath]} {return}
if {![file isdirectory $::tempRepoPath]} {return}
set tempPathEnd [expr {[string length $::tempPath] - 1}]
if {[string length $::tempPath] == 0 || \
| > > > > > | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
return
}
}
after [expr {$try * 100}]
}
error "Could not delete \"$path\", error: $error"
}
proc test_cleanup_then_return {} {
uplevel 1 [list test_cleanup]
return -code return
}
proc test_cleanup {} {
if {![info exists ::tempRepoPath]} {return}
if {![file exists $::tempRepoPath]} {return}
if {![file isdirectory $::tempRepoPath]} {return}
set tempPathEnd [expr {[string length $::tempPath] - 1}]
if {[string length $::tempPath] == 0 || \
|
| ︙ | ︙ |
Changes to test/th1-docs.test.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 |
#
# TH1 Docs
#
fossil test-th-eval "hasfeature th1Docs"
if {$::RESULT ne "1"} {
| | > | > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#
# TH1 Docs
#
fossil test-th-eval "hasfeature th1Docs"
if {$::RESULT ne "1"} {
puts "Fossil was not compiled with TH1 docs support."
test_cleanup_then_return
}
fossil test-th-eval "hasfeature tcl"
if {$::RESULT ne "1"} {
puts "Fossil was not compiled with Tcl support."
test_cleanup_then_return
}
###############################################################################
test_setup ""
###############################################################################
set env(TH1_ENABLE_DOCS) 1; # TH1 docs must be enabled for this test.
set env(TH1_ENABLE_TCL) 1; # Tcl integration must be enabled for this test.
|
| ︙ | ︙ |
Changes to test/th1-hooks.test.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 |
#
# TH1 Hooks
#
fossil test-th-eval "hasfeature th1Hooks"
if {$::RESULT ne "1"} {
| | > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
#
# TH1 Hooks
#
fossil test-th-eval "hasfeature th1Hooks"
if {$::RESULT ne "1"} {
puts "Fossil was not compiled with TH1 hooks support."
test_cleanup_then_return
}
###############################################################################
test_setup
###############################################################################
write_file f1 "f1"; fossil add f1; fossil commit -m "c1"
###############################################################################
set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test.
###############################################################################
|
| ︙ | ︙ |
Changes to test/th1-tcl.test.
| ︙ | ︙ | |||
21 22 23 24 25 26 27 |
set dir [file dirname [info script]]
###############################################################################
fossil test-th-eval "hasfeature tcl"
if {$::RESULT ne "1"} {
| | > | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
set dir [file dirname [info script]]
###############################################################################
fossil test-th-eval "hasfeature tcl"
if {$::RESULT ne "1"} {
puts "Fossil was not compiled with Tcl support."
test_cleanup_then_return
}
###############################################################################
test_setup
###############################################################################
|
| ︙ | ︙ |