summaryrefslogtreecommitdiffstats
path: root/selftest
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-07-10 14:28:56 +0200
committerStefan Metzmacher <metze@samba.org>2014-07-11 16:19:07 +0200
commitb2803950fc439017680069813fc49255a3f0cbbf (patch)
treec8c780315ccfddb31ab108d2777096d5c9a607b4 /selftest
parenta6523d78c347acf56b921edbc2276131b12a51aa (diff)
downloadsamba-b2803950fc439017680069813fc49255a3f0cbbf.tar.gz
samba-b2803950fc439017680069813fc49255a3f0cbbf.tar.xz
samba-b2803950fc439017680069813fc49255a3f0cbbf.zip
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>
Diffstat (limited to 'selftest')
-rwxr-xr-xselftest/selftest.pl25
1 files changed, 15 insertions, 10 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 831ebd90f8..fde8451f3d 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -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};