(sieve_test): Pass --email and --mailer options to sieve.
(sieve_driver_test): New procedure.
Showing
1 changed file
with
53 additions
and
1 deletions
... | @@ -27,9 +27,11 @@ set env(MAIL) $MU_SPOOL_DIR/sieve.mbox | ... | @@ -27,9 +27,11 @@ set env(MAIL) $MU_SPOOL_DIR/sieve.mbox |
27 | # [ARGS...][-pattern PATTERN...] | 27 | # [ARGS...][-pattern PATTERN...] |
28 | proc sieve_test {args} { | 28 | proc sieve_test {args} { |
29 | global sieve_source_dir | 29 | global sieve_source_dir |
30 | global top_builddir | ||
30 | 31 | ||
31 | set default "" | 32 | set default "" |
32 | set sw [list "-M none"] | 33 | set sw [list "-M sendmail:$top_builddir/examples/mta" \ |
34 | "--email foobar@nonexistent.net"] | ||
33 | set reuse_spool 0 | 35 | set reuse_spool 0 |
34 | for {set i 0} {$i < [llength $args]} {incr i} { | 36 | for {set i 0} {$i < [llength $args]} {incr i} { |
35 | set a [lindex $args $i] | 37 | set a [lindex $args $i] |
... | @@ -76,3 +78,53 @@ proc sieve_test {args} { | ... | @@ -76,3 +78,53 @@ proc sieve_test {args} { |
76 | #FIXME: examine the output mailbox | 78 | #FIXME: examine the output mailbox |
77 | } | 79 | } |
78 | 80 | ||
81 | proc sieve_driver_test {name mailer diag} { | ||
82 | global srcdir | ||
83 | set chan [open "${srcdir}/$name" r] | ||
84 | |||
85 | set state 0 | ||
86 | set command "" | ||
87 | for {gets $chan line} {![eof $chan]} {gets $chan line} { | ||
88 | verbose "LINE $line" 1 | ||
89 | switch -regexp -- "$line" { | ||
90 | "^#.*" { } | ||
91 | "^TEST END" { | ||
92 | verbose "ARGS $args" 1 | ||
93 | verbose "PATTERN $pattern" 1 | ||
94 | verbose "OUTPUT $output" 1 | ||
95 | eval sieve_test $args -pattern $pattern | ||
96 | eval mu_test_file "$diag" $output | ||
97 | set state 0 | ||
98 | } | ||
99 | "^TEST" { | ||
100 | regexp "^TEST (.*)" $line dummy args | ||
101 | set pattern [list] | ||
102 | set output [list] | ||
103 | set state 1 | ||
104 | } | ||
105 | "^PATTERN BEGIN" { | ||
106 | set state 2 | ||
107 | } | ||
108 | "^PATTERN END" { | ||
109 | set state 1 | ||
110 | } | ||
111 | "^FILE BEGIN" { | ||
112 | set state 3 | ||
113 | } | ||
114 | "^FILE END" { | ||
115 | set state 1 | ||
116 | } | ||
117 | "^STOP" { | ||
118 | break | ||
119 | } | ||
120 | default { | ||
121 | if {$state == 2} { | ||
122 | lappend pattern $line | ||
123 | } elseif {$state == 3} { | ||
124 | lappend output $line | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | } | ||
129 | close $chan | ||
130 | } | ... | ... |
-
Please register or sign in to post a comment