diff options
Diffstat (limited to 't/lib')
-rwxr-xr-x | t/lib/anydbm.t | 1 | ||||
-rwxr-xr-x | t/lib/filehand.t | 2 | ||||
-rwxr-xr-x | t/lib/gdbm.t | 1 | ||||
-rwxr-xr-x | t/lib/io_pipe.t | 39 | ||||
-rwxr-xr-x | t/lib/io_sock.t | 9 | ||||
-rwxr-xr-x | t/lib/ndbm.t | 1 | ||||
-rwxr-xr-x | t/lib/odbm.t | 1 | ||||
-rwxr-xr-x | t/lib/open2.t | 9 | ||||
-rwxr-xr-x | t/lib/open3.t | 23 | ||||
-rwxr-xr-x | t/lib/sdbm.t | 1 |
10 files changed, 62 insertions, 25 deletions
diff --git a/t/lib/anydbm.t b/t/lib/anydbm.t index 80b39df141..52ab22b13e 100755 --- a/t/lib/anydbm.t +++ b/t/lib/anydbm.t @@ -111,4 +111,5 @@ print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n"; print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n"); print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n"); +untie %h; unlink 'Op.dbmx.dir', $Dfile; diff --git a/t/lib/filehand.t b/t/lib/filehand.t index 11836f1c52..14a17704b9 100755 --- a/t/lib/filehand.t +++ b/t/lib/filehand.t @@ -64,7 +64,7 @@ print "ok 10\n"; ($rd,$wr) = FileHandle::pipe; -if ($^O eq 'VMS' || $^O eq 'os2') { +if ($^O eq 'VMS' || $^O eq 'os2' || $^O eq 'amigaos') { $wr->autoflush; $wr->printf("ok %d\n",11); print $rd->getline; diff --git a/t/lib/gdbm.t b/t/lib/gdbm.t index c888c00f85..62bb936ff1 100755 --- a/t/lib/gdbm.t +++ b/t/lib/gdbm.t @@ -114,4 +114,5 @@ print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n"; print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n"); print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n"); +untie %h; unlink 'Op.dbmx.dir', $Dfile; diff --git a/t/lib/io_pipe.t b/t/lib/io_pipe.t index 1d050ff4bd..eee374149c 100755 --- a/t/lib/io_pipe.t +++ b/t/lib/io_pipe.t @@ -1,6 +1,5 @@ #!./perl - BEGIN { unless(grep /blib/, @INC) { chdir 't' if -d 't'; @@ -12,7 +11,9 @@ use Config; BEGIN { if(-d "lib" && -f "TEST") { - if ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS') { + if (! $Config{'d_fork'} || + ($Config{'extensions'} !~ /\bIO\b/ && $^O ne 'VMS')) + { print "1..0\n"; exit 0; } @@ -21,8 +22,24 @@ BEGIN { use IO::Pipe; +my $perl = './perl'; + $| = 1; -print "1..6\n"; +print "1..10\n"; + +$pipe = new IO::Pipe->reader($perl, '-e', 'print "not ok 1\n"'); +while (<$pipe>) { + s/^not //; + print; +} +$pipe->close or print "# \$!=$!\nnot "; +print "ok 2\n"; + +$cmd = 'BEGIN{$SIG{ALRM} = sub {print "not ok 4\n"; exit}; alarm 10} s/not //'; +$pipe = new IO::Pipe->writer($perl, '-pe', $cmd); +print $pipe "not ok 3\n" ; +$pipe->close or print "# \$!=$!\nnot "; +print "ok 4\n"; $pipe = new IO::Pipe; @@ -31,8 +48,8 @@ $pid = fork(); if($pid) { $pipe->writer; - print $pipe "Xk 1\n"; - print $pipe "oY 2\n"; + print $pipe "Xk 5\n"; + print $pipe "oY 6\n"; $pipe->close; wait; } @@ -45,7 +62,7 @@ elsif(defined $pid) } else { - die; + die "# error = $!"; } $pipe = new IO::Pipe; @@ -67,8 +84,8 @@ elsif(defined $pid) $stdout = bless \*STDOUT, "IO::Handle"; $stdout->fdopen($pipe,"w"); - print STDOUT "not ok 3\n"; - exec 'echo', 'not ok 4'; + print STDOUT "not ok 7\n"; + exec 'echo', 'not ok 8'; } else { @@ -81,12 +98,12 @@ $pipe->writer; $SIG{'PIPE'} = 'broken_pipe'; sub broken_pipe { - print "ok 5\n"; + print "ok 9\n"; } -print $pipe "not ok 5\n"; +print $pipe "not ok 9\n"; $pipe->close; -print "ok 6\n"; +print "ok 10\n"; diff --git a/t/lib/io_sock.t b/t/lib/io_sock.t index c3701c5655..06a973cc70 100755 --- a/t/lib/io_sock.t +++ b/t/lib/io_sock.t @@ -10,10 +10,11 @@ BEGIN { use Config; BEGIN { - if(-d "lib" && -f "TEST") { - if ( ($Config{'extensions'} !~ /\bSocket\b/ || - $Config{'extensions'} !~ /\bIO\b/) && - !(($^O eq 'VMS') && $Config{d_socket})) { + if (-d "lib" && -f "TEST") { + if (!$Config{'d_fork'} || + (($Config{'extensions'} !~ /\bSocket\b/ || + $Config{'extensions'} !~ /\bIO\b/) && + !(($^O eq 'VMS') && $Config{d_socket}))) { print "1..0\n"; exit 0; } diff --git a/t/lib/ndbm.t b/t/lib/ndbm.t index 15aa93a725..8e2ba8164a 100755 --- a/t/lib/ndbm.t +++ b/t/lib/ndbm.t @@ -117,4 +117,5 @@ print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n"; print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n"); print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n"); +untie %h; unlink 'Op.dbmx.dir', $Dfile; diff --git a/t/lib/odbm.t b/t/lib/odbm.t index 0b1fa50cb9..0c530d2238 100755 --- a/t/lib/odbm.t +++ b/t/lib/odbm.t @@ -117,4 +117,5 @@ print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n"; print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n"); print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n"); +untie %h; unlink 'Op.dbmx.dir', $Dfile; diff --git a/t/lib/open2.t b/t/lib/open2.t index 1cf325a875..a2e6a07a7b 100755 --- a/t/lib/open2.t +++ b/t/lib/open2.t @@ -3,6 +3,11 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require Config; import Config; + unless ($Config{'d_fork'}) { + print "1..0\n"; + exit 0; + } # make warnings fatal $SIG{__WARN__} = sub { die @_ }; } @@ -12,6 +17,8 @@ use IO::Handle; use IPC::Open2; #require 'open2.pl'; use subs 'open2'; +my $perl = './perl'; + sub ok { my ($n, $result, $info) = @_; if ($result) { @@ -29,7 +36,7 @@ STDERR->autoflush; print "1..7\n"; -ok 1, $pid = open2 'READ', 'WRITE', $^X, '-e', 'print scalar <STDIN>'; +ok 1, $pid = open2 'READ', 'WRITE', $perl, '-e', 'print scalar <STDIN>'; ok 2, print WRITE "hi kid\n"; ok 3, <READ> eq "hi kid\n"; ok 4, close(WRITE), $!; diff --git a/t/lib/open3.t b/t/lib/open3.t index a5d7f2e8ee..4258eec401 100755 --- a/t/lib/open3.t +++ b/t/lib/open3.t @@ -3,6 +3,11 @@ BEGIN { chdir 't' if -d 't'; @INC = '../lib'; + require Config; import Config; + unless ($Config{'d_fork'}) { + print "1..0\n"; + exit 0; + } # make warnings fatal $SIG{__WARN__} = sub { die @_ }; } @@ -12,6 +17,8 @@ use IO::Handle; use IPC::Open3; #require 'open3.pl'; use subs 'open3'; +my $perl = './perl'; + sub ok { my ($n, $result, $info) = @_; if ($result) { @@ -30,7 +37,7 @@ STDERR->autoflush; print "1..21\n"; # basic -ok 1, $pid = open3 'WRITE', 'READ', 'ERROR', $^X, '-e', <<'EOF'; +ok 1, $pid = open3 'WRITE', 'READ', 'ERROR', $perl, '-e', <<'EOF'; $| = 1; print scalar <STDIN>; print STDERR "hi error\n"; @@ -46,7 +53,7 @@ ok 8, $reaped_pid == $pid, $reaped_pid; ok 9, $? == 0, $?; # read and error together, both named -$pid = open3 'WRITE', 'READ', 'READ', $^X, '-e', <<'EOF'; +$pid = open3 'WRITE', 'READ', 'READ', $perl, '-e', <<'EOF'; $| = 1; print scalar <STDIN>; print STDERR scalar <STDIN>; @@ -58,7 +65,7 @@ print scalar <READ>; waitpid $pid, 0; # read and error together, error empty -$pid = open3 'WRITE', 'READ', '', $^X, '-e', <<'EOF'; +$pid = open3 'WRITE', 'READ', '', $perl, '-e', <<'EOF'; $| = 1; print scalar <STDIN>; print STDERR scalar <STDIN>; @@ -72,7 +79,7 @@ waitpid $pid, 0; # dup writer ok 14, pipe PIPE_READ, PIPE_WRITE; $pid = open3 '<&PIPE_READ', 'READ', '', - $^X, '-e', 'print scalar <STDIN>'; + $perl, '-e', 'print scalar <STDIN>'; close PIPE_READ; print PIPE_WRITE "ok 15\n"; close PIPE_WRITE; @@ -81,7 +88,7 @@ waitpid $pid, 0; # dup reader $pid = open3 'WRITE', '>&STDOUT', 'ERROR', - $^X, '-e', 'print scalar <STDIN>'; + $perl, '-e', 'print scalar <STDIN>'; print WRITE "ok 16\n"; waitpid $pid, 0; @@ -89,12 +96,12 @@ waitpid $pid, 0; # stdout but putting stdout somewhere else, is a good case because it # used not to work. $pid = open3 'WRITE', 'READ', '>&STDOUT', - $^X, '-e', 'print STDERR scalar <STDIN>'; + $perl, '-e', 'print STDERR scalar <STDIN>'; print WRITE "ok 17\n"; waitpid $pid, 0; # dup reader and error together, both named -$pid = open3 'WRITE', '>&STDOUT', '>&STDOUT', $^X, '-e', <<'EOF'; +$pid = open3 'WRITE', '>&STDOUT', '>&STDOUT', $perl, '-e', <<'EOF'; $| = 1; print STDOUT scalar <STDIN>; print STDERR scalar <STDIN>; @@ -104,7 +111,7 @@ print WRITE "ok 19\n"; waitpid $pid, 0; # dup reader and error together, error empty -$pid = open3 'WRITE', '>&STDOUT', '', $^X, '-e', <<'EOF'; +$pid = open3 'WRITE', '>&STDOUT', '', $perl, '-e', <<'EOF'; $| = 1; print STDOUT scalar <STDIN>; print STDERR scalar <STDIN>; diff --git a/t/lib/sdbm.t b/t/lib/sdbm.t index 1bb3fde392..65419f9711 100755 --- a/t/lib/sdbm.t +++ b/t/lib/sdbm.t @@ -116,4 +116,5 @@ print join(':',200..400) eq join(':',@foo) ? "ok 10\n" : "not ok 10\n"; print ($h{'foo'} eq '' ? "ok 11\n" : "not ok 11\n"); print ($h{''} eq 'bar' ? "ok 12\n" : "not ok 12\n"); +untie %h; unlink 'Op.dbmx.dir', $Dfile; |