cvsuser     05/03/07 14:26:50

  Modified:    .        MANIFEST
               config/auto gdbm.pl
               lib/Parrot Test.pm
  Added:       t/op     spawnw.t
  Log:
  Added a test script for the 'spawnw' op.
  Thanks to Nigel Sandever.
  See also RT#27301.
  
  Revision  Changes    Path
  1.841     +1 -0      parrot/MANIFEST
  
  Index: MANIFEST
  ===================================================================
  RCS file: /cvs/public/parrot/MANIFEST,v
  retrieving revision 1.840
  retrieving revision 1.841
  diff -u -r1.840 -r1.841
  --- MANIFEST  6 Mar 2005 09:55:19 -0000       1.840
  +++ MANIFEST  7 Mar 2005 22:26:47 -0000       1.841
  @@ -2856,6 +2856,7 @@
   t/op/number.t                                     []
   t/op/random.t                                     []
   t/op/rx.t                                         []
  +t/op/spawnw.t                                     []
   t/op/stacks.t                                     []
   t/op/string.t                                     []
   t/op/string_cs.t                                  []
  
  
  
  1.4       +3 -3      parrot/config/auto/gdbm.pl
  
  Index: gdbm.pl
  ===================================================================
  RCS file: /cvs/public/parrot/config/auto/gdbm.pl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- gdbm.pl   17 Feb 2005 09:04:37 -0000      1.3
  +++ gdbm.pl   7 Mar 2005 22:26:48 -0000       1.4
  @@ -1,5 +1,5 @@
   # Copyright: 2001-2005 The Perl Foundation.  All Rights Reserved.
  -# $Id: gdbm.pl,v 1.3 2005/02/17 09:04:37 leo Exp $
  +# $Id: gdbm.pl,v 1.4 2005/03/07 22:26:48 bernhard Exp $
   
   =head1 NAME
   
  @@ -48,9 +48,9 @@
   
       cc_gen('config/auto/gdbm/gdbm.in');
       if ($^O =~ /mswin32/i) {
  -      eval { cc_build('', 'gdbm.lib'); };
  +        eval { cc_build('', 'gdbm.lib'); };
       } else { 
  -    eval { cc_build('', '-lgdbm'); };
  +        eval { cc_build('', '-lgdbm'); };
       }
       my $has_gdbm = 0;
       if (! $@) {
  
  
  
  1.66      +2 -2      parrot/lib/Parrot/Test.pm
  
  Index: Test.pm
  ===================================================================
  RCS file: /cvs/public/parrot/lib/Parrot/Test.pm,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- Test.pm   5 Mar 2005 22:47:45 -0000       1.65
  +++ Test.pm   7 Mar 2005 22:26:49 -0000       1.66
  @@ -1,5 +1,5 @@
   # Copyright: 2004-2005 The Perl Foundation.  All Rights Reserved.
  -# $Id: Test.pm,v 1.65 2005/03/05 22:47:45 bernhard Exp $
  +# $Id: Test.pm,v 1.66 2005/03/07 22:26:49 bernhard Exp $
   
   =head1 NAME
   
  @@ -296,7 +296,7 @@
               if ( $func =~ /^pir_output/ ) {
                   $code_f = per_test('.imc', $test_no);
               }
  -            elsif ( $func =~ m/^output_/ ) {
  +            elsif ( $func =~ m/^output_/ || $func =~ m/^pasm_output_/ ) {
                   $code_f = per_test('.pasm', $test_no);
               }
               elsif ( $func =~ /^pir_2_pasm_/) {
  
  
  
  1.1                  parrot/t/op/spawnw.t
  
  Index: spawnw.t
  ===================================================================
  #! perl -w
  # Copyright: 2004-2005 The Perl Foundation.  All Rights Reserved.
  # $Id: spawnw.t,v 1.1 2005/03/07 22:26:50 bernhard Exp $
  
  =head1 NAME
  
  t/op/spawnw.t - Run OS commands and tell about the exit code
  
  =head1 SYNOPSIS
  
        % perl -Ilib t/op/spawnw.t
  
  =head1 DESCRIPTION
  
  Tests spawning external commands.
  
  spanwn does not capture STDOUT and STDERR from the spawnde command.
  So only the exit code can be tested.
  
  The returned value is actually returned from the 'waitpid' system call.
  In order to get the exit code from the spawned process, it needs to be right 
shifted
  by 8 bit. 
  
  =head1 TODO
  
  Test negative return codes.
  
  =head1 SEE ALSO
  
  The special variable $? in Perl5.
  
  =head1 AUTHOR
  
  
  Nigel Sandever - L<[EMAIL PROTECTED]>
  
  =cut
  
  use Parrot::Test tests => 3;
  
  # perl command coded this way to avoid platform 
  # quoting issue.
  
  pasm_output_is(<<'CODE', <<'OUTPUT', "exit code: 0");
          set     S1, 'perl -e "exit(0)"'
          set     I1, 99
          spawnw  I1, S1
        shr     I2, I1, 8
          print   "return code: "
          print   I2
          print   "\n"
          end
  CODE
  return code: 0
  OUTPUT
  
  output_is(<<'CODE', <<'OUTPUT', "exit code: 123");
          set     S1, 'perl -e "exit(123)"'
          set     I1, 99
          spawnw  I1, S1
        shr     I2, I1, 8
          print   "return code: "
          print   I2
          print   "\n"
          end
  CODE
  return code: 123
  OUTPUT
  
  
  output_is(<<'CODE', <<'OUTPUT', "exit code: 3");
          set     S1, 'perl -e "exit(3)"'
          set     I1, 99
          spawnw  I1, S1
        shr     I2, I1, 8
          print   "return code: "
          print   I2
          print   "\n"
          end
  CODE
  return code: 3
  OUTPUT
  
  
  

Reply via email to