my $output;
my $parser = TAP::Parser->new({
- exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" /usr/bin/perl -It/lib $test| ],
+ exec => [ 'sh', '-c', qq|DISPLAY=$display LOGPATH="$logpath" /usr/bin/perl -It/lib -Ilib $test| ],
spool => IO::Scalar->new(\$output),
merge => 1,
});
use Try::Tiny;
use Cwd qw(abs_path);
use Proc::Background;
+use SocketActivation;
use v5.10;
# complete-run.pl that it should not create an instance of i3
#
sub launch_with_config {
- my ($config) = @_;
+ my ($config, $dont_add_socket_path) = @_;
+
+ $dont_add_socket_path //= 0;
if (!defined($tmp_socket_path)) {
$tmp_socket_path = File::Temp::tempnam('/tmp', 'i3-test-socket-');
my ($fh, $tmpfile) = tempfile('i3-test-config-XXXXX', UNLINK => 1);
say $fh $config;
- say $fh "ipc-socket $tmp_socket_path";
+ say $fh "ipc-socket $tmp_socket_path" unless $dont_add_socket_path;
close($fh);
- # Use $ENV{LOGPATH}, gets set in complete-run.pl. We append instead of
- # overwrite because there might be multiple instances of i3 running during
- # one test case.
- my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $tmpfile >>$ENV{LOGPATH} 2>&1";
- my $process = Proc::Background->new($i3cmd);
- sleep 1.25;
+ my $cv = AnyEvent->condvar;
+ my $pid = activate_i3(
+ unix_socket_path => "$tmp_socket_path-activation",
+ display => $ENV{DISPLAY},
+ configfile => $tmpfile,
+ logpath => $ENV{LOGPATH},
+ cv => $cv,
+ );
+
+ # blockingly wait until i3 is ready
+ $cv->recv;
# force update of the cached socket path in lib/i3test
get_socket_path(0);
- return $process;
+ return $pid;
}
1