Mercurial > hg > nginx-tests
comparison mail_error_log.t @ 1897:38f1fd9ca3e6
Tests: unbreak reading new stderr data after eof.
Tests don't expect to stop reading redirected stderr when end of file is
reached, but rather to read new data being appended, similar to "tail -f".
The behaviour is found changed in Ubuntu 23.04's Perl 5.36, which applies
the upstream patch [1] expected for inclusion in the upcoming Perl 5.38.
The fix is to clear the filehandle's error state to continue reading.
[1] https://github.com/Perl/perl5/commit/80c1f1e45e8e
Updated mail_error_log.t and stream_error_log.t for consistency.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Mon, 29 May 2023 17:27:11 +0400 |
parents | ce4a06d72256 |
children |
comparison
equal
deleted
inserted
replaced
1896:8b74936ff2ac | 1897:38f1fd9ca3e6 |
---|---|
142 | 142 |
143 sub lines { | 143 sub lines { |
144 my ($t, $file, $pattern) = @_; | 144 my ($t, $file, $pattern) = @_; |
145 | 145 |
146 if ($file eq 'stderr') { | 146 if ($file eq 'stderr') { |
147 return map { $_ =~ /\Q$pattern\E/ } (<$stderr>); | 147 my $value = map { $_ =~ /\Q$pattern\E/ } (<$stderr>); |
148 $stderr->clearerr(); | |
149 return $value; | |
148 } | 150 } |
149 | 151 |
150 my $path = $t->testdir() . '/' . $file; | 152 my $path = $t->testdir() . '/' . $file; |
151 open my $fh, '<', $path or return "$!"; | 153 open my $fh, '<', $path or return "$!"; |
152 my $value = map { $_ =~ /\Q$pattern\E/ } (<$fh>); | 154 my $value = map { $_ =~ /\Q$pattern\E/ } (<$fh>); |