tests: keep an X11 connection open to every display, fixes races
Otherwise, i3 is the only client and thus the X server shuts down after i3 disconnects. Xdummy restarts an X server, but that takes some time and therefore sometimes the next testcase was unable to connect.
This commit is contained in:
parent
86de02ca8c
commit
26c1a463db
|
@ -28,6 +28,7 @@ use AnyEvent::I3 qw(:all);
|
|||
use Try::Tiny;
|
||||
use Getopt::Long;
|
||||
use Time::HiRes qw(sleep);
|
||||
use X11::XCB::Connection;
|
||||
|
||||
# install a dummy CHLD handler to overwrite the CHLD handler of AnyEvent / EV
|
||||
# XXX: we could maybe also use a different loop than the default loop in EV?
|
||||
|
@ -54,6 +55,23 @@ my $result = GetOptions(
|
|||
|
||||
@displays = qw(:1) if @displays == 0;
|
||||
|
||||
# connect to all displays for two reasons:
|
||||
# 1: check if the display actually works
|
||||
# 2: keep the connection open so that i3 is not the only client. this prevents
|
||||
# the X server from exiting (Xdummy will restart it, but not quick enough
|
||||
# sometimes)
|
||||
my @conns;
|
||||
my @wdisplays;
|
||||
for my $display (@displays) {
|
||||
try {
|
||||
my $x = X11::XCB::Connection->new(display => $display);
|
||||
push @conns, $x;
|
||||
push @wdisplays, $display;
|
||||
} catch {
|
||||
say STDERR "WARNING: Not using X11 display $display, could not connect";
|
||||
};
|
||||
}
|
||||
|
||||
my $i3cmd = abs_path("../i3") . " -V -d all --disable-signalhandler";
|
||||
my $config = slurp('i3-test.config');
|
||||
|
||||
|
@ -84,7 +102,7 @@ my $cv = AnyEvent->condvar;
|
|||
|
||||
# We start tests concurrently: For each display, one test gets started. Every
|
||||
# test starts another test after completing.
|
||||
take_job($_) for @displays;
|
||||
take_job($_) for @wdisplays;
|
||||
|
||||
#
|
||||
# Takes a test from the beginning of @testfiles and runs it.
|
||||
|
|
Loading…
Reference in New Issue