tests: get the socket path from the X11 atom I3_SOCKET_PATH

The hard-coded socket paths are not useful when running the test suite in
parallel.
This commit is contained in:
Michael Stapelberg
2011-07-25 13:35:56 +02:00
parent 18513e1638
commit 49ea805905
33 changed files with 91 additions and 46 deletions

View File

@ -41,10 +41,12 @@ sub set_wm_class {
# start a window and see that it does not get assigned with an empty config
#####################################################################
my $socketpath = File::Temp::tempnam('/tmp', 'i3-test-socket-');
my ($fh, $tmpfile) = tempfile();
say $fh "# i3 config file (v4)";
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
say $fh "ipc-socket /tmp/nestedcons";
say $fh "ipc-socket $socketpath";
close($fh);
diag("Starting i3");
@ -52,6 +54,9 @@ my $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c
my $process = Proc::Background->new($i3cmd);
sleep 1;
# force update of the cached socket path in lib/i3test
get_socket_path(0);
diag("pid = " . $process->pid);
my $tmp = fresh_workspace;
@ -86,7 +91,7 @@ sleep 0.25;
($fh, $tmpfile) = tempfile();
say $fh "# i3 config file (v4)";
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
say $fh "ipc-socket /tmp/nestedcons";
say $fh "ipc-socket $socketpath";
say $fh q|assign "special" → targetws|;
close($fh);
@ -95,6 +100,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
$process = Proc::Background->new($i3cmd);
sleep 1;
# force update of the cached socket path in lib/i3test
get_socket_path(0);
diag("pid = " . $process->pid);
$tmp = fresh_workspace;
@ -134,6 +142,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
$process = Proc::Background->new($i3cmd);
sleep 1;
# force update of the cached socket path in lib/i3test
get_socket_path(0);
diag("pid = " . $process->pid);
# initialize the target workspace, then go to a fresh one
@ -172,7 +183,7 @@ exit_gracefully($process->pid);
($fh, $tmpfile) = tempfile();
say $fh "# i3 config file (v4)";
say $fh "font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1";
say $fh "ipc-socket /tmp/nestedcons";
say $fh "ipc-socket $socketpath";
say $fh q|assign "special" → ~|;
close($fh);
@ -181,6 +192,9 @@ $i3cmd = "exec " . abs_path("../i3") . " -V -d all --disable-signalhandler -c $t
$process = Proc::Background->new($i3cmd);
sleep 1;
# force update of the cached socket path in lib/i3test
get_socket_path(0);
diag("pid = " . $process->pid);
$tmp = fresh_workspace;