X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=testcases%2Ft%2F159-socketpaths.t;h=6c214d20b17ecb5ac0c5204860199462e9daa859;hb=f7565b5f3238f1229608131e6358350538e262fa;hp=eb6bd79f1be5881b7d62f24847f959e5b6661ed0;hpb=0adbffb38621192c416ac52aa6b82ac57fb6394d;p=i3%2Fi3 diff --git a/testcases/t/159-socketpaths.t b/testcases/t/159-socketpaths.t index eb6bd79f..6c214d20 100644 --- a/testcases/t/159-socketpaths.t +++ b/testcases/t/159-socketpaths.t @@ -1,11 +1,24 @@ #!perl # vim:ts=4:sw=4:expandtab -# !NO_I3_INSTANCE! will prevent complete-run.pl from starting i3 +# +# Please read the following documents before working on tests: +# • http://build.i3wm.org/docs/testsuite.html +# (or docs/testsuite) +# +# • http://build.i3wm.org/docs/lib-i3test.html +# (alternatively: perldoc ./testcases/lib/i3test.pm) +# +# • http://build.i3wm.org/docs/ipc.html +# (or docs/ipc) +# +# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf +# (unless you are already familiar with Perl) # # Tests if the various ipc_socket_path options are correctly handled # -use i3test; +use i3test i3_autostart => 0; use File::Temp qw(tempfile tempdir); +use File::Basename; use POSIX qw(getuid); use v5.10; @@ -20,11 +33,15 @@ EOT # ensure XDG_RUNTIME_DIR is not set delete $ENV{XDG_RUNTIME_DIR}; -my $pid = launch_with_config($config, 1); +my $pid = launch_with_config($config, dont_add_socket_path => 1, dont_create_temp_dir => 1); +my $socketpath = get_socket_path(0); my $folder = "/tmp/i3-" . getpwuid(getuid()); +like(dirname($socketpath), qr/^$folder/, 'temp directory matches expected pattern'); +$folder = dirname($socketpath); + ok(-d $folder, "folder $folder exists"); -my $socketpath = "$folder/ipc-socket." . $pid; +$socketpath = "$folder/ipc-socket." . $pid; ok(-S $socketpath, "file $socketpath exists and is a socket"); exit_gracefully($pid); @@ -39,7 +56,7 @@ ok(! -e "$rtdir/i3", "$rtdir/i3 does not exist yet"); $ENV{XDG_RUNTIME_DIR} = $rtdir; -$pid = launch_with_config($config, 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; @@ -48,7 +65,7 @@ ok(-S $socketpath, "file $socketpath exists and is a socket"); exit_gracefully($pid); ##################################################################### -# configuration file case: socket gets placed whereever we specify +# configuration file case: socket gets placed wherever we specify ##################################################################### my $tmpdir = tempdir(CLEANUP => 1); @@ -61,7 +78,7 @@ font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 ipc-socket $socketpath EOT -$pid = launch_with_config($config, 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");