diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 2006-12-12 15:28:25 -0800 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2006-12-13 19:53:02 +0000 |
commit | 713cef20be507239588df9cdc5f99ce04b7e0b40 (patch) | |
tree | 00549fe2cfdf237bcf2e21de1c56a041f532ad4c /t/io | |
parent | 4d28fe79573bb61e3777837866812631f24ed631 (diff) | |
download | perl-713cef20be507239588df9cdc5f99ce04b7e0b40.tar.gz |
Text mode wrongly set on pipe file descriptors
Message-ID: <20061213072825.GA26300@powdermilk.math.berkeley.edu>
p4raw-id: //depot/perl@29550
Diffstat (limited to 't/io')
-rwxr-xr-x | t/io/pipe.t | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/t/io/pipe.t b/t/io/pipe.t index d411719fff..68e910028c 100755 --- a/t/io/pipe.t +++ b/t/io/pipe.t @@ -10,7 +10,7 @@ BEGIN { skip_all("fork required to pipe"); } else { - plan(tests => 22); + plan(tests => 24); } } @@ -30,7 +30,7 @@ close PIPE; SKIP: { # Technically this should be TODO. Someone try it if you happen to # have a vmesa machine. - skip "Doesn't work here yet", 4 if $^O eq 'vmesa'; + skip "Doesn't work here yet", 6 if $^O eq 'vmesa'; if (open(PIPE, "-|")) { while(<PIPE>) { @@ -50,6 +50,49 @@ SKIP: { # This has to be *outside* the fork next_test() for 1..2; + my $raw = "abc\nrst\rxyz\r\nfoo\n"; + if (open(PIPE, "-|")) { + $_ = join '', <PIPE>; + (my $raw1 = $_) =~ s/not ok \d+ - //; + my @r = map ord, split //, $raw; + my @r1 = map ord, split //, $raw1; + if ($raw1 eq $raw) { + s/^not (ok \d+ -) .*/$1 '@r1' passes through '-|'\n/s; + } else { + s/^(not ok \d+ -) .*/$1 expect '@r', got '@r1'\n/s; + } + print; + close PIPE; # avoid zombies + } + else { + printf STDOUT "not ok %d - $raw", curr_test(); + exec $Perl, '-e0'; # Do not run END()... + } + + # This has to be *outside* the fork + next_test(); + + if (open(PIPE, "|-")) { + printf PIPE "not ok %d - $raw", curr_test(); + close PIPE; # avoid zombies + } + else { + $_ = join '', <STDIN>; + (my $raw1 = $_) =~ s/not ok \d+ - //; + my @r = map ord, split //, $raw; + my @r1 = map ord, split //, $raw1; + if ($raw1 eq $raw) { + s/^not (ok \d+ -) .*/$1 '@r1' passes through '|-'\n/s; + } else { + s/^(not ok \d+ -) .*/$1 expect '@r', got '@r1'\n/s; + } + print; + exec $Perl, '-e0'; # Do not run END()... + } + + # This has to be *outside* the fork + next_test(); + SKIP: { skip "fork required", 2 unless $Config{d_fork}; |