From: Michael Stapelberg Date: Sat, 24 Sep 2011 12:09:20 +0000 (+0100) Subject: tests: complete_run: directly use X11::XCB instead of ::Connection X-Git-Tag: 4.1~139^2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e244a758015b8385f497701dfa94a91b0740fe99;p=i3%2Fi3 tests: complete_run: directly use X11::XCB instead of ::Connection This saves about 0.5s wallclock time due to not starting up Moose/Mouse. This is worthwhile when you develop a new feature and you are often invoking complete_run for one specific test. --- diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 8f740d8c..74bc507f 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -28,7 +28,7 @@ use AnyEvent::I3 qw(:all); use Try::Tiny; use Getopt::Long; use Time::HiRes qw(sleep); -use X11::XCB::Connection; +use X11::XCB; use IO::Socket::UNIX; # core use POSIX; # core use AnyEvent::Handle; @@ -75,13 +75,14 @@ my $result = GetOptions( my @conns; my @wdisplays; for my $display (@displays) { - try { - my $x = X11::XCB::Connection->new(display => $display); + my $screen; + my $x = X11::XCB->new($display, $screen); + if ($x->has_error) { + say STDERR "WARNING: Not using X11 display $display, could not connect"; + } else { push @conns, $x; push @wdisplays, $display; - } catch { - say STDERR "WARNING: Not using X11 display $display, could not connect"; - }; + } } my $config = slurp('i3-test.config');