Fossil SCM
Modify 'th1-hooks' test to decouple it from needing to run within a Fossil source checkout.
Commit
9bfdc5c68208f5e3b98b8f95d367b9fd37d0f84b
Parent
8f199fd8f59a5ec…
2 files changed
+4
-3
+9
-2
+4
-3
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -249,12 +249,11 @@ | ||
| 249 | 249 | # |
| 250 | 250 | # NOTE: This uses the "testdir" global variable provided by the |
| 251 | 251 | # test suite; alternatively, the root of the source tree |
| 252 | 252 | # could be obtained directly from Fossil. |
| 253 | 253 | # |
| 254 | - return [file normalize [file join [file dirname $::testdir] \ | |
| 255 | - .fossil-settings th1-setup]] | |
| 254 | + return [file normalize [file join .fossil-settings th1-setup]] | |
| 256 | 255 | } |
| 257 | 256 | |
| 258 | 257 | # Return the saved name of the versioned settings file containing |
| 259 | 258 | # the TH1 setup script. |
| 260 | 259 | # |
| @@ -267,11 +266,13 @@ | ||
| 267 | 266 | # preserve the existing TH1 setup script. Prior to completing the test, |
| 268 | 267 | # the [restoreTh1SetupFile] procedure should be called to restore the |
| 269 | 268 | # original TH1 setup script. |
| 270 | 269 | # |
| 271 | 270 | proc writeTh1SetupFile { data } { |
| 272 | - return [write_file [getTh1SetupFileName] $data] | |
| 271 | + set fileName [getTh1SetupFileName] | |
| 272 | + file mkdir [file dirname $fileName] | |
| 273 | + return [write_file $fileName $data] | |
| 273 | 274 | } |
| 274 | 275 | |
| 275 | 276 | # Saves the TH1 setup script file by renaming it, based on the current |
| 276 | 277 | # process ID. |
| 277 | 278 | # |
| 278 | 279 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -249,12 +249,11 @@ | |
| 249 | # |
| 250 | # NOTE: This uses the "testdir" global variable provided by the |
| 251 | # test suite; alternatively, the root of the source tree |
| 252 | # could be obtained directly from Fossil. |
| 253 | # |
| 254 | return [file normalize [file join [file dirname $::testdir] \ |
| 255 | .fossil-settings th1-setup]] |
| 256 | } |
| 257 | |
| 258 | # Return the saved name of the versioned settings file containing |
| 259 | # the TH1 setup script. |
| 260 | # |
| @@ -267,11 +266,13 @@ | |
| 267 | # preserve the existing TH1 setup script. Prior to completing the test, |
| 268 | # the [restoreTh1SetupFile] procedure should be called to restore the |
| 269 | # original TH1 setup script. |
| 270 | # |
| 271 | proc writeTh1SetupFile { data } { |
| 272 | return [write_file [getTh1SetupFileName] $data] |
| 273 | } |
| 274 | |
| 275 | # Saves the TH1 setup script file by renaming it, based on the current |
| 276 | # process ID. |
| 277 | # |
| 278 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -249,12 +249,11 @@ | |
| 249 | # |
| 250 | # NOTE: This uses the "testdir" global variable provided by the |
| 251 | # test suite; alternatively, the root of the source tree |
| 252 | # could be obtained directly from Fossil. |
| 253 | # |
| 254 | return [file normalize [file join .fossil-settings th1-setup]] |
| 255 | } |
| 256 | |
| 257 | # Return the saved name of the versioned settings file containing |
| 258 | # the TH1 setup script. |
| 259 | # |
| @@ -267,11 +266,13 @@ | |
| 266 | # preserve the existing TH1 setup script. Prior to completing the test, |
| 267 | # the [restoreTh1SetupFile] procedure should be called to restore the |
| 268 | # original TH1 setup script. |
| 269 | # |
| 270 | proc writeTh1SetupFile { data } { |
| 271 | set fileName [getTh1SetupFileName] |
| 272 | file mkdir [file dirname $fileName] |
| 273 | return [write_file $fileName $data] |
| 274 | } |
| 275 | |
| 276 | # Saves the TH1 setup script file by renaming it, based on the current |
| 277 | # process ID. |
| 278 | # |
| 279 |
+9
-2
| --- test/th1-hooks.test | ||
| +++ test/th1-hooks.test | ||
| @@ -24,10 +24,15 @@ | ||
| 24 | 24 | puts "Fossil was not compiled with TH1 hooks support."; return |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | ############################################################################### |
| 28 | 28 | |
| 29 | +repo_init | |
| 30 | +write_file f1 "f1"; fossil add f1; fossil commit -m "c1" | |
| 31 | + | |
| 32 | +############################################################################### | |
| 33 | + | |
| 29 | 34 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| 30 | 35 | |
| 31 | 36 | ############################################################################### |
| 32 | 37 | |
| 33 | 38 | set testTh1Setup { |
| @@ -130,11 +135,11 @@ | ||
| 130 | 135 | |
| 131 | 136 | test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}} |
| 132 | 137 | |
| 133 | 138 | ############################################################################### |
| 134 | 139 | |
| 135 | -fossil timeline now | |
| 140 | +fossil timeline -n -1 now | |
| 136 | 141 | test th1-cmd-hooks-3a {[first_data_line] eq \ |
| 137 | 142 | {<h1><b>command_hook timeline</b></h1>}} |
| 138 | 143 | |
| 139 | 144 | test th1-cmd-hooks-3b \ |
| 140 | 145 | {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]} |
| @@ -171,11 +176,13 @@ | ||
| 171 | 176 | {<h1><b>command_hook test4</b></h1>}} |
| 172 | 177 | |
| 173 | 178 | ############################################################################### |
| 174 | 179 | |
| 175 | 180 | set RESULT [test_fossil_http $repository $dataFileName /timeline] |
| 176 | -test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]} | |
| 181 | + | |
| 182 | +test th1-web-hooks-1a {[regexp \ | |
| 183 | + {<title>Unnamed Fossil Project: Timeline</title>} $RESULT]} | |
| 177 | 184 | |
| 178 | 185 | test th1-web-hooks-1b {[regexp [appendArgs \ |
| 179 | 186 | {<h1><b>command_hook http webpage_hook timeline} " " \ |
| 180 | 187 | {webpage_notify timeline</b></h1>}] $RESULT]} |
| 181 | 188 | |
| 182 | 189 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -24,10 +24,15 @@ | |
| 24 | puts "Fossil was not compiled with TH1 hooks support."; return |
| 25 | } |
| 26 | |
| 27 | ############################################################################### |
| 28 | |
| 29 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| 30 | |
| 31 | ############################################################################### |
| 32 | |
| 33 | set testTh1Setup { |
| @@ -130,11 +135,11 @@ | |
| 130 | |
| 131 | test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}} |
| 132 | |
| 133 | ############################################################################### |
| 134 | |
| 135 | fossil timeline now |
| 136 | test th1-cmd-hooks-3a {[first_data_line] eq \ |
| 137 | {<h1><b>command_hook timeline</b></h1>}} |
| 138 | |
| 139 | test th1-cmd-hooks-3b \ |
| 140 | {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]} |
| @@ -171,11 +176,13 @@ | |
| 171 | {<h1><b>command_hook test4</b></h1>}} |
| 172 | |
| 173 | ############################################################################### |
| 174 | |
| 175 | set RESULT [test_fossil_http $repository $dataFileName /timeline] |
| 176 | test th1-web-hooks-1a {[regexp {<title>Fossil: Timeline</title>} $RESULT]} |
| 177 | |
| 178 | test th1-web-hooks-1b {[regexp [appendArgs \ |
| 179 | {<h1><b>command_hook http webpage_hook timeline} " " \ |
| 180 | {webpage_notify timeline</b></h1>}] $RESULT]} |
| 181 | |
| 182 |
| --- test/th1-hooks.test | |
| +++ test/th1-hooks.test | |
| @@ -24,10 +24,15 @@ | |
| 24 | puts "Fossil was not compiled with TH1 hooks support."; return |
| 25 | } |
| 26 | |
| 27 | ############################################################################### |
| 28 | |
| 29 | repo_init |
| 30 | write_file f1 "f1"; fossil add f1; fossil commit -m "c1" |
| 31 | |
| 32 | ############################################################################### |
| 33 | |
| 34 | set env(TH1_ENABLE_HOOKS) 1; # TH1 hooks must be enabled for this test. |
| 35 | |
| 36 | ############################################################################### |
| 37 | |
| 38 | set testTh1Setup { |
| @@ -130,11 +135,11 @@ | |
| 135 | |
| 136 | test th1-cmd-hooks-2b {[second_data_line] eq {ERROR: unsupported timeline}} |
| 137 | |
| 138 | ############################################################################### |
| 139 | |
| 140 | fossil timeline -n -1 now |
| 141 | test th1-cmd-hooks-3a {[first_data_line] eq \ |
| 142 | {<h1><b>command_hook timeline</b></h1>}} |
| 143 | |
| 144 | test th1-cmd-hooks-3b \ |
| 145 | {[regexp -- {=== \d{4}-\d{2}-\d{2} ===} [second_data_line]]} |
| @@ -171,11 +176,13 @@ | |
| 176 | {<h1><b>command_hook test4</b></h1>}} |
| 177 | |
| 178 | ############################################################################### |
| 179 | |
| 180 | set RESULT [test_fossil_http $repository $dataFileName /timeline] |
| 181 | |
| 182 | test th1-web-hooks-1a {[regexp \ |
| 183 | {<title>Unnamed Fossil Project: Timeline</title>} $RESULT]} |
| 184 | |
| 185 | test th1-web-hooks-1b {[regexp [appendArgs \ |
| 186 | {<h1><b>command_hook http webpage_hook timeline} " " \ |
| 187 | {webpage_notify timeline</b></h1>}] $RESULT]} |
| 188 | |
| 189 |