r35389 - in /trunk/libtest-command-perl: Changes META.yml debian/changelog lib/Test/Command.pm t/02-exit.t t/05-object.t t/06-signal.t

bricas-guest at users.alioth.debian.org bricas-guest at users.alioth.debian.org
Thu May 14 12:25:54 UTC 2009


Author: bricas-guest
Date: Thu May 14 12:25:48 2009
New Revision: 35389

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=35389
Log:
New upstream release

Modified:
    trunk/libtest-command-perl/Changes
    trunk/libtest-command-perl/META.yml
    trunk/libtest-command-perl/debian/changelog
    trunk/libtest-command-perl/lib/Test/Command.pm
    trunk/libtest-command-perl/t/02-exit.t
    trunk/libtest-command-perl/t/05-object.t
    trunk/libtest-command-perl/t/06-signal.t

Modified: trunk/libtest-command-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/Changes?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/Changes (original)
+++ trunk/libtest-command-perl/Changes Thu May 14 12:25:48 2009
@@ -1,22 +1,45 @@
 Revision history for Test-Command
 
-0.04    Sun May 10 09:38:05 2009
-        - exit and signal values can be undef if POSIX::WIFEXITED() or POSIX::WIFSIGNALED
-          return false respectively
-        - added exit_is_defined(), exit_is_undef(), signal_is_defined() and signal_is_undef()   
+0.08    Wed May 13 23:04 2009
+        - removed use of POSIX module (need a better understanding of how
+          to use it on BSD systems), reverted back to hand-rolled exit and
+          signal determination
+        - changed signal tests to use Config.pm to determine symbolic signal
+          values
 
-0.03    Sat May 9 23:21:12 2009
-        - use POSIX::WEXITSTATUS() to find exit status instead of manual bit shift
-        - added terminating signal handling via POSIX::WTERMSIG() (was mentioned in
-          "DEVELOPMENT IDEAS" but finally spurred on by Lanny Ripple via
+0.07    Mon May 11 23:42 2009
+        - removed internal requirement that ref $self eq 'Test::Command' to
+          allow subclassing (requested by Lanny Ripple via
           http://rt.cpan.org/Public/Bug/Display.html?id=43541)
+
+0.06    Mon May 11 23:01 2009
+        - only use POSIX::W* macros when available
+        - skip signal tests on MSWin32
+
+0.05    Mon May 11 21:32 2009
+        - use ${^CHILD_ERROR_NATIVE} if available (hopefully will help with
+          BSD test failures)
+
+0.04    Sun May 10 09:38 2009
+        - exit and signal values can be undef if POSIX::WIFEXITED() or
+          POSIX::WIFSIGNALED return false respectively
+        - added exit_is_defined(), exit_is_undef(), signal_is_defined() and
+          signal_is_undef()   
+
+0.03    Sat May 9 23:21 2009
+        - use POSIX::WEXITSTATUS() to find exit status instead of manual bit
+          shift
+        - added terminating signal handling via POSIX::WTERMSIG() (was
+          mentioned in "DEVELOPMENT IDEAS" but finally spurred on by Lanny
+          Ripple via http://rt.cpan.org/Public/Bug/Display.html?id=43541)
         - added t/06-signal.t
 
-0.02    Tue Apr 10 21:58:20 2007
+0.02    Tue Apr 10 21:58 2007
         - added 'tests => 11' import to 'use Test::Command' in SYNOPSIS
-        - modified "No such file" tests to only test for $@ after the eval since
-          the regex test wasn't valid for other languages
-        - added development idea about creating a script to generate test files
+        - modified "No such file" tests to only test for $@ after the eval
+          since the regex test wasn't valid for other languages
+        - added development idea about creating a script to generate test
+          files
 
-0.01    Sun Apr  8 15:36:20 2007
+0.01    Sun Apr  8 15:36 2007
         - First release.

Modified: trunk/libtest-command-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/META.yml?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/META.yml (original)
+++ trunk/libtest-command-perl/META.yml Thu May 14 12:25:48 2009
@@ -1,6 +1,6 @@
 ---
 name: Test-Command
-version: 0.04
+version: 0.08
 author:
   - 'Daniel B. Boorstein <danboo at cpan.org>'
 abstract: Test routines for external commands
@@ -12,7 +12,7 @@
 provides:
   Test::Command:
     file: lib/Test/Command.pm
-    version: 0.04
+    version: 0.08
 generated_by: Module::Build version 0.280802
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.2.html

Modified: trunk/libtest-command-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/debian/changelog?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/debian/changelog (original)
+++ trunk/libtest-command-perl/debian/changelog Thu May 14 12:25:48 2009
@@ -1,3 +1,9 @@
+libtest-command-perl (0.08-1) UNRELEASED; urgency=low
+
+  * New upstream release
+
+ -- Brian Cassidy <brian.cassidy at gmail.com>  Thu, 14 May 2009 09:25:14 -0300
+
 libtest-command-perl (0.04-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libtest-command-perl/lib/Test/Command.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/lib/Test/Command.pm?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/lib/Test/Command.pm (original)
+++ trunk/libtest-command-perl/lib/Test/Command.pm Thu May 14 12:25:48 2009
@@ -5,7 +5,6 @@
 
 use Carp qw/ confess /;
 use File::Temp qw/ tempfile /;
-use POSIX qw(:sys_wait_h);
 
 use base 'Test::Builder::Module';
 
@@ -41,18 +40,18 @@
                   stderr_is_file
 
                   );
-
+                  
 =head1 NAME
 
 Test::Command - Test routines for external commands
 
 =head1 VERSION
 
-Version 0.04
-
-=cut
-
-our $VERSION = '0.04';
+Version 0.08
+
+=cut
+
+our $VERSION = '0.08';
 
 =head1 SYNOPSIS
 
@@ -328,7 +327,7 @@
 
    defined $cmd or confess '$cmd is undefined';
 
-   if (ref $cmd eq 'Test::Command')
+   if ( ref $cmd && UNIVERSAL::isa($cmd, 'Test::Command') ) 
       {
       $cmd = $cmd->{'cmd'};
       }
@@ -349,7 +348,7 @@
 
    defined $cmd or confess '$cmd is undefined';
 
-   if ( ref $cmd eq 'Test::Command' )
+   if ( ref $cmd && UNIVERSAL::isa($cmd, 'Test::Command') ) 
       {
 
       ## run the command if needed
@@ -396,9 +395,24 @@
    open STDERR, '>&' . fileno $temp_stderr_fh or confess 'Cannot duplicate temporary STDERR';
 
    ## run the command
-   my $system_return = system(@{ $cmd });
-   my $exit_status   = WIFEXITED($system_return)   ? WEXITSTATUS($system_return) : undef;
-   my $term_signal   = WIFSIGNALED($system_return) ? WTERMSIG($system_return)    : undef;
+   system(@{ $cmd });
+   
+   my $system_return = defined ${^CHILD_ERROR_NATIVE} ? ${^CHILD_ERROR_NATIVE} : $?; 
+   
+   my $exit_status;
+   my $term_signal;
+
+   my $wait_status = $system_return & 127;
+   if ($wait_status)
+      {
+      $exit_status = undef;
+      $term_signal = $wait_status;
+      }
+   else
+      {
+      $exit_status = $system_return >> 8;
+      $term_signal = undef;
+      }
 
    ## close and restore STDOUT and STDERR to original handles
    close STDOUT or confess "failed to close STDOUT: $!";

Modified: trunk/libtest-command-perl/t/02-exit.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/02-exit.t?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/02-exit.t (original)
+++ trunk/libtest-command-perl/t/02-exit.t Thu May 14 12:25:48 2009
@@ -11,7 +11,12 @@
 exit_is_num(qq($^X -e "exit 1"), 1);
 exit_is_num(qq($^X -e "exit 255"), 255);
 exit_is_defined(qq($^X -e "exit 255"));
-exit_is_undef(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"));
+
+SKIP:
+   {
+   skip("not sure about Win32 signal support", 1) if $^O eq 'MSWin32';
+   exit_is_undef([$^X,  '-e', 'kill q(TERM), $$']);
+   }
 
 exit_isnt_num(qq($^X -e 1), 2);
 

Modified: trunk/libtest-command-perl/t/05-object.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/05-object.t?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/05-object.t (original)
+++ trunk/libtest-command-perl/t/05-object.t Thu May 14 12:25:48 2009
@@ -1,6 +1,6 @@
 #!perl
 
-use Test::More tests => 27;
+use Test::More tests => 32;
 
 use Test::Command;
 
@@ -22,7 +22,11 @@
 $test_perl->exit_isnt_num(1);
 $test_perl->exit_cmp_ok('<', 1);
 
-$test_perl->signal_is_undef;
+SKIP:
+   {
+   skip("not sure about Win32 signal support", 1) if $^O eq 'MSWin32';
+   $test_perl->signal_is_undef;
+   }
 
 $test_perl->stdout_is_eq("foo\nbar\n");
 $test_perl->stdout_isnt_eq("bar\nfoo\n");
@@ -63,3 +67,21 @@
 $test_perl->exit_is_num(0);
 $test_perl->stdout_is_eq("foo\nbar\n");
 $test_perl->stderr_is_eq("bar\nfoo\n");
+
+package Test::Command::Derived;
+
+use base Test::Command;
+
+package main;
+
+$test_perl = Test::Command::Derived->new( cmd => qq($^X -le "print qq(foo\nbar); print STDERR qq(bar\nfoo)") );
+
+ok(defined $test_perl, 'defined $test_perl');
+
+is(ref $test_perl, 'Test::Command::Derived', 'ref $test_perl');
+
+$test_perl->run;
+
+$test_perl->exit_is_num(0);
+$test_perl->exit_isnt_num(1);
+$test_perl->exit_cmp_ok('<', 1);

Modified: trunk/libtest-command-perl/t/06-signal.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-command-perl/t/06-signal.t?rev=35389&op=diff
==============================================================================
--- trunk/libtest-command-perl/t/06-signal.t (original)
+++ trunk/libtest-command-perl/t/06-signal.t Thu May 14 12:25:48 2009
@@ -1,21 +1,32 @@
 #!perl
 
-use Test::Command tests => 7;
+use strict;
+use warnings;
+
+use Test::Command tests => 8;
 
 use Test::More;
 
-use POSIX;
+use Config;
+
+my @sig_names = split ' ', $Config{'sig_name'};
+my @sig_nums  = split ' ', $Config{'sig_num'};
+my %sig; @sig{@sig_names} = @sig_nums;
 
 ## determine whether we can run perl or not
 
 system qq($^X -e 1) and BAIL_OUT('error calling perl via system');
 
-signal_is_undef(qq($^X -e "exit 0"));
-signal_is_undef(qq($^X -e "exit 1"));
-signal_is_undef(qq($^X -e "exit 255"));
-signal_is_num(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"), &POSIX::SIGTERM );
-signal_is_defined(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"));
-
-signal_is_undef(qq($^X -e 1));
-
-signal_cmp_ok(qq($^X -MPOSIX -e "POSIX::raise( &POSIX::SIGTERM )"), '==', &POSIX::SIGTERM );
+SKIP:
+   {
+   skip("not sure about Win32 signal support", 8) if $^O eq 'MSWin32';
+   signal_is_undef(qq($^X -e "exit 0"));
+   signal_is_undef(qq($^X -e "exit 1"));
+   signal_is_undef(qq($^X -e "exit 255"));
+   signal_is_undef([$^X, '-e', 1]);
+   skip("no SIGTERM found", 4) if ! exists $sig{'TERM'};
+   signal_is_defined([$^X,  '-e', 'kill ' . $sig{'TERM'} . ', $$']);
+   signal_cmp_ok([$^X,  '-e', 'kill ' . $sig{'TERM'} . ', $$'], '>', -1 );
+   signal_isnt_num([$^X,  '-e', 'kill ' . $sig{'TERM'} . ', $$'], $sig{'TERM'} + 1 );
+   signal_is_num([$^X,  '-e', 'kill ' . $sig{'TERM'} . ', $$'], $sig{'TERM'} );
+   }




More information about the Pkg-perl-cvs-commits mailing list