]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Fix tests for .in renaming
authorDon Armstrong <don@donarmstrong.com>
Wed, 25 Jun 2008 01:17:25 +0000 (18:17 -0700)
committerDon Armstrong <don@donarmstrong.com>
Wed, 25 Jun 2008 01:17:25 +0000 (18:17 -0700)
 * Fix waitpid resetting $? failures

t/06_mail_handling.t
t/07_bugreport.t
t/09_soap.t
t/lib/DebbugsTest.pm

index f83eabb9a84237e2e9fb7903ebc4ef1a919773e5..ccf1ee7924e8abdfd0450bbe802b61431caf0855 100644 (file)
@@ -228,6 +228,7 @@ while (my ($command,$control_command) = splice(@control_commands,0,2)) {
                              Subject => "Munging a bug with $command",
                             ],
                  body => <<EOF) or fail 'message to control@bugs.something failed';
+debug 10
 $control_command->{command} 1$control_command->{value}
 thanks
 EOF
index 18ccbc5c9cc472dbf759da64d87e74bac9416d41..78fbdc74b4cd3742c30dd088ea1555eeea9492cb 100644 (file)
@@ -78,3 +78,4 @@ ok($mech->content() =~ qr/\<title\>\#1.+Submitting a bug/i,
    'Title of bug is submitting a bug');
 
 # Other tests for bugs in the page should be added here eventually
+
index 3154a0835aa11fcfefca31bef29b2541eaefdd2e..2a04c60e07da530176262ced80b81d4150a16690 100644 (file)
@@ -6,13 +6,6 @@ use Test::More tests => 4;
 use warnings;
 use strict;
 
-# Here, we're going to shoot messages through a set of things that can
-# happen.
-
-# First, we're going to send mesages to receive.
-# To do so, we'll first send a message to submit,
-# then send messages to the newly created bugnumber.
-
 use IO::File;
 use File::Temp qw(tempdir);
 use Cwd qw(getcwd);
@@ -32,7 +25,7 @@ if ($@) {
      BAIL_OUT($@);
 }
 
-# Output some debugging information if there's an error
+# Output some debugging information if we're debugging
 END{
      if ($ENV{DEBUG}) {
          foreach my $key (keys %config) {
@@ -55,7 +48,7 @@ This is a silly bug
 EOF
 
 
-# test bugreport.cgi
+# test the soap server
 
 my $port = 11343;
 
@@ -69,8 +62,10 @@ our $child_pid = undef;
 
 END{
      if (defined $child_pid) {
+         my $temp_exit = $?;
          kill(15,$child_pid);
          waitpid(-1,0);
+         $? = $temp_exit;
      }
 }
 
index 5d04848bf255f71bfe9d3627694ae733280dd2bb..580c41d5ebaa06c199e52f766d0fae39c064987f 100644 (file)
@@ -151,16 +151,16 @@ sub send_message{
      my $output='';
      local $SIG{PIPE} = 'IGNORE';
      local $SIG{CHLD} = sub {};
-     my $pid = open3($wfd,$rfd,$rfd,'scripts/receive.in')
-         or die "Unable to start receive.in: $!";
+     my $pid = open3($wfd,$rfd,$rfd,'scripts/receive')
+         or die "Unable to start receive: $!";
      print {$wfd} create_mime_message($param{headers},
-                                        $param{body}) or die "Unable to to print to receive.in";
-     close($wfd) or die "Unable to close receive.in";
+                                        $param{body}) or die "Unable to to print to receive";
+     close($wfd) or die "Unable to close receive";
      my $err = $? >> 8;
      my $childpid = waitpid($pid,0);
      if ($childpid != -1) {
          $err = $? >> 8;
-         print STDERR "receive.in pid: $pid doesn't match childpid: $childpid\n" if $childpid != $pid;
+         print STDERR "receive pid: $pid doesn't match childpid: $childpid\n" if $childpid != $pid;
      }
      if ($err != 0 ) {
          my $rfh =  IO::Handle->new_from_fd($rfd,'r') or die "Unable to create filehandle: $!";
@@ -171,11 +171,11 @@ sub send_message{
               print STDERR "Reading from STDOUT/STDERR would have blocked.";
          }
          print STDERR $output,qq(\n);
-         die "receive.in failed with exit status $err";
+         die "receive failed with exit status $err";
      }
      # now we should run processall to see if the message gets processed
      if ($param{run_processall}) {
-         system('scripts/processall.in') == 0 or die "processall.in failed";
+         system('scripts/processall') == 0 or die "processall failed";
      }
 }
 
@@ -190,8 +190,10 @@ sub send_message{
      END {
          if (defined $child_pid) {
               # stop the child
+              my $temp_exit = $?;
               kill(15,$child_pid);
               waitpid(-1,0);
+              $? = $temp_exit;
          }
      }