2 # vim:ts=4:sw=4:expandtab
3 # !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3
5 # Tests if the various ipc_socket_path options are correctly handled
8 use File::Temp qw(tempfile tempdir);
12 #####################################################################
13 # default case: socket will be created in /tmp/i3-<username>/ipc-socket.<pid>
14 #####################################################################
18 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
21 # ensure XDG_RUNTIME_DIR is not set
22 delete $ENV{XDG_RUNTIME_DIR};
23 my $pid = launch_with_config($config, 1);
25 my $folder = "/tmp/i3-" . getpwuid(getuid());
26 ok(-d $folder, "folder $folder exists");
27 my $socketpath = "$folder/ipc-socket." . $pid;
28 ok(-S $socketpath, "file $socketpath exists and is a socket");
30 exit_gracefully($pid);
32 #####################################################################
33 # XDG_RUNTIME_DIR case: socket gets created in $XDG_RUNTIME_DIR/i3/ipc-socket.<pid>
34 #####################################################################
36 my $rtdir = tempdir(CLEANUP => 1);
38 ok(! -e "$rtdir/i3", "$rtdir/i3 does not exist yet");
40 $ENV{XDG_RUNTIME_DIR} = $rtdir;
42 $pid = launch_with_config($config, 1);
44 ok(-d "$rtdir/i3", "$rtdir/i3 exists and is a directory");
45 $socketpath = "$rtdir/i3/ipc-socket." . $pid;
46 ok(-S $socketpath, "file $socketpath exists and is a socket");
48 exit_gracefully($pid);
50 #####################################################################
51 # configuration file case: socket gets placed whereever we specify
52 #####################################################################
54 my $tmpdir = tempdir(CLEANUP => 1);
55 $socketpath = $tmpdir . "/config.sock";
56 ok(! -e $socketpath, "$socketpath does not exist yet");
60 font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
61 ipc-socket $socketpath
64 $pid = launch_with_config($config, 1);
66 ok(-S $socketpath, "file $socketpath exists and is a socket");
68 exit_gracefully($pid);