23 |
if ![info exists MAIL] { |
if ![info exists MAIL] { |
24 |
if ![is_remote host] { |
if ![is_remote host] { |
25 |
set MAIL [findfile $base_dir/../mail "$base_dir/../mail" [transform mail]] |
set MAIL [findfile $base_dir/../mail "$base_dir/../mail" [transform mail]] |
26 |
|
set MAIL_SPOOL_SOURCE "$srcdir/spool" |
27 |
|
set MAIL_FOLDER_SOURCE "$srcdir/folder" |
28 |
|
set MAIL_SPOOL_DIR "$objdir/data/spool" |
29 |
|
set MAIL_FOLDER_DIR "$objdir/data/folder" |
30 |
|
set MAIL_RC_DIR "$srcdir/etc" |
31 |
|
set MAKESPOOL "$srcdir/makespool" |
32 |
} else { |
} else { |
33 |
if [info exists host_board] { |
if [info exists host_board] { |
34 |
if [board_info $host_board exists top_builddir] { |
if [board_info $host_board exists top_builddir] { |
43 |
perror "Please, read file README in mail/testsuite subdirectory" |
perror "Please, read file README in mail/testsuite subdirectory" |
44 |
perror "for instructions on how to set up it." |
perror "for instructions on how to set up it." |
45 |
exit 1 |
exit 1 |
46 |
} |
} |
47 |
|
set MAIL_RC_DIR "[board_info $host_board srcdir]/etc" |
48 |
|
set MAIL_SPOOL_SOURCE "[board_info $host_board srcdir]/spool" |
49 |
|
set MAIL_FOLDER_SOURCE "[board_info $host_board srcdir]/folder" |
50 |
|
set MAIL_SPOOL_DIR "[board_info $host_board objdir]/data/spool" |
51 |
|
set MAIL_FOLDER_DIR "[board_info $host_board objdir]/data/folder" |
52 |
|
set MAKESPOOL "[board_info $host_board srcdir]/makespool" |
53 |
} |
} |
54 |
} |
} |
55 |
|
|
56 |
verbose "using MAIL = $MAIL" 2 |
verbose "using MAIL = $MAIL" 2 |
57 |
|
|
58 |
if ![info exists MAILFLAGS] { |
if ![info exists MAILFLAGS] { |
59 |
set MAILFLAGS "--nosum --norc --mail-spool $srcdir/spool" |
set MAILFLAGS "--nosum --norc --mail-spool $MAIL_SPOOL_DIR" |
60 |
} |
} |
61 |
|
|
62 |
#FIXME: |
#FIXME: this doesn't work with remote testing |
63 |
set env(MAILRC) $srcdir/etc/mail.rc |
set env(MAILRC) $MAIL_RC_DIR/mail.rc |
64 |
set env(MBOX) $srcdir/spool/mbox |
set env(MBOX) "$MAIL_SPOOL_DIR/mbox" |
65 |
|
|
66 |
# The variable mail_prompt is a regexp which matches the mail prompt. |
# The variable mail_prompt is a regexp which matches the mail prompt. |
67 |
global mail_prompt |
global mail_prompt |
71 |
|
|
72 |
### Only procedures should come after this point. |
### Only procedures should come after this point. |
73 |
|
|
74 |
|
proc mail_prepare_spools {} { |
75 |
|
global MAIL_SPOOL_SOURCE |
76 |
|
global MAIL_SPOOL_DIR |
77 |
|
global MAIL_FOLDER_SOURCE |
78 |
|
global MAIL_FOLDER_DIR |
79 |
|
global MAKESPOOL |
80 |
|
|
81 |
|
set output [remote_exec host "$MAKESPOOL \ |
82 |
|
$MAIL_SPOOL_SOURCE $MAIL_SPOOL_DIR\ |
83 |
|
$MAIL_FOLDER_SOURCE $MAIL_FOLDER_DIR"] |
84 |
|
} |
85 |
|
|
86 |
|
proc mail_cleanup_spools {} { |
87 |
|
global MAIL_SPOOL_SOURCE |
88 |
|
global MAIL_SPOOL_DIR |
89 |
|
global MAIL_FOLDER_SOURCE |
90 |
|
global MAIL_FOLDER_DIR |
91 |
|
global MAKESPOOL |
92 |
|
|
93 |
|
if { $MAIL_SPOOL_SOURCE != $MAIL_SPOOL_DIR } { |
94 |
|
set output [remote_exec host "$MAKESPOOL -r \ |
95 |
|
$MAIL_SPOOL_DIR $MAIL_FOLDER_DIR"] |
96 |
|
} |
97 |
|
} |
98 |
|
|
99 |
proc default_mail_version {} { |
proc default_mail_version {} { |
100 |
global MAIL |
global MAIL |
101 |
global MAILFLAGS |
global MAILFLAGS |
133 |
global expect_out |
global expect_out |
134 |
|
|
135 |
default_mail_version |
default_mail_version |
136 |
|
mail_prepare_spools |
137 |
|
|
138 |
set sw $args |
set sw $args |
139 |
append sw " " |
append sw " " |
140 |
|
|
145 |
} |
} |
146 |
|
|
147 |
set mail_cmd "$MAIL $MAILFLAGS $args" |
set mail_cmd "$MAIL $MAILFLAGS $args" |
148 |
verbose "MAILRC is $srcdir/etc/mail.rc" 2 |
verbose "MAILRC is $srcdir/etc/mail.rc" 2 |
149 |
verbose "Spawning $mail_cmd" |
verbose "Spawning $mail_cmd" |
150 |
|
|
151 |
set res [remote_spawn host $mail_cmd] |
set res [remote_spawn host $mail_cmd] |
169 |
proc default_mail_stop {} { |
proc default_mail_stop {} { |
170 |
|
|
171 |
verbose "Stopping mail" |
verbose "Stopping mail" |
172 |
|
|
173 |
} |
} |
174 |
|
|
175 |
proc mail_start {args} { |
proc mail_start {args} { |
194 |
proc mail_command { cmd } { |
proc mail_command { cmd } { |
195 |
set res [mail_send "$cmd\n"] |
set res [mail_send "$cmd\n"] |
196 |
mail_expect 30 { |
mail_expect 30 { |
197 |
-ex "${cmd}\r\n" { } |
-ex "\r\n" { } |
198 |
default { |
default { |
199 |
perror "mail_command for target failed"; |
perror "mail_command for target failed"; |
200 |
return -1 |
return -1 |