Mercurial > hg > nginx-tests
annotate mail_error_log.t @ 1951:1867428f1673
Tests: fixed h3_limit_req.t spurious failures.
In the "reset stream - cancellation" test, HTTP/3 stream is closed without
sending the request body when the request is waiting in the limit_req
module, and this results in error 444. However, when the request is received
with some minor delay due to system load, it is not delayed by limit_req,
and the stream is closed during reading the request body, which results
in error 400 instead, breaking the test.
Fix is to introduce yet another request before the "reset stream" test,
so the stream in question is always delayed by limit_req.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 14 Mar 2024 02:25:49 +0300 |
parents | 38f1fd9ca3e6 |
children |
rev | line source |
---|---|
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
2 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
3 # (C) Sergey Kandaurov |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
4 # (C) Nginx, Inc. |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
5 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
6 # Tests for nginx mail imap module, error_log directive. |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
7 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
8 ############################################################################### |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
9 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
10 use warnings; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
11 use strict; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
12 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
13 use Test::More; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
14 |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
15 use IO::Select; |
1600
b61e820caa83
Tests: using Sys::Hostname to get hostname in a portable way.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1237
diff
changeset
|
16 use Sys::Hostname; |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
17 |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
18 BEGIN { use FindBin; chdir($FindBin::Bin); } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
19 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
20 use lib 'lib'; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
21 use Test::Nginx; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
22 use Test::Nginx::IMAP; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
23 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
24 ############################################################################### |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
25 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
26 select STDERR; $| = 1; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
27 select STDOUT; $| = 1; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
28 |
1856
ce4a06d72256
Tests: SIGPIPE handling in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
29 local $SIG{PIPE} = 'IGNORE'; |
ce4a06d72256
Tests: SIGPIPE handling in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1679
diff
changeset
|
30 |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
31 plan(skip_all => 'win32') if $^O eq 'MSWin32'; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
32 |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
33 my $t = Test::Nginx->new()->has(qw/mail imap http rewrite/); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
34 |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
35 $t->plan(30)->write_file_expand('nginx.conf', <<'EOF'); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
36 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
37 %%TEST_GLOBALS%% |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
38 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
39 error_log %%TESTDIR%%/e_glob.log info; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
40 error_log %%TESTDIR%%/e_glob2.log info; |
1237
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
41 error_log syslog:server=127.0.0.1:%%PORT_8981_UDP%% info; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
42 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
43 daemon off; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
44 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
45 events { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
46 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
47 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
48 mail { |
1679
74986ebee2fd
Tests: added proxy_timeout in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
1600
diff
changeset
|
49 proxy_timeout 15s; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
50 auth_http http://127.0.0.1:8080/mail/auth; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
51 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
52 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
53 listen 127.0.0.1:8143; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
54 protocol imap; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
55 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
56 error_log %%TESTDIR%%/e_debug.log debug; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
57 error_log %%TESTDIR%%/e_info.log info; |
1237
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
58 error_log syslog:server=127.0.0.1:%%PORT_8982_UDP%% info; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
59 error_log stderr info; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
60 } |
570
f7bc1f74970a
Tests: avoid send errors in syslog tests with mail error_log.
Sergey Kandaurov <pluknet@nginx.com>
parents:
569
diff
changeset
|
61 |
f7bc1f74970a
Tests: avoid send errors in syslog tests with mail error_log.
Sergey Kandaurov <pluknet@nginx.com>
parents:
569
diff
changeset
|
62 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
63 listen 127.0.0.1:8145; |
570
f7bc1f74970a
Tests: avoid send errors in syslog tests with mail error_log.
Sergey Kandaurov <pluknet@nginx.com>
parents:
569
diff
changeset
|
64 protocol imap; |
f7bc1f74970a
Tests: avoid send errors in syslog tests with mail error_log.
Sergey Kandaurov <pluknet@nginx.com>
parents:
569
diff
changeset
|
65 |
1237
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
66 error_log syslog:server=127.0.0.1:%%PORT_8983_UDP%% info; |
570
f7bc1f74970a
Tests: avoid send errors in syslog tests with mail error_log.
Sergey Kandaurov <pluknet@nginx.com>
parents:
569
diff
changeset
|
67 } |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
68 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
69 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
70 http { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
71 %%TEST_GLOBALS_HTTP%% |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
72 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
73 server { |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
74 listen 127.0.0.1:8080; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
75 server_name localhost; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
76 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
77 location = /mail/auth { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
78 add_header Auth-Status OK; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
79 add_header Auth-Server 127.0.0.1; |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
80 add_header Auth-Port %%PORT_8144%%; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
81 add_header Auth-Wait 1; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
82 return 204; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
83 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
84 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
85 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
86 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
87 EOF |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
88 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
89 open OLDERR, ">&", \*STDERR; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
90 open STDERR, '>', $t->testdir() . '/stderr' or die "Can't reopen STDERR: $!"; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
91 open my $stderr, '<', $t->testdir() . '/stderr' |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
92 or die "Can't open stderr file: $!"; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
93 |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
94 $t->run_daemon(\&Test::Nginx::IMAP::imap_test_daemon); |
1237
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
95 $t->run_daemon(\&syslog_daemon, port(8981), $t, 's_glob.log'); |
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
96 $t->run_daemon(\&syslog_daemon, port(8982), $t, 's_info.log'); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
97 |
976
a8b8dd6e8ae1
Tests: changed startup order in mail tests for consistency.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
970
diff
changeset
|
98 $t->waitforsocket('127.0.0.1:' . port(8144)); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
99 $t->waitforfile($t->testdir . '/s_glob.log'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
100 $t->waitforfile($t->testdir . '/s_info.log'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
101 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
102 $t->run(); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
103 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
104 open STDERR, ">&", \*OLDERR; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
105 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
106 ############################################################################### |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
107 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
108 my $s = Test::Nginx::IMAP->new(); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
109 $s->ok('greeting'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
110 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
111 # error_log levels |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
112 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
113 SKIP: { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
114 skip "no --with-debug", 1 unless $t->has_module('--with-debug'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
115 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
116 isnt(lines($t, 'e_debug.log', '[debug]'), 0, 'file debug in debug'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
117 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
118 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
119 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
120 isnt(lines($t, 'e_info.log', '[info]'), 0, 'file info in info'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
121 is(lines($t, 'e_info.log', '[debug]'), 0, 'file debug in info'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
122 isnt(lines($t, 'stderr', '[info]'), 0, 'stderr info in info'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
123 is(lines($t, 'stderr', '[debug]'), 0, 'stderr debug in info'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
124 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
125 # multiple error_log |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
126 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
127 like($t->read_file('e_glob.log'), qr!nginx/[.0-9]+!, 'error global'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
128 like($t->read_file('e_glob2.log'), qr!nginx/[.0-9]+!, 'error global 2'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
129 is_deeply(levels($t, 'e_glob.log'), levels($t, 'e_glob2.log'), |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
130 'multiple error global'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
131 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
132 # syslog |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
133 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
134 parse_syslog_message('syslog', get_syslog()); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
135 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
136 is_deeply(levels($t, 's_glob.log'), levels($t, 'e_glob.log'), |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
137 'global syslog messages'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
138 is_deeply(levels($t, 's_info.log'), levels($t, 'e_info.log'), |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
139 'mail syslog messages'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
140 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
141 ############################################################################### |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
142 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
143 sub lines { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
144 my ($t, $file, $pattern) = @_; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
145 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
146 if ($file eq 'stderr') { |
1897
38f1fd9ca3e6
Tests: unbreak reading new stderr data after eof.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1856
diff
changeset
|
147 my $value = map { $_ =~ /\Q$pattern\E/ } (<$stderr>); |
38f1fd9ca3e6
Tests: unbreak reading new stderr data after eof.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1856
diff
changeset
|
148 $stderr->clearerr(); |
38f1fd9ca3e6
Tests: unbreak reading new stderr data after eof.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1856
diff
changeset
|
149 return $value; |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
150 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
151 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
152 my $path = $t->testdir() . '/' . $file; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
153 open my $fh, '<', $path or return "$!"; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
154 my $value = map { $_ =~ /\Q$pattern\E/ } (<$fh>); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
155 close $fh; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
156 return $value; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
157 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
158 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
159 sub levels { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
160 my ($t, $file) = @_; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
161 my %levels_hash; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
162 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
163 map { $levels_hash{$_}++; } ($t->read_file($file) =~ /(\[\w+\])/g); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
164 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
165 return \%levels_hash; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
166 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
167 |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
168 sub get_syslog { |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
169 my $data = ''; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
170 my ($s); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
171 |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
172 eval { |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
173 local $SIG{ALRM} = sub { die "timeout\n" }; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
174 local $SIG{PIPE} = sub { die "sigpipe\n" }; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
175 alarm(1); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
176 $s = IO::Socket::INET->new( |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
177 Proto => 'udp', |
1237
e4974af3fb12
Tests: adjusted udp ports to match allocated ports range.
Andrey Zelenkov <zelenkov@nginx.com>
parents:
1020
diff
changeset
|
178 LocalAddr => '127.0.0.1:' . port(8983) |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
179 ); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
180 alarm(0); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
181 }; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
182 alarm(0); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
183 if ($@) { |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
184 log_in("died: $@"); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
185 return undef; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
186 } |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
187 |
970
c227348453db
Tests: simplified parallel modifications in mail tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
952
diff
changeset
|
188 Test::Nginx::IMAP->new(PeerAddr => '127.0.0.1:' . port(8145))->read(); |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
189 |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
190 IO::Select->new($s)->can_read(1.5); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
191 while (IO::Select->new($s)->can_read(0.1)) { |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
192 my $buffer; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
193 sysread($s, $buffer, 4096); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
194 $data .= $buffer; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
195 } |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
196 $s->close(); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
197 return $data; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
198 } |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
199 |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
200 sub parse_syslog_message { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
201 my ($desc, $line) = @_; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
202 |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
203 ok($line, $desc); |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
204 |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
205 SKIP: { |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
206 skip "$desc timeout", 18 unless $line; |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
207 |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
208 my @months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
209 'Sep', 'Oct', 'Nov', 'Dec'); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
210 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
211 my ($pri, $mon, $mday, $hour, $minute, $sec, $host, $tag, $msg) = |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
212 $line =~ /^<(\d{1,3})> # PRI |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
213 ([A-Z][a-z]{2})\s # mon |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
214 ([ \d]\d)\s(\d{2}):(\d{2}):(\d{2})\s # date |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
215 ([\S]*)\s # host |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
216 (\w{1,32}):\s # tag |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
217 (.*)/x; # MSG |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
218 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
219 my $sev = $pri & 0x07; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
220 my $fac = ($pri & 0x03f8) >> 3; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
221 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
222 ok(defined($pri), "$desc has PRI"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
223 ok($sev >= 0 && $sev <= 7, "$desc valid severity"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
224 ok($fac >= 0 && $fac < 24, "$desc valid facility"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
225 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
226 ok(defined($mon), "$desc has month"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
227 ok((grep $mon, @months), "$desc valid month"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
228 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
229 ok(defined($mday), "$desc has day"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
230 ok($mday <= 31, "$desc valid day"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
231 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
232 ok(defined($hour), "$desc has hour"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
233 ok($hour < 24, "$desc valid hour"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
234 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
235 ok(defined($minute), "$desc has minutes"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
236 ok($minute < 60, "$desc valid minutes"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
237 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
238 ok(defined($sec), "$desc has seconds"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
239 ok($sec < 60, "$desc valid seconds"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
240 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
241 ok(defined($host), "$desc has host"); |
1600
b61e820caa83
Tests: using Sys::Hostname to get hostname in a portable way.
Sergey Kandaurov <pluknet@nginx.com>
parents:
1237
diff
changeset
|
242 is($host, lc(hostname()), "$desc valid host"); |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
243 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
244 ok(defined($tag), "$desc has tag"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
245 like($tag, qr'\w+', "$desc valid tag"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
246 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
247 ok(length($msg) > 0, "$desc valid CONTENT"); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
248 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
249 |
569
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
250 } |
adbb9b5108aa
Tests: fixed mail error_log test timeouts similar to 22bade4c7e12.
Sergey Kandaurov <pluknet@nginx.com>
parents:
564
diff
changeset
|
251 |
564
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
252 ############################################################################### |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
253 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
254 sub syslog_daemon { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
255 my ($port, $t, $file) = @_; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
256 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
257 my $s = IO::Socket::INET->new( |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
258 Proto => 'udp', |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
259 LocalAddr => "127.0.0.1:$port" |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
260 ); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
261 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
262 open my $fh, '>', $t->testdir() . '/' . $file; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
263 select $fh; $| = 1; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
264 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
265 while (1) { |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
266 my $buffer; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
267 $s->recv($buffer, 4096); |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
268 print $fh $buffer . "\n"; |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
269 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
270 } |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
271 |
a1c93746570d
Tests: mail error_log tests.
Sergey Kandaurov <pluknet@nginx.com>
parents:
diff
changeset
|
272 ############################################################################### |