Fossil SCM
In the test suite, require the configured temporary directory to be valid prior to attempting to run any tests.
Commit
e2bd4bfced4915d381ac6089b6c5d8e2e6b78415
Parent
cd58f59a474c7ef…
1 file changed
+17
-10
+17
-10
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -57,17 +57,10 @@ | ||
| 57 | 57 | set base [file root [file tail $f]] |
| 58 | 58 | lappend argv $base |
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | -set tempPath [expr {[info exists env(TEMP)] ? \ | |
| 63 | - $env(TEMP) : [file dirname [info script]]}] | |
| 64 | - | |
| 65 | -if {$tcl_platform(platform) eq "windows"} then { | |
| 66 | - set tempPath [string map [list \\ /] $tempPath] | |
| 67 | -} | |
| 68 | - | |
| 69 | 62 | # start protocol |
| 70 | 63 | # |
| 71 | 64 | proc protInit {cmd} { |
| 72 | 65 | if {$::PROT} { |
| 73 | 66 | set out [open [file join $::testrundir prot] w] |
| @@ -254,11 +247,11 @@ | ||
| 254 | 247 | # Saves the TH1 setup script file by renaming it, based on the current |
| 255 | 248 | # process ID. |
| 256 | 249 | # |
| 257 | 250 | proc saveTh1SetupFile {} { |
| 258 | 251 | set oldFileName [getTh1SetupFileName] |
| 259 | - if {[file exists $oldFileName]} then { | |
| 252 | + if {[file exists $oldFileName]} { | |
| 260 | 253 | set newFileName [getSavedTh1SetupFileName] |
| 261 | 254 | catch {file delete $newFileName} |
| 262 | 255 | file rename $oldFileName $newFileName |
| 263 | 256 | } |
| 264 | 257 | } |
| @@ -267,11 +260,11 @@ | ||
| 267 | 260 | # on the current process ID. |
| 268 | 261 | # |
| 269 | 262 | proc restoreTh1SetupFile {} { |
| 270 | 263 | set oldFileName [getSavedTh1SetupFileName] |
| 271 | 264 | set newFileName [getTh1SetupFileName] |
| 272 | - if {[file exists $oldFileName]} then { | |
| 265 | + if {[file exists $oldFileName]} { | |
| 273 | 266 | catch {file delete $newFileName} |
| 274 | 267 | file rename $oldFileName $newFileName |
| 275 | 268 | } else { |
| 276 | 269 | # |
| 277 | 270 | # NOTE: There was no TH1 setup script file, delete the test one. |
| @@ -367,11 +360,11 @@ | ||
| 367 | 360 | |
| 368 | 361 | write_file $inFileName $data |
| 369 | 362 | fossil http $inFileName $outFileName 127.0.0.1 $repository --localauth |
| 370 | 363 | set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}] |
| 371 | 364 | |
| 372 | - if {1} then { | |
| 365 | + if {1} { | |
| 373 | 366 | catch {file delete $inFileName} |
| 374 | 367 | catch {file delete $outFileName} |
| 375 | 368 | } |
| 376 | 369 | |
| 377 | 370 | return $result |
| @@ -418,10 +411,24 @@ | ||
| 418 | 411 | |
| 419 | 412 | # returns the third to last line of the normalized result. |
| 420 | 413 | proc third_to_last_data_line {} { |
| 421 | 414 | return [lindex [split [normalize_result] \n] end-2] |
| 422 | 415 | } |
| 416 | + | |
| 417 | +set tempPath [expr {[info exists env(TEMP)] ? \ | |
| 418 | + $env(TEMP) : [file dirname [info script]]}] | |
| 419 | + | |
| 420 | +if {$tcl_platform(platform) eq "windows"} { | |
| 421 | + set tempPath [string map [list \\ /] $tempPath] | |
| 422 | +} | |
| 423 | + | |
| 424 | +if {[catch { | |
| 425 | + write_file [file join $tempPath temporary.txt] [clock seconds] | |
| 426 | +} error] != 0} { | |
| 427 | + error "could not write file to directory \"$tempPath\",\ | |
| 428 | +please set TEMP variable in environment: $error" | |
| 429 | +} | |
| 423 | 430 | |
| 424 | 431 | protInit $fossilexe |
| 425 | 432 | foreach testfile $argv { |
| 426 | 433 | set dir [file root [file tail $testfile]] |
| 427 | 434 | file delete -force $dir |
| 428 | 435 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -57,17 +57,10 @@ | |
| 57 | set base [file root [file tail $f]] |
| 58 | lappend argv $base |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | set tempPath [expr {[info exists env(TEMP)] ? \ |
| 63 | $env(TEMP) : [file dirname [info script]]}] |
| 64 | |
| 65 | if {$tcl_platform(platform) eq "windows"} then { |
| 66 | set tempPath [string map [list \\ /] $tempPath] |
| 67 | } |
| 68 | |
| 69 | # start protocol |
| 70 | # |
| 71 | proc protInit {cmd} { |
| 72 | if {$::PROT} { |
| 73 | set out [open [file join $::testrundir prot] w] |
| @@ -254,11 +247,11 @@ | |
| 254 | # Saves the TH1 setup script file by renaming it, based on the current |
| 255 | # process ID. |
| 256 | # |
| 257 | proc saveTh1SetupFile {} { |
| 258 | set oldFileName [getTh1SetupFileName] |
| 259 | if {[file exists $oldFileName]} then { |
| 260 | set newFileName [getSavedTh1SetupFileName] |
| 261 | catch {file delete $newFileName} |
| 262 | file rename $oldFileName $newFileName |
| 263 | } |
| 264 | } |
| @@ -267,11 +260,11 @@ | |
| 267 | # on the current process ID. |
| 268 | # |
| 269 | proc restoreTh1SetupFile {} { |
| 270 | set oldFileName [getSavedTh1SetupFileName] |
| 271 | set newFileName [getTh1SetupFileName] |
| 272 | if {[file exists $oldFileName]} then { |
| 273 | catch {file delete $newFileName} |
| 274 | file rename $oldFileName $newFileName |
| 275 | } else { |
| 276 | # |
| 277 | # NOTE: There was no TH1 setup script file, delete the test one. |
| @@ -367,11 +360,11 @@ | |
| 367 | |
| 368 | write_file $inFileName $data |
| 369 | fossil http $inFileName $outFileName 127.0.0.1 $repository --localauth |
| 370 | set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}] |
| 371 | |
| 372 | if {1} then { |
| 373 | catch {file delete $inFileName} |
| 374 | catch {file delete $outFileName} |
| 375 | } |
| 376 | |
| 377 | return $result |
| @@ -418,10 +411,24 @@ | |
| 418 | |
| 419 | # returns the third to last line of the normalized result. |
| 420 | proc third_to_last_data_line {} { |
| 421 | return [lindex [split [normalize_result] \n] end-2] |
| 422 | } |
| 423 | |
| 424 | protInit $fossilexe |
| 425 | foreach testfile $argv { |
| 426 | set dir [file root [file tail $testfile]] |
| 427 | file delete -force $dir |
| 428 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -57,17 +57,10 @@ | |
| 57 | set base [file root [file tail $f]] |
| 58 | lappend argv $base |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | # start protocol |
| 63 | # |
| 64 | proc protInit {cmd} { |
| 65 | if {$::PROT} { |
| 66 | set out [open [file join $::testrundir prot] w] |
| @@ -254,11 +247,11 @@ | |
| 247 | # Saves the TH1 setup script file by renaming it, based on the current |
| 248 | # process ID. |
| 249 | # |
| 250 | proc saveTh1SetupFile {} { |
| 251 | set oldFileName [getTh1SetupFileName] |
| 252 | if {[file exists $oldFileName]} { |
| 253 | set newFileName [getSavedTh1SetupFileName] |
| 254 | catch {file delete $newFileName} |
| 255 | file rename $oldFileName $newFileName |
| 256 | } |
| 257 | } |
| @@ -267,11 +260,11 @@ | |
| 260 | # on the current process ID. |
| 261 | # |
| 262 | proc restoreTh1SetupFile {} { |
| 263 | set oldFileName [getSavedTh1SetupFileName] |
| 264 | set newFileName [getTh1SetupFileName] |
| 265 | if {[file exists $oldFileName]} { |
| 266 | catch {file delete $newFileName} |
| 267 | file rename $oldFileName $newFileName |
| 268 | } else { |
| 269 | # |
| 270 | # NOTE: There was no TH1 setup script file, delete the test one. |
| @@ -367,11 +360,11 @@ | |
| 360 | |
| 361 | write_file $inFileName $data |
| 362 | fossil http $inFileName $outFileName 127.0.0.1 $repository --localauth |
| 363 | set result [expr {[file exists $outFileName] ? [read_file $outFileName] : ""}] |
| 364 | |
| 365 | if {1} { |
| 366 | catch {file delete $inFileName} |
| 367 | catch {file delete $outFileName} |
| 368 | } |
| 369 | |
| 370 | return $result |
| @@ -418,10 +411,24 @@ | |
| 411 | |
| 412 | # returns the third to last line of the normalized result. |
| 413 | proc third_to_last_data_line {} { |
| 414 | return [lindex [split [normalize_result] \n] end-2] |
| 415 | } |
| 416 | |
| 417 | set tempPath [expr {[info exists env(TEMP)] ? \ |
| 418 | $env(TEMP) : [file dirname [info script]]}] |
| 419 | |
| 420 | if {$tcl_platform(platform) eq "windows"} { |
| 421 | set tempPath [string map [list \\ /] $tempPath] |
| 422 | } |
| 423 | |
| 424 | if {[catch { |
| 425 | write_file [file join $tempPath temporary.txt] [clock seconds] |
| 426 | } error] != 0} { |
| 427 | error "could not write file to directory \"$tempPath\",\ |
| 428 | please set TEMP variable in environment: $error" |
| 429 | } |
| 430 | |
| 431 | protInit $fossilexe |
| 432 | foreach testfile $argv { |
| 433 | set dir [file root [file tail $testfile]] |
| 434 | file delete -force $dir |
| 435 |