]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/159-socketpaths.t
Merge branch 'master' into next
[i3/i3] / testcases / t / 159-socketpaths.t
index 30460fa94569332c3395f6fc3c5d01db41b137d5..c63bbbc4e12d6e8efa0cf31292c5b96a04809c7d 100644 (file)
@@ -19,9 +19,20 @@ EOT
 
 # ensure XDG_RUNTIME_DIR is not set
 delete $ENV{XDG_RUNTIME_DIR};
-my $pid = launch_with_config($config, dont_add_socket_path => 1);
+
+# 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, dont_create_temp_dir => 1);
+my @files_after = </tmp/i3-*>;
+@files_after = grep { !($_ ~~ @files_before) } @files_after;
+
+is(@files_after, 1, 'one new temp directory');
 
 my $folder = "/tmp/i3-" . getpwuid(getuid());
+like($files_after[0], qr/^$folder/, 'temp directory matches expected pattern');
+$folder = $files_after[0];
+
 ok(-d $folder, "folder $folder exists");
 my $socketpath = "$folder/ipc-socket." . $pid;
 ok(-S $socketpath, "file $socketpath exists and is a socket");
@@ -38,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;
@@ -60,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");