chiark / gitweb /
Testing: Rename srcdump-loginback.at (from srcdump.at)
[cgi-auth-flexible.git] / tests / srcdump-loginback.at
1 # -*- Tcl -*-
2
3 # This is part of CGI::Auth::Flexible, a perl CGI authentication module.
4 #
5 # Copyright 2012,2013,2015 Ian Jackson.
6 # Copyright 2012,2013,2015 Citrix.
7 #
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version, with the "CAF Login Exception"
12 # as published by Ian Jackson (version 1, or at your option any 
13 # later version) as an Additional Permission.
14 #
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU Affero General Public License for more details.
19
20 set env(CAFTEST_NOSRCDUMP) 0
21
22 set timeout [expr {$timeout * 3}]
23
24 dospawn
25
26 loginas alice
27
28 send "B/source available\r\r"
29
30 etxt "Save file to"
31
32 set outertar $tt/t-srcdump.tgz
33 set sd $tt/t-srcdump.d
34
35 send "\x15$outertar\r"
36 etxt "Download complete"
37
38 exec mkdir $sd
39
40 set files [exec tar -C $sd -zvxf - < $outertar]
41
42 foreach f {
43     manifest.txt
44     licence.data       
45     cgi-auth-flexible.pm
46     .gitignore
47 } {
48     set got($f) 0
49 }
50
51 if {[file exists .git]} {
52     set got(.git/objects/) 0
53 }
54
55 foreach f $files {
56     switch -glob -- $f {
57         licence.data - manifest.txt {
58             set got($f) 1
59         }
60         *.tar {
61             foreach g [exec tar -C $sd -tf - < $sd/$f] {
62                 switch -glob -- $g {
63                     cgi-auth-flexible.pm - .gitignore - .git/objects/ {
64                         set got($g) 1
65                     }
66                     *~ {
67                         error "file $g inside $f !"
68                     }
69                     .git/* {
70                     }
71                     *.db {
72                         error "file $g inside $f outside .git !"
73                     }
74                 }
75             }
76         }
77     }
78 }
79
80 foreach g [array names got] {
81     if {!$got($g)} {
82         error "file $g missing"
83     }
84 }