Fossil SCM
Cached the result of "$tcl_platform(platform) eq "windows"" in test/tester.tcl and replaced all of the repetitions of this expression with a test of the variable.
Commit
2e4143aa4b8800dc7b6453bc612386371a5b4960e9a26dcebdd5121e417da3ed
Parent
8eadf4c428a7988…
1 file changed
+8
-7
+8
-7
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -29,12 +29,13 @@ | ||
| 29 | 29 | |
| 30 | 30 | set testfiledir [file normalize [file dirname [info script]]] |
| 31 | 31 | set testrundir [pwd] |
| 32 | 32 | set testdir [file normalize [file dirname $argv0]] |
| 33 | 33 | set fossilexe [file normalize [lindex $argv 0]] |
| 34 | +set is_windows [expr {$::tcl_platform(platform) eq "windows"}] | |
| 34 | 35 | |
| 35 | -if {$tcl_platform(platform) eq "windows" && \ | |
| 36 | +if {$is_windows && \ | |
| 36 | 37 | [string length [file extension $fossilexe]] == 0} { |
| 37 | 38 | append fossilexe .exe |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | set argv [lrange $argv 1 end] |
| @@ -443,11 +444,11 @@ | ||
| 443 | 444 | if {![info exists ::tempKeepHome]} {delete_temporary_home} |
| 444 | 445 | } |
| 445 | 446 | |
| 446 | 447 | proc delete_temporary_home {} { |
| 447 | 448 | if {$::KEEP} {return}; # All cleanup disabled? |
| 448 | - if {$::tcl_platform(platform) eq "windows"} { | |
| 449 | + if {$::is_windows} { | |
| 449 | 450 | robust_delete [file join $::tempHomePath _fossil] |
| 450 | 451 | } else { |
| 451 | 452 | robust_delete [file join $::tempHomePath .fossil] |
| 452 | 453 | } |
| 453 | 454 | robust_delete $::tempHomePath |
| @@ -628,11 +629,11 @@ | ||
| 628 | 629 | } |
| 629 | 630 | |
| 630 | 631 | # |
| 631 | 632 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 632 | 633 | # |
| 633 | - if {$::tcl_platform(platform) ne "windows"} { | |
| 634 | + if {!$::is_windows} { | |
| 634 | 635 | set value /tmp |
| 635 | 636 | |
| 636 | 637 | if {[file exists $value] && [file isdirectory $value]} { |
| 637 | 638 | return $value |
| 638 | 639 | } |
| @@ -800,21 +801,21 @@ | ||
| 800 | 801 | global fossilexe tempPath |
| 801 | 802 | set command [list exec $fossilexe server --localhost] |
| 802 | 803 | if {[string length $varName] > 0} { |
| 803 | 804 | upvar 1 $varName stopArg |
| 804 | 805 | } |
| 805 | - if {$::tcl_platform(platform) eq "windows"} { | |
| 806 | + if {$::is_windows} { | |
| 806 | 807 | set stopArg [file join [getTemporaryPath] [appendArgs \ |
| 807 | 808 | [string trim [clock seconds] -] _ [getSeqNo] .stopper]] |
| 808 | 809 | lappend command --stopper $stopArg |
| 809 | 810 | } |
| 810 | 811 | set outFileName [file join $tempPath [appendArgs \ |
| 811 | 812 | fossil_server_ [string trim [clock seconds] -] _ \ |
| 812 | 813 | [getSeqNo]]].out |
| 813 | 814 | lappend command $repository >&$outFileName & |
| 814 | 815 | set pid [eval $command] |
| 815 | - if {$::tcl_platform(platform) ne "windows"} { | |
| 816 | + if {!$::is_windows} { | |
| 816 | 817 | set stopArg $pid |
| 817 | 818 | } |
| 818 | 819 | after 1000; # output might not be there yet |
| 819 | 820 | set output [read_file $outFileName] |
| 820 | 821 | if {![regexp {Listening.*TCP port (\d+)} $output dummy port]} { |
| @@ -827,11 +828,11 @@ | ||
| 827 | 828 | # This procedure stops a Fossil server instance that was previously started |
| 828 | 829 | # by the [test_start_server] procedure. The value of the "stop argument" |
| 829 | 830 | # will vary by platform as will the exact method used to stop the server. |
| 830 | 831 | # The fileName argument is the name of a temporary output file to delete. |
| 831 | 832 | proc test_stop_server { stopArg pid fileName } { |
| 832 | - if {$::tcl_platform(platform) eq "windows"} { | |
| 833 | + if {$::is_windows} { | |
| 833 | 834 | # |
| 834 | 835 | # NOTE: On Windows, the "stop argument" must be the name of a file |
| 835 | 836 | # that does NOT already exist. |
| 836 | 837 | # |
| 837 | 838 | if {[string length $stopArg] > 0 && \ |
| @@ -954,11 +955,11 @@ | ||
| 954 | 955 | return [lindex [split [normalize_result] \n] end-2] |
| 955 | 956 | } |
| 956 | 957 | |
| 957 | 958 | set tempPath [getTemporaryPath] |
| 958 | 959 | |
| 959 | -if {$tcl_platform(platform) eq "windows"} { | |
| 960 | +if {$is_windows} { | |
| 960 | 961 | set tempPath [string map [list \\ /] $tempPath] |
| 961 | 962 | } |
| 962 | 963 | |
| 963 | 964 | if {[catch { |
| 964 | 965 | set tempFile [file join $tempPath temporary.txt] |
| 965 | 966 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -29,12 +29,13 @@ | |
| 29 | |
| 30 | set testfiledir [file normalize [file dirname [info script]]] |
| 31 | set testrundir [pwd] |
| 32 | set testdir [file normalize [file dirname $argv0]] |
| 33 | set fossilexe [file normalize [lindex $argv 0]] |
| 34 | |
| 35 | if {$tcl_platform(platform) eq "windows" && \ |
| 36 | [string length [file extension $fossilexe]] == 0} { |
| 37 | append fossilexe .exe |
| 38 | } |
| 39 | |
| 40 | set argv [lrange $argv 1 end] |
| @@ -443,11 +444,11 @@ | |
| 443 | if {![info exists ::tempKeepHome]} {delete_temporary_home} |
| 444 | } |
| 445 | |
| 446 | proc delete_temporary_home {} { |
| 447 | if {$::KEEP} {return}; # All cleanup disabled? |
| 448 | if {$::tcl_platform(platform) eq "windows"} { |
| 449 | robust_delete [file join $::tempHomePath _fossil] |
| 450 | } else { |
| 451 | robust_delete [file join $::tempHomePath .fossil] |
| 452 | } |
| 453 | robust_delete $::tempHomePath |
| @@ -628,11 +629,11 @@ | |
| 628 | } |
| 629 | |
| 630 | # |
| 631 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 632 | # |
| 633 | if {$::tcl_platform(platform) ne "windows"} { |
| 634 | set value /tmp |
| 635 | |
| 636 | if {[file exists $value] && [file isdirectory $value]} { |
| 637 | return $value |
| 638 | } |
| @@ -800,21 +801,21 @@ | |
| 800 | global fossilexe tempPath |
| 801 | set command [list exec $fossilexe server --localhost] |
| 802 | if {[string length $varName] > 0} { |
| 803 | upvar 1 $varName stopArg |
| 804 | } |
| 805 | if {$::tcl_platform(platform) eq "windows"} { |
| 806 | set stopArg [file join [getTemporaryPath] [appendArgs \ |
| 807 | [string trim [clock seconds] -] _ [getSeqNo] .stopper]] |
| 808 | lappend command --stopper $stopArg |
| 809 | } |
| 810 | set outFileName [file join $tempPath [appendArgs \ |
| 811 | fossil_server_ [string trim [clock seconds] -] _ \ |
| 812 | [getSeqNo]]].out |
| 813 | lappend command $repository >&$outFileName & |
| 814 | set pid [eval $command] |
| 815 | if {$::tcl_platform(platform) ne "windows"} { |
| 816 | set stopArg $pid |
| 817 | } |
| 818 | after 1000; # output might not be there yet |
| 819 | set output [read_file $outFileName] |
| 820 | if {![regexp {Listening.*TCP port (\d+)} $output dummy port]} { |
| @@ -827,11 +828,11 @@ | |
| 827 | # This procedure stops a Fossil server instance that was previously started |
| 828 | # by the [test_start_server] procedure. The value of the "stop argument" |
| 829 | # will vary by platform as will the exact method used to stop the server. |
| 830 | # The fileName argument is the name of a temporary output file to delete. |
| 831 | proc test_stop_server { stopArg pid fileName } { |
| 832 | if {$::tcl_platform(platform) eq "windows"} { |
| 833 | # |
| 834 | # NOTE: On Windows, the "stop argument" must be the name of a file |
| 835 | # that does NOT already exist. |
| 836 | # |
| 837 | if {[string length $stopArg] > 0 && \ |
| @@ -954,11 +955,11 @@ | |
| 954 | return [lindex [split [normalize_result] \n] end-2] |
| 955 | } |
| 956 | |
| 957 | set tempPath [getTemporaryPath] |
| 958 | |
| 959 | if {$tcl_platform(platform) eq "windows"} { |
| 960 | set tempPath [string map [list \\ /] $tempPath] |
| 961 | } |
| 962 | |
| 963 | if {[catch { |
| 964 | set tempFile [file join $tempPath temporary.txt] |
| 965 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -29,12 +29,13 @@ | |
| 29 | |
| 30 | set testfiledir [file normalize [file dirname [info script]]] |
| 31 | set testrundir [pwd] |
| 32 | set testdir [file normalize [file dirname $argv0]] |
| 33 | set fossilexe [file normalize [lindex $argv 0]] |
| 34 | set is_windows [expr {$::tcl_platform(platform) eq "windows"}] |
| 35 | |
| 36 | if {$is_windows && \ |
| 37 | [string length [file extension $fossilexe]] == 0} { |
| 38 | append fossilexe .exe |
| 39 | } |
| 40 | |
| 41 | set argv [lrange $argv 1 end] |
| @@ -443,11 +444,11 @@ | |
| 444 | if {![info exists ::tempKeepHome]} {delete_temporary_home} |
| 445 | } |
| 446 | |
| 447 | proc delete_temporary_home {} { |
| 448 | if {$::KEEP} {return}; # All cleanup disabled? |
| 449 | if {$::is_windows} { |
| 450 | robust_delete [file join $::tempHomePath _fossil] |
| 451 | } else { |
| 452 | robust_delete [file join $::tempHomePath .fossil] |
| 453 | } |
| 454 | robust_delete $::tempHomePath |
| @@ -628,11 +629,11 @@ | |
| 629 | } |
| 630 | |
| 631 | # |
| 632 | # NOTE: On non-Windows systems, fallback to /tmp if it is usable. |
| 633 | # |
| 634 | if {!$::is_windows} { |
| 635 | set value /tmp |
| 636 | |
| 637 | if {[file exists $value] && [file isdirectory $value]} { |
| 638 | return $value |
| 639 | } |
| @@ -800,21 +801,21 @@ | |
| 801 | global fossilexe tempPath |
| 802 | set command [list exec $fossilexe server --localhost] |
| 803 | if {[string length $varName] > 0} { |
| 804 | upvar 1 $varName stopArg |
| 805 | } |
| 806 | if {$::is_windows} { |
| 807 | set stopArg [file join [getTemporaryPath] [appendArgs \ |
| 808 | [string trim [clock seconds] -] _ [getSeqNo] .stopper]] |
| 809 | lappend command --stopper $stopArg |
| 810 | } |
| 811 | set outFileName [file join $tempPath [appendArgs \ |
| 812 | fossil_server_ [string trim [clock seconds] -] _ \ |
| 813 | [getSeqNo]]].out |
| 814 | lappend command $repository >&$outFileName & |
| 815 | set pid [eval $command] |
| 816 | if {!$::is_windows} { |
| 817 | set stopArg $pid |
| 818 | } |
| 819 | after 1000; # output might not be there yet |
| 820 | set output [read_file $outFileName] |
| 821 | if {![regexp {Listening.*TCP port (\d+)} $output dummy port]} { |
| @@ -827,11 +828,11 @@ | |
| 828 | # This procedure stops a Fossil server instance that was previously started |
| 829 | # by the [test_start_server] procedure. The value of the "stop argument" |
| 830 | # will vary by platform as will the exact method used to stop the server. |
| 831 | # The fileName argument is the name of a temporary output file to delete. |
| 832 | proc test_stop_server { stopArg pid fileName } { |
| 833 | if {$::is_windows} { |
| 834 | # |
| 835 | # NOTE: On Windows, the "stop argument" must be the name of a file |
| 836 | # that does NOT already exist. |
| 837 | # |
| 838 | if {[string length $stopArg] > 0 && \ |
| @@ -954,11 +955,11 @@ | |
| 955 | return [lindex [split [normalize_result] \n] end-2] |
| 956 | } |
| 957 | |
| 958 | set tempPath [getTemporaryPath] |
| 959 | |
| 960 | if {$is_windows} { |
| 961 | set tempPath [string map [list \\ /] $tempPath] |
| 962 | } |
| 963 | |
| 964 | if {[catch { |
| 965 | set tempFile [file join $tempPath temporary.txt] |
| 966 |