From e1b070276d8c8beb0dcc76bc2c2ac070564e0c24 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 7 Mar 2012 02:21:48 -0600 Subject: make the test suite more reliable --- lib/Term/Filter.pm | 5 +---- t/basic.t | 2 +- t/callbacks.t | 9 ++++++++- t/extra-pty.t | 7 +++++-- t/role.t | 9 ++++++++- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/Term/Filter.pm b/lib/Term/Filter.pm index 8f4fc32..3106bab 100644 --- a/lib/Term/Filter.pm +++ b/lib/Term/Filter.pm @@ -344,10 +344,7 @@ no Moose::Util::TypeConstraints; =head1 BUGS -The test suite is a bit flaky, due to it being hard to test orderings of things -between multiple layers of read/write syscalls across multiple processes. As -far as I can tell, the module itself works fine, but may just get some false -negative test results on occasion. Need to fix this eventually. +No known bugs. Please report any bugs through RT: email C, or browse to diff --git a/t/basic.t b/t/basic.t index 13e77f3..4c72512 100644 --- a/t/basic.t +++ b/t/basic.t @@ -18,7 +18,7 @@ SCRIPT my $crlf = "\x0d\x0a"; -$pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); +$pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); # just in case alarm 60; diff --git a/t/callbacks.t b/t/callbacks.t index cb99c18..250fec7 100644 --- a/t/callbacks.t +++ b/t/callbacks.t @@ -49,7 +49,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); my $setup_str = full_read($pty); @@ -73,12 +73,19 @@ alarm 60; ^ MUNGE_INPUT: \s \Q$term_str\E \s \($ref\): \s fOo\n \n + (?: MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf + | + MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf FOO$crlf + \n + foo$crlf + foo$crlf + ) $ }sx, "munge_input and munge_output got the right arguments" diff --git a/t/extra-pty.t b/t/extra-pty.t index d2e013a..8393f4f 100644 --- a/t/extra-pty.t +++ b/t/extra-pty.t @@ -70,7 +70,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); open my $readfh, '>', $readp or die "can't open pipe (parent): $!"; @@ -87,7 +87,10 @@ alarm 60; sysread($writefh, $buf, 21); is($buf, "read from term: foo$crlf"); sysread($writefh, $buf, 21); - is($buf, "read from term: foo$crlf"); + # note that this could either happen as a second write, or as part + # of the first write (in which case, this read finishes reading + # the rest of the data that was sent previously) + like($buf, qr/^(?:read from term: )?foo\Q$crlf\E$/); } syswrite($readfh, "bar"); diff --git a/t/role.t b/t/role.t index e8e9806..25cfec0 100644 --- a/t/role.t +++ b/t/role.t @@ -58,7 +58,7 @@ alarm 60; { my $pty = IO::Pty::Easy->new(handle_pty_size => 0); - $pty->spawn($^X, (map { "-I $_" } @INC), '-e', $script); + $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $script); my $setup_str = full_read($pty); @@ -82,12 +82,19 @@ alarm 60; ^ MUNGE_INPUT: \s \Q$term_str\E \s \($ref\): \s fOo\n \n + (?: MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf \n foo$crlf + | + MUNGE_OUTPUT: \s \Q$term_str\E \s \($ref\): \s FOO$crlf FOO$crlf + \n + foo$crlf + foo$crlf + ) $ }sx, "munge_input and munge_output got the right arguments" -- cgit v1.2.3