Skip to content

Commit

Permalink
Fix testsuite on OpenBSD
Browse files Browse the repository at this point in the history
OpenBSD perl forks for glob().
Therefore attach SIGCHLD handler as late as possible.
  • Loading branch information
Christopher Zimmermann committed Jun 11, 2016
1 parent 7e2483e commit fa12f67
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
18 changes: 9 additions & 9 deletions testcases/lib/StartXServer.pm
Expand Up @@ -69,15 +69,6 @@ sub start_xserver {
my @displays = ();
my @childpids = ();

$SIG{CHLD} = sub {
my $child = waitpid -1, POSIX::WNOHANG;
@pids = grep { $_ != $child } @pids;
return unless @pids == 0;
print STDERR "All X server processes died.\n";
print STDERR "Use ./complete-run.pl --parallel 1 --keep-xserver-output\n";
exit 1;
};

# Yeah, I know it’s non-standard, but Perl’s POSIX module doesn’t have
# _SC_NPROCESSORS_CONF.
my $num_cores;
Expand All @@ -101,6 +92,15 @@ sub start_xserver {

say "Starting $parallel Xephyr instances, starting at :$displaynum...";

$SIG{CHLD} = sub {
my $child = waitpid -1, POSIX::WNOHANG;
@pids = grep { $_ != $child } @pids;
return unless @pids == 0;
print STDERR "All X server processes died.\n";
print STDERR "Use ./complete-run.pl --parallel 1 --keep-xserver-output\n";
exit 1;
};

my @sockets_waiting;
for (1 .. $parallel) {
my $socket = fork_xserver($keep_xserver_output, $displaynum,
Expand Down
5 changes: 5 additions & 0 deletions testcases/t/180-fd-leaks.t
Expand Up @@ -20,6 +20,9 @@ use i3test;
use POSIX qw(mkfifo);
use File::Temp qw(:POSIX tempfile);

SKIP: {
skip "Procfs not available on $^O", 1 if $^O eq 'openbsd';

my $i3 = i3(get_socket_path());

my $tmp = tmpnam();
Expand Down Expand Up @@ -59,4 +62,6 @@ for my $fd (keys %fds) {

is(scalar keys %fds, 0, 'No file descriptors leaked');

}

done_testing;

0 comments on commit fa12f67

Please sign in to comment.