summaryrefslogtreecommitdiff
path: root/test/scripts/0000-Basic/0286
blob: 61c8b5173dff47a2cd4a5e6eac1445f965fe4439 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# max_rcpt and connection_max_messages (2x parallel)
need_ipv4
#
# There are deliveries in parallel in this script, and the processes that
# run in parallel may not finish in the same order on different hosts. (Indeed,
# they always seem to finish in precisely the opposite orders on Linux and
# FreeBSD.) For that reason, we do a hacked-up sort on the log file right at
# the end, to ensure that the log lines are always in the same order.
#
exim -odq a b c d e f
.
****
server PORT_S 2
220 ESMTP
EHLO
250-OK
250 HELP
MAIL FROM:
250 Sender OK
RCPT TO:
250 Recipient OK
RCPT TO:
250 Recipient OK
DATA
354 Send data
.
250 OK
MAIL FROM:
250 Sender OK
RCPT TO:
550 Recipient not OK
QUIT
250 OK
*eof
220 ESMTP
EHLO
250-OK
250 HELP
MAIL FROM:
250 Sender OK
RCPT TO:
550 Recipient not OK
RCPT TO:
250 Recipient OK
DATA
354 Send data
.
250 OK
MAIL FROM:
250 Sender OK
RCPT TO:
250 Recipient OK
DATA
354 Send data
.
250 OK
QUIT
250 OK
****
exim -q
****
exim -q
****
exim -odq a b c d e f g h
.
****
server PORT_S 2
220 ESMTP
EHLO
250-OK
250 HELP
MAIL FROM:
250 Sender OK
RCPT TO:
550 Recipient not OK
RCPT TO:
550 Recipient not OK
RSET
250 OK
MAIL FROM:
250 Sender OK
RCPT TO:
250 Recipient OK
RCPT TO:
250 Recipient OK
DATA
354 Send data
.
250 OK
QUIT
250 OK
*eof
220 ESMTP
EHLO
250-OK
250 HELP
MAIL FROM:
250 Sender OK
RCPT TO:
550 Recipient not OK
RCPT TO:
550 Recipient not OK
RSET
250 OK
MAIL FROM:
250 Sender OK
RCPT TO:
250 Recipient OK
RCPT TO:
250 Recipient OK
DATA
354 Send data
.
250 OK
QUIT
250 OK
****
exim -q
****
exim -q
****
# This is the hack to sort the log lines. Search for groups of delivery log
# lines (**, =>, and -> lines), and sort them according to the local part of
# the address.
#
sudo perl
open(IN, "DIR/spool/log/mainlog") || 
  die "Can't open DIR/spool/log/mainlog: $!\n";
@lines = <IN>;
close(IN);

for ($i = 0; $i < @lines; $i++)
  {
  next unless $lines[$i] =~ / \*\* | => | -> /;
  for ($j = $i + 1; $j < @lines; $j++)
    { last if $lines[$j] !~ / \*\* | => | -> /; }     
    
  @sublist = splice @lines, $i, $j - $i;
  @sublist = sort {
    my($x) = $a =~ /(?: \*\* | => | -> )([^@]+)/;
    my($y) = $b =~ /(?: \*\* | => | -> )([^@]+)/;
    return $x cmp $y; 
    } @sublist;
       
  splice @lines, $i, 0, @sublist;
  $i = $j; 
  }    

open (OUT, ">DIR/spool/log/mainlog") ||
  die "Can't open DIR/spool/log/mainlog: $!\n";
print OUT @lines;
close(OUT);   
****