This fixes up the two dup tests so they work on VMS.  The basic
problem was they expected echo to exist.  So instead we just use perl.

In the process a VMS bug was uncovered.  system() does not honor the
redirection of STDOUT, so that test has been made TODO on VMS.


--- ext/IO/lib/IO/t/io_dup.t    Mon Jun 18 01:21:15 2001
+++ ext/IO/lib/IO/t/io_dup.t    Mon Nov 12 19:25:00 2001
@@ -39,14 +39,15 @@
 
 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;
--- t/io/dup.t  Sat Jun 16 16:49:29 2001
+++ t/io/dup.t  Mon Nov 12 19:22:33 2001
@@ -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 @@
 
 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' }
--- vms/test.com        Fri Nov  9 10:08:35 2001
+++ vms/test.com        Mon Nov 12 19:26:25 2001
@@ -102,7 +102,7 @@
 $   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  [EMAIL PROTECTED]
 #
 # This is written in a peculiar style, since we're trying to avoid
@@ -115,8 +115,7 @@
 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

-- 

Michael G. Schwern   <[EMAIL PROTECTED]>    http://www.pobox.com/~schwern/
Perl6 Quality Assurance     <[EMAIL PROTECTED]>       Kwalitee Is Job One
humble abode cries
there is not enough paste here
restock erotica please
        -- imploded

Reply via email to