Fossil

Check-in [b66d5bca]
Login

Check-in [b66d5bca]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update test_start_server procedure to return the port as well because fossil server dynamically allocates a port.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b66d5bca70d9052c06c50607a49e81b7d2653f33
User & Date: andybradford 2016-10-14 19:04:53
Context
2016-10-14
19:35
Adjustments to the 'test_start_server' Fossil test suite procedure to make it work better on Windows. ... (check-in: a88ca0d7 user: mistachkin tags: trunk)
19:04
Update test_start_server procedure to return the port as well because fossil server dynamically allocates a port. ... (check-in: b66d5bca user: andybradford tags: trunk)
14:32
Update the built-in SQLite to version 3.15.0 final. ... (check-in: 4a0c9483 user: drh tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/tester.tcl.

747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762
763
764
765
766
767


768
769
770
771
772





773
774
775
776
777
778
779
780
    }
    append out \n$line
  }
  return [string range $out 1 end]
}

# This procedure executes the "fossil server" command.  The return value

# is the new process identifier.  The varName argument refers to a variable
# where the "stop argument" is to be stored.  This value must eventually be
# passed to the [test_stop_server] procedure.
proc test_start_server { repository {varName ""} } {
  global fossilexe
  set command [list exec $fossilexe server]
  if {[string length $varName] > 0} {
    upvar 1 $varName stopArg
  }
  if {$::tcl_platform(platform) eq "windows"} {
    set stopArg [file join [getTemporaryPath] [appendArgs \
        [string trim [clock seconds] -] _ [getSeqNo] .stopper]]
    lappend command --stopper $stopArg
  }


  lappend command $repository &
  set pid [eval $command]
  if {$::tcl_platform(platform) ne "windows"} {
    set stopArg $pid
  }





  return $pid
}

# This procedure stops a Fossil server instance that was previously started
# by the [test_start_server] procedure.  The value of the "stop argument"
# will vary by platform as will the exact method used to stop the server.
proc test_stop_server { stopArg pid } {
  if {$::tcl_platform(platform) eq "windows"} {







>
|



|









>
>
|




>
>
>
>
>
|







747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
    }
    append out \n$line
  }
  return [string range $out 1 end]
}

# This procedure executes the "fossil server" command.  The return value
# is a list comprised of the new process identifier and the port on which
# the server started.  The varName argument refers to a variable
# where the "stop argument" is to be stored.  This value must eventually be
# passed to the [test_stop_server] procedure.
proc test_start_server { repository {varName ""} } {
  global fossilexe tempHomePath
  set command [list exec $fossilexe server]
  if {[string length $varName] > 0} {
    upvar 1 $varName stopArg
  }
  if {$::tcl_platform(platform) eq "windows"} {
    set stopArg [file join [getTemporaryPath] [appendArgs \
        [string trim [clock seconds] -] _ [getSeqNo] .stopper]]
    lappend command --stopper $stopArg
  }
  set tmpFile [file join $tempHomePath [appendArgs \
      uvtest_ [string trim [clock seconds] -] _ [getSeqNo]]].out
  lappend command $repository >&$tmpFile &
  set pid [eval $command]
  if {$::tcl_platform(platform) ne "windows"} {
    set stopArg $pid
  }
  after 1000; # output might not be there yet
  set output [read_file $tmpFile]
  catch {file delete $tmpFile}
  set port 8080; # return the default port just in case
  regexp {Listening.*TCP port (\d+)} $output m port
  return [list $pid $port]
}

# This procedure stops a Fossil server instance that was previously started
# by the [test_start_server] procedure.  The value of the "stop argument"
# will vary by platform as will the exact method used to stop the server.
proc test_stop_server { stopArg pid } {
  if {$::tcl_platform(platform) eq "windows"} {

Changes to test/unversioned.test.

303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318

319
320
321
322
323
324
325
{^[0-9a-f]{12} 2016-10-01 00:00:00       30       30 unversioned2\.txt
[0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}       28       28\
unversioned5\.txt$} [normalize_result]]}

###############################################################################

set password [string trim [clock seconds] -]
set remote [appendArgs http://uvtester: $password @localhost:8080/]

fossil user new uvtester "Unversioned Test User" $password
fossil user capabilities uvtester oy

###############################################################################

set pid [test_start_server $repository stopArg]
puts [appendArgs "Started Fossil server, pid \"" $pid \".]


###############################################################################

set clientDir [file join $tempPath [appendArgs \
    uvtest_ [string trim [clock seconds] -] _ [getSeqNo]]]

set savedPwd [pwd]







<






|
|
>







303
304
305
306
307
308
309

310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
{^[0-9a-f]{12} 2016-10-01 00:00:00       30       30 unversioned2\.txt
[0-9a-f]{12} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}       28       28\
unversioned5\.txt$} [normalize_result]]}

###############################################################################

set password [string trim [clock seconds] -]


fossil user new uvtester "Unversioned Test User" $password
fossil user capabilities uvtester oy

###############################################################################

foreach {pid port} [test_start_server $repository stopArg] {}
puts [appendArgs "Started Fossil server, pid \"" $pid \" ", port \"" $port \".]
set remote [appendArgs http://uvtester: $password @localhost: $port /]

###############################################################################

set clientDir [file join $tempPath [appendArgs \
    uvtest_ [string trim [clock seconds] -] _ [getSeqNo]]]

set savedPwd [pwd]