tests: Make i3 create its temporary files in /tmp/i3-testsuite

This behavior can be avoided by passing dont_create_temp_dir => 1 to
launch_with_config (or activate_i3).

This commit fixes t/159-socketpaths.t being flaky on non-systemd computers.
This commit is contained in:
Michael Stapelberg
2012-01-30 15:51:48 +00:00
parent c1e0c38b27
commit efa1cada29
3 changed files with 10 additions and 3 deletions

View File

@ -23,7 +23,7 @@ delete $ENV{XDG_RUNTIME_DIR};
# See which files exist in /tmp before to not mistakenly check an already
# existing tmpdir of another i3 instance.
my @files_before = </tmp/i3-*>;
my $pid = launch_with_config($config, dont_add_socket_path => 1);
my $pid = launch_with_config($config, dont_add_socket_path => 1, dont_create_temp_dir => 1);
my @files_after = </tmp/i3-*>;
@files_after = grep { !($_ ~~ @files_before) } @files_after;
@ -49,7 +49,7 @@ ok(! -e "$rtdir/i3", "$rtdir/i3 does not exist yet");
$ENV{XDG_RUNTIME_DIR} = $rtdir;
$pid = launch_with_config($config, dont_add_socket_path => 1);
$pid = launch_with_config($config, dont_add_socket_path => 1, dont_create_temp_dir => 1);
ok(-d "$rtdir/i3", "$rtdir/i3 exists and is a directory");
$socketpath = "$rtdir/i3/ipc-socket." . $pid;
@ -71,7 +71,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
ipc-socket $socketpath
EOT
$pid = launch_with_config($config, dont_add_socket_path => 1);
$pid = launch_with_config($config, dont_add_socket_path => 1, dont_create_temp_dir => 1);
ok(-S $socketpath, "file $socketpath exists and is a socket");