Fossil SCM
Read the port of a test server from its listening line, making allowances for differences in the text line, eg "localhost" appears on Unix but not Windows, and if we add TLS to the test suite then that is different again, etc.
Commit
049fe12082c807f8eae1ae3a0906c6e096fdfbc491cfa54569406833939ba96c
Parent
ab45d34c9dd727c…
1 file changed
+12
-5
+12
-5
| --- test/tester.tcl | ||
| +++ test/tester.tcl | ||
| @@ -967,15 +967,22 @@ | ||
| 967 | 967 | lappend command $repository >&$outFileName & |
| 968 | 968 | set pid [eval $command] |
| 969 | 969 | if {!$::is_windows} { |
| 970 | 970 | set stopArg $pid |
| 971 | 971 | } |
| 972 | - after 1000; # output might not be there yet | |
| 973 | - set output [read_file $outFileName] | |
| 974 | - if {![regexp {Listening.*TCP port (\d+)} $output dummy port]} { | |
| 975 | - puts stdout "Could not detect Fossil server port, using default..." | |
| 976 | - set port 8080; # return the default port just in case | |
| 972 | + # The server prints its port in a line such as "Listening for HTTP | |
| 973 | + # requests on TCP port localhost:8081, IPv4 and IPv6". | |
| 974 | + set port "" | |
| 975 | + for {set i 0} {$i < 100 && $port eq ""} {incr i} { | |
| 976 | + after 100 | |
| 977 | + set output [read_file $outFileName] | |
| 978 | + regexp -line {Listening for .+ requests on (?:TCP port )?(?:\S*:)?(\d+)} \ | |
| 979 | + $output -> port | |
| 980 | + } | |
| 981 | + if {$port eq ""} { | |
| 982 | + test_stop_server $stopArg $pid $outFileName | |
| 983 | + error "fossil server did not report its port: $output" | |
| 977 | 984 | } |
| 978 | 985 | return [list $pid $port $outFileName] |
| 979 | 986 | } |
| 980 | 987 | |
| 981 | 988 | # This procedure stops a Fossil server instance that was previously started |
| 982 | 989 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -967,15 +967,22 @@ | |
| 967 | lappend command $repository >&$outFileName & |
| 968 | set pid [eval $command] |
| 969 | if {!$::is_windows} { |
| 970 | set stopArg $pid |
| 971 | } |
| 972 | after 1000; # output might not be there yet |
| 973 | set output [read_file $outFileName] |
| 974 | if {![regexp {Listening.*TCP port (\d+)} $output dummy port]} { |
| 975 | puts stdout "Could not detect Fossil server port, using default..." |
| 976 | set port 8080; # return the default port just in case |
| 977 | } |
| 978 | return [list $pid $port $outFileName] |
| 979 | } |
| 980 | |
| 981 | # This procedure stops a Fossil server instance that was previously started |
| 982 |
| --- test/tester.tcl | |
| +++ test/tester.tcl | |
| @@ -967,15 +967,22 @@ | |
| 967 | lappend command $repository >&$outFileName & |
| 968 | set pid [eval $command] |
| 969 | if {!$::is_windows} { |
| 970 | set stopArg $pid |
| 971 | } |
| 972 | # The server prints its port in a line such as "Listening for HTTP |
| 973 | # requests on TCP port localhost:8081, IPv4 and IPv6". |
| 974 | set port "" |
| 975 | for {set i 0} {$i < 100 && $port eq ""} {incr i} { |
| 976 | after 100 |
| 977 | set output [read_file $outFileName] |
| 978 | regexp -line {Listening for .+ requests on (?:TCP port )?(?:\S*:)?(\d+)} \ |
| 979 | $output -> port |
| 980 | } |
| 981 | if {$port eq ""} { |
| 982 | test_stop_server $stopArg $pid $outFileName |
| 983 | error "fossil server did not report its port: $output" |
| 984 | } |
| 985 | return [list $pid $port $outFileName] |
| 986 | } |
| 987 | |
| 988 | # This procedure stops a Fossil server instance that was previously started |
| 989 |