summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael G. Schwern <schwern@pobox.com>2001-11-12 14:35:33 -0500
committerAbhijit Menon-Sen <ams@wiw.org>2001-11-12 23:54:00 +0000
commitba553610b80f19edb980ef813a96b79c7b82f9fb (patch)
tree1ff8790a796ce51dbb3f9966ecb7256afb730fbd
parent062fc4b49fd93d15ed31f92c13a0423017410c79 (diff)
downloadperl-ba553610b80f19edb980ef813a96b79c7b82f9fb.tar.gz
Recoving dup tests for VMS
Message-Id: <20011112193533.D2888@blackrider> p4raw-id: //depot/perl@12960
-rwxr-xr-xext/IO/lib/IO/t/io_dup.t17
-rwxr-xr-xt/io/dup.t40
-rw-r--r--vms/test.com5
3 files changed, 40 insertions, 22 deletions
diff --git a/ext/IO/lib/IO/t/io_dup.t b/ext/IO/lib/IO/t/io_dup.t
index 8983a56f36..5db5ced7df 100755
--- a/ext/IO/lib/IO/t/io_dup.t
+++ b/ext/IO/lib/IO/t/io_dup.t
@@ -39,14 +39,15 @@ $stderr->fdopen($stdout,"w");
print $stdout "ok 2\n";
print $stderr "ok 3\n";
-if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
- print `echo ok 4`;
- print `echo ok 5 1>&2`; # does this *really* work?
-}
-else {
- system 'echo ok 4';
- system 'echo ok 5 1>&2';
-}
+
+# Since some systems don't have echo, we use Perl.
+$echo = qq{$^X -le "print q{ok %d}"};
+
+$cmd = sprintf $echo, 4;
+print `$cmd`;
+
+$cmd = sprintf "$echo 1>&2", 5;
+print `$cmd`;
$stderr->close;
$stdout->close;
diff --git a/t/io/dup.t b/t/io/dup.t
index a641db752a..3d782455a4 100755
--- a/t/io/dup.t
+++ b/t/io/dup.t
@@ -1,15 +1,18 @@
#!./perl
-# $RCSfile: dup.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:27 $
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+my $test = 1;
print "1..8\n";
-
print "ok 1\n";
-open(dupout,">&STDOUT");
-open(duperr,">&STDERR");
+open(DUPOUT,">&STDOUT");
+open(DUPERR,">&STDERR");
-open(STDOUT,">Io.dup") || die "Can't open stdout";
+open(STDOUT,">Io.dup") || die "Can't open stdout";
open(STDERR,">&STDOUT") || die "Can't open stderr";
select(STDERR); $| = 1;
@@ -17,16 +20,31 @@ select(STDOUT); $| = 1;
print STDOUT "ok 2\n";
print STDERR "ok 3\n";
- print `echo ok 4`;
- print `echo ok 5 1>&2`; # does this work?
- system 'echo ok 6';
- system 'echo ok 7 1>&2';
+
+# Since some systems don't have echo, we use Perl.
+$echo = qq{$^X -le "print q{ok %d}"};
+
+$cmd = sprintf $echo, 4;
+print `$cmd`;
+
+$cmd = sprintf "$echo 1>&2", 5;
+print `$cmd`;
+
+# KNOWN BUG system() does not honor STDOUT redirections on VMS.
+if( $^O eq 'VMS' ) {
+ print "not ok $_ # TODO system() not honoring STDOUT redirect on VMS\n"
+ for 6..7;
+}
+else {
+ system sprintf $echo, 6;
+ system sprintf "$echo 1>&2", 7;
+}
close(STDOUT);
close(STDERR);
-open(STDOUT,">&dupout");
-open(STDERR,">&duperr");
+open(STDOUT,">&DUPOUT");
+open(STDERR,">&DUPERR");
if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) { print `type Io.dup` }
else { system 'cat Io.dup' }
diff --git a/vms/test.com b/vms/test.com
index e2b9503c96..62532f5d6f 100644
--- a/vms/test.com
+++ b/vms/test.com
@@ -102,7 +102,7 @@ $ PerlShr_filespec = f$parse("Sys$Disk:[-]''dbg'PerlShr''exe'")
$ Define 'dbg'Perlshr 'PerlShr_filespec'
$ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p3'" "''p4'" "''p5'" "''p6'"
$ Deck/Dollar=$$END-OF-TEST$$
-# $RCSfile: test.com,v $$Revision: 1.1 $$Date: 2001/11/07 06:58:50 $
+# $RCSfile: test.com,v $$Revision: 1.1 $$Date: 2001/11/13 00:26:19 $
# Modified for VMS 30-Sep-1994 Charles Bailey bailey@newman.upenn.edu
#
# This is written in a peculiar style, since we're trying to avoid
@@ -115,8 +115,7 @@ use Config;
use File::Spec;
@compexcl=('cpp.t');
-@ioexcl=('dup.t');
-@libexcl=('io_dup.t', 'io_pipe.t', 'io_poll.t', 'io_sel.t',
+@libexcl=('io_pipe.t', 'io_poll.t', 'io_sel.t',
'io_sock.t', 'io_unix.t');
# io_xs.t tests the new_tmpfile routine, which doesn't work with the