mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
selftest: teardown the environments also on getting SIGPIPE
make test uses selftest.pl | subuntu-filter.py ... FAIL_IMMEDIATELY=1 lets subuntu-filter.py exit, which generates SIGPIPE in selftest.pl. We should handle this just like any other signal and teardown all environments. This should make the teardown process more reliable/verbose. Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
This commit is contained in:
parent
a6523d78c3
commit
b2803950fc
@ -64,14 +64,6 @@ my $prefix = "./st";
|
||||
my @includes = ();
|
||||
my @excludes = ();
|
||||
|
||||
sub pipe_handler {
|
||||
my $sig = shift @_;
|
||||
print STDERR "Exiting early because of SIGPIPE.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$SIG{PIPE} = \&pipe_handler;
|
||||
|
||||
sub find_in_list($$)
|
||||
{
|
||||
my ($list, $fullname) = @_;
|
||||
@ -770,12 +762,24 @@ my @exported_envvars = (
|
||||
"GID_RFC2307TEST"
|
||||
);
|
||||
|
||||
$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub {
|
||||
sub sighandler($)
|
||||
{
|
||||
my $signame = shift;
|
||||
|
||||
$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = 'DEFAULT';
|
||||
$SIG{PIPE} = 'IGNORE';
|
||||
|
||||
open(STDOUT, ">&STDERR") or die "can't dup STDOUT to STDERR: $!";
|
||||
|
||||
print "$0: PID[$$]: Got SIG${signame} teardown environments.\n";
|
||||
teardown_env($_) foreach(keys %running_envs);
|
||||
die("Received signal $signame");
|
||||
system("pstree -p $$");
|
||||
print "$0: PID[$$]: Exiting...\n";
|
||||
exit(1);
|
||||
};
|
||||
|
||||
$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = $SIG{PIPE} = \&sighandler;
|
||||
|
||||
sub setup_env($$)
|
||||
{
|
||||
my ($name, $prefix) = @_;
|
||||
@ -871,6 +875,7 @@ sub teardown_env($)
|
||||
{
|
||||
my ($envname) = @_;
|
||||
return if ($envname eq "none");
|
||||
print STDERR "teardown_env($envname)\n";
|
||||
my $env = get_running_env($envname);
|
||||
$env->{target}->teardown_env($env);
|
||||
delete $running_envs{$envname};
|
||||
|
Loading…
Reference in New Issue
Block a user