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);
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) {
EOF
-# test bugreport.cgi
+# test the soap server
my $port = 11343;
END{
if (defined $child_pid) {
+ my $temp_exit = $?;
kill(15,$child_pid);
waitpid(-1,0);
+ $? = $temp_exit;
}
}
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: $!";
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";
}
}
END {
if (defined $child_pid) {
# stop the child
+ my $temp_exit = $?;
kill(15,$child_pid);
waitpid(-1,0);
+ $? = $temp_exit;
}
}