From c9cf025fadfe043f0f2f679e10d1207d8a158bb6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:01:31 +0200 Subject: Adding debian version 2.4.57-2. Signed-off-by: Daniel Baumann --- .../Apache-Test/t/log_watch_for_broken_lines.t | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 debian/perl-framework/Apache-Test/t/log_watch_for_broken_lines.t (limited to 'debian/perl-framework/Apache-Test/t/log_watch_for_broken_lines.t') diff --git a/debian/perl-framework/Apache-Test/t/log_watch_for_broken_lines.t b/debian/perl-framework/Apache-Test/t/log_watch_for_broken_lines.t new file mode 100644 index 0000000..108e10c --- /dev/null +++ b/debian/perl-framework/Apache-Test/t/log_watch_for_broken_lines.t @@ -0,0 +1,40 @@ +#!perl + +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil qw/t_start_file_watch t_file_watch_for + t_cmp t_catfile t_append_file/; + +plan tests => 5, need_fork; + +my $fn=t_catfile(Apache::Test::vars->{t_logs}, 'watch'); +unlink $fn; + +t_start_file_watch 'watch'; + +my $pid; +select undef, undef, undef, 0.1 until defined($pid=fork); +unless ($pid) { # child + t_append_file $fn, "\nhuhu\n4 5 6 \nblabla\n"; + for(1..3) { + select undef, undef, undef, 0.3; + t_append_file $fn, "$_ "; + } + t_append_file $fn, "\nhuhu\n4 5 6 \nblabla"; + exit 0; +} + +ok t_cmp t_file_watch_for('watch', qr/^1 2 3 $/, 2), + "1 2 3 \n", 'incomplete line'; + +my @lines=t_file_watch_for('watch', qr/^\d \d \d $/, 2); +ok t_cmp @lines, 2, '2 lines'; +ok t_cmp $lines[0], "huhu\n", '1st line'; +ok t_cmp $lines[1], "4 5 6 \n", 'found it'; + +ok t_cmp t_file_watch_for('watch', qr/^\d \d \d $/, 0.3), + undef, 'timeout'; + +waitpid $pid, 0; -- cgit v1.2.3