Fossil

Check-in [bf62b160]
Login

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

Overview
Comment:Added quick checks to verify that the manifest and manifest.uuid files have sensible content, at least for the initial empty checkin. This does require that an SHA1 module be installed for use by the test harness, which I am slightly surprised was not already needed by any other test case.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | jan-manifest-tags
Files: files | file ages | folders
SHA1:bf62b1608c62eab08762f4dfa9fd789db6356948
User & Date: rberteig 2016-08-08 19:37:21
Context
2016-08-08
21:42
Two manifest.tags changes: 1) Unconditionally add branch. 2) Change the format to explicitly state tag or branch entry. check-in: 0925f75a user: jan tags: jan-manifest-tags
19:37
Added quick checks to verify that the manifest and manifest.uuid files have sensible content, at least for the initial empty checkin. This does require that an SHA1 module be installed for use by the test harness, which I am slightly surprised was not already needed by any other test case. check-in: bf62b160 user: rberteig tags: jan-manifest-tags
14:44
Merge updates from trunk. check-in: f63576a7 user: drh tags: jan-manifest-tags
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/set-manifest.test.

13
14
15
16
17
18
19






20
21
22
23
24
25
26
..
51
52
53
54
55
56
57

















58
59
60
61
62
63
64
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
############################################################################
#
# Test manifest setting
#







proc file_contains {fname match} {
  set fp [open $fname r]
  set contents [read $fp]
  close $fp
  set lines [split $contents "\n"]
  foreach line $lines {
................................................................................
  test "set-manifest-2-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
  set filelist [glob manifest*]
  test "set-manifest-2-$v-n" {[llength $filelist] == 2} 
  foreach f $filelist {
    test "set-manifest-2-$v-f-$f" {[file isfile $f]}
  }
}


















# Classic behavior: FALSE value removes manifest and manifest.uuid
set falses [list false off 0]
foreach v $falses {
  fossil settings manifest $v
  test "set-manifest-3-$v" {$RESULT eq ""}
  fossil settings manifest 







>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
..
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#   drh@hwaci.com
#   http://www.hwaci.com/drh/
#
############################################################################
#
# Test manifest setting
#

# We need SHA1 to effectively test the manifest files produced by 
# fossil. It looks like the one from tcllib is exactly what we need.
# On ActiveTcl, add it with teacup. On other platforms, YMMV.
# teacup install sha1
package require sha1

proc file_contains {fname match} {
  set fp [open $fname r]
  set contents [read $fp]
  close $fp
  set lines [split $contents "\n"]
  foreach line $lines {
................................................................................
  test "set-manifest-2-$v-a" {[regexp "^manifest\\s+\\(local\\)\\s+$v\\s*$" $RESULT]}
  set filelist [glob manifest*]
  test "set-manifest-2-$v-n" {[llength $filelist] == 2} 
  foreach f $filelist {
    test "set-manifest-2-$v-f-$f" {[file isfile $f]}
  }
}

# ... and manifest.uuid is the checkout's hash
fossil info
regexp {(?m)^checkout:\s+([0-9a-f]{40})\s.*$} $RESULT ckoutline ckid
set uuid [string trim [read_file "manifest.uuid"]]
test "set-manifest-2-uuid" {$ckid eq $uuid}

# ... which is also the SHA1 of the file "manifest" before it was
# sterilized by appending an extra line when writing the file. The 
# extra text begins with # and is a full line, so we'll just strip
# it with a brute-force substitution. This probably has the right 
# effect even if the checkin was PGP-signed, but we don't have that
# setting turned on for this manifest in any case.
regsub {(?m)^#.*\n} [read_file "manifest"] "" manifest
set muuid [::sha1::sha1 $manifest]
test "set-manifest-2-manifest" {$muuid eq $uuid}


# Classic behavior: FALSE value removes manifest and manifest.uuid
set falses [list false off 0]
foreach v $falses {
  fossil settings manifest $v
  test "set-manifest-3-$v" {$RESULT eq ""}
  fossil settings manifest