Control: tag -1 patch On Sat, Dec 17, 2016 at 01:10:42PM +0100, Santiago Vila wrote: > Package: src:libapp-termcast-perl > Version: 0.13-2 > Severity: serious
> # Failed test 'sent the right data to the server' > # at t/read-write.t line 88. > # ' > # Failed test at t/read-write.t line 61. > # got: undef > # expected: ' > > # ' > # Looks like you failed 2 tests of 5. I can reproduce this in a single CPU virtual machine, running the test case in a loop. The process at the bottom of the stack is running perl -ple 'last if /^\$/' and it looks like the race is between this process exiting and its parent (IO::Pty::Easy) having enough time to read the last echoed newline. Unfortunately it goes away with 'strace -f', so I don't have the full analysis, but the attached script reliably fixes it for me. -- Niko Tyni nt...@debian.org
>From e5aade303da7f7a249eb8dcf48c4f6c83c7b36c3 Mon Sep 17 00:00:00 2001 From: Niko Tyni <nt...@debian.org> Date: Wed, 28 Dec 2016 11:53:15 +0200 Subject: [PATCH] Fix a race condition in t/read-write.t If the script exits before IO::Pty::Easy has read its output, the final newline gets lost. This seems to mostly happen on single-CPU hosts. Just sleeping long enough (at least 2.5 or so seconds) would make IO::Pty::Easy kill the child when $pty goes out of scope, but waiting one second before exiting should be enough. Bug-Debian: https://bugs.debian.org/848408 Bug: https://github.com/doy/app-termcast/issues/3 --- t/read-write.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/read-write.t b/t/read-write.t index fe945dc..7b70271 100644 --- a/t/read-write.t +++ b/t/read-write.t @@ -35,7 +35,7 @@ test_tcp( user => 'test', password => 'tset', ); - \$tc->run(\$^X, '-ple', q[last if /^\$/]); + \$tc->run(\$^X, '-ple', q[sleep 1,last if /^\$/]); EOF my $pty = IO::Pty::Easy->new; $pty->spawn($^X, (map {; '-I', $_ } @INC), '-e', $client_script); -- 2.11.0