]> git.sur5r.net Git - i3/i3/blobdiff - testcases/lib/SocketActivation.pm
Merge branch 'next' into master
[i3/i3] / testcases / lib / SocketActivation.pm
index 83ca92555ca5fe7391a0f739a599f24847d7423c..0f307eb3366abc04c230f068ee050fd9347d6a70 100644 (file)
@@ -62,14 +62,6 @@ sub activate_i3 {
             mkdir $ENV{XDG_RUNTIME_DIR};
         }
         $ENV{DISPLAY} = $args{display};
-        $ENV{PATH} = join(':',
-            '../i3-nagbar',
-            '../i3-msg',
-            '../i3-config-wizard',
-            '../i3bar',
-            '..',
-            $ENV{PATH}
-        );
 
         # We are about to exec, but we did not modify $^F to include $socket
         # when creating the socket (because the file descriptor could have a
@@ -96,8 +88,16 @@ sub activate_i3 {
         # the interactive signalhandler to make it crash immediately instead.
         # Also disable logging to SHM since we redirect the logs anyways.
         # Force Xinerama because we use Xdmx for multi-monitor tests.
-        my $i3cmd = abs_path("../i3") . q| -V -d all --disable-signalhandler| .
-                                        q| --shmlog-size=0 --force-xinerama|;
+        my $i3cmd = q|i3 --shmlog-size=0 --disable-signalhandler|;
+        if (!defined($args{inject_randr15})) {
+            $i3cmd .= q| --force-xinerama|;
+        }
+        if (!$args{validate_config}) {
+            # We only set logging if i3 is actually started, but not if we only
+            # validate the config file. This is to keep logging to a minimum as
+            # such a test will likely want to inspect the log file.
+            $i3cmd .= q| -V -d all|;
+        }
 
         # For convenience:
         my $outdir = $args{outdir};
@@ -107,6 +107,10 @@ sub activate_i3 {
             $i3cmd .= ' -L ' . abs_path('restart-state.golden');
         }
 
+        if ($args{validate_config}) {
+            $i3cmd .= ' -C';
+        }
+
         if ($args{valgrind}) {
             $i3cmd =
                 qq|valgrind --log-file="$outdir/valgrind-for-$test.log" | .
@@ -138,6 +142,13 @@ sub activate_i3 {
                      'sh -c "export LISTEN_PID=\$\$; ' . $cmd . '"';
         }
 
+        if ($args{inject_randr15}) {
+            # See comment in $args{strace} branch.
+            $cmd = 'test.inject_randr15 --getmonitors_reply="' .
+                   $args{inject_randr15} . '" -- ' .
+                   'sh -c "export LISTEN_PID=\$\$; ' . $cmd . '"';
+        }
+
         # We need to use the shell due to using output redirections.
         exec '/bin/sh', '-c', $cmd;
 
@@ -149,6 +160,11 @@ sub activate_i3 {
     # descriptor on the listening socket.
     $socket->close;
 
+    if ($args{validate_config}) {
+        $args{cv}->send(1);
+        return $pid;
+    }
+
     # We now connect (will succeed immediately) and send a request afterwards.
     # As soon as the reply is there, i3 is considered ready.
     my $cl = IO::Socket::UNIX->new(Peer => $args{unix_socket_path});