3 # This is part of CGI::Auth::Flexible, a perl CGI authentication module.
5 # Copyright 2012,2013,2015 Ian Jackson.
6 # Copyright 2012,2013,2015 Citrix.
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.
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.
20 set testfile [lindex $argv 0]
22 switch -glob -- $testfile {
24 regsub {^tests/} $testfile {} id
25 regsub {\.at$} $id {} id
26 set tt "tests/tmp/$id"
29 set id "\[[info pid]\]"
30 set tt tests/tmp/[info pid]
35 file mkdir tests/tmp $tt
40 set env(CAFTEST_CAF) $pwd
41 set env(CAFTEST_TMP) $pwd/$tt
43 set env(CAFTEST_NOSRCDUMP) 1
44 set env(LC_ALL) en_GB.utf-8
47 log_file -a $tt/expect.log
49 proc timeout-abort {} {
51 send_log "\r\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
52 error "$id: aborting due to timeout"
58 set m "[list expect [lindex $args end]]"
65 regsub -all { } $str {\W{0,3}\w?} str
77 w3m -config /dev/null -o cgi_bin=$pwd/tests file:///cgi-bin/wrap/Tsuffix
79 expect_after timeout timeout-abort
81 epage {You need to log in}
84 proc fillformfield {value} {
88 proc submitform-expect {wanttxt} {
94 proc loginas {user {password sesame} {wanttxt ACCESSGRANTED}} {
96 fillformfield $password
98 submitform-expect $wanttxt
101 proc srcdump-prep {} {
103 set env(CAFTEST_NOSRCDUMP) 0
104 set timeout [expr {$timeout * 3}]
107 proc srcdump-save-check {} {
109 global outertar sd files
111 set outertar $tt/t-srcdump.tgz
112 set sd $tt/t-srcdump.d
114 send "\x15$outertar\r"
115 etxt "Download complete"
119 set files [exec tar -C $sd -zvxf - < $outertar]
130 if {[file exists .git]} {
131 set got(.git/objects/) 0
136 licence.data - manifest.txt {
140 foreach g [exec tar -C $sd -tf - < $sd/$f] {
142 cgi-auth-flexible.pm - .gitignore - .git/objects/ {
146 error "file $g inside $f !"
151 error "file $g inside $f outside .git !"
159 foreach g [array names got] {
161 error "file $g missing"