summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-07-10 14:28:56 +0200
committerKarolin Seeger <kseeger@samba.org>2014-07-15 14:34:31 +0200
commit7ff37efe2d268b6b1d438f80d0f5b73f437348ac (patch)
tree247bf71f3578ee7ba29fa3edba6520325f6a5288 /selftest
parentfac95046b5eeebf740284dbf1c673ad3188df8d9 (diff)
downloadsamba-7ff37efe2d268b6b1d438f80d0f5b73f437348ac.tar.gz
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> (cherry picked from commit b2803950fc439017680069813fc49255a3f0cbbf) Bug: https://bugzilla.samba.org/show_bug.cgi?id=10696 backport autobuild/selftest fixes from master Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org> Autobuild-Date(v4-0-test): Tue Jul 15 14:34:31 CEST 2014 on sn-devel-104
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 b516eef6c26..a823652897b 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -61,14 +61,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) = @_;
@@ -721,12 +713,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) = @_;
@@ -822,6 +826,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};