]> git.sur5r.net Git - i3/i3.github.io/blobdiff - docs/testsuite.html
Change copyright notice to show 2009-present
[i3/i3.github.io] / docs / testsuite.html
index ca7b75f893220e121cdc86c5668c057e73a0c63a..4c3084fa018d8e5e9a5c2f189e680878e56fa3e6 100644 (file)
@@ -2,9 +2,9 @@
     "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">\r
 <head>\r
-<link rel="icon" type="image/png" href="/favicon.png">\r
+<link rel="icon" type="image/x-icon" href="/favicon.ico">\r
 <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />\r
-<meta name="generator" content="AsciiDoc 8.6.9" />\r
+<meta name="generator" content="AsciiDoc 8.6.10" />\r
 <title>i3: i3 testsuite</title>\r
 <link rel="stylesheet" href="/css/style.css" type="text/css" />\r
 <link rel="stylesheet" href="/css/xhtml11.css" type="text/css" />\r
@@ -22,8 +22,9 @@ document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); a
                         <ul id="nav">\r
                                 <li><a style="border-bottom: 2px solid #fff" href="/docs">Docs</a></li>\r
                                 <li><a href="/screenshots">Screens</a></li>\r
+                                <li><a href="https://www.reddit.com/r/i3wm/">FAQ</a></li>\r
                                 <li><a href="/contact">Contact</a></li>\r
-                                <li><a href="http://bugs.i3wm.org/">Bugs</a></li>\r
+                                <li><a href="https://github.com/i3/i3/issues">Bugs</a></li>\r
                         </ul>\r
         <br style="clear: both">\r
 <div id="content">\r
@@ -32,9 +33,9 @@ document.addEventListener("DOMContentLoaded", function(){asciidoc.footnotes(); a
 <span id="author">Michael Stapelberg</span><br />\r
 <span id="email"><tt>&lt;<a href="mailto:michael@i3wm.org">michael@i3wm.org</a>&gt;</tt></span><br />\r
 <span id="revdate">September 2012</span>\r
-<div id="toc">
-  <div id="toctitle">Table of Contents</div>
-  <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
+<div id="toc">\r
+  <div id="toctitle">Table of Contents</div>\r
+  <noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>\r
 </div>\r
 </div>\r
 <div id="preamble">\r
@@ -84,14 +85,14 @@ The "Modern Perl" book, which can be found at
 <p>\r
 The latest Perl documentation of the "i3test" (general testcase setup) and\r
    "i3test::Test" (additional test instructions) modules:\r
-   <a href="http://build.i3wm.org/docs/lib-i3test.html">http://build.i3wm.org/docs/lib-i3test.html</a> respectively\r
-   <a href="http://build.i3wm.org/docs/lib-i3test-test.html">http://build.i3wm.org/docs/lib-i3test-test.html</a>\r
+   <a href="https://build.i3wm.org/docs/lib-i3test.html">https://build.i3wm.org/docs/lib-i3test.html</a> respectively\r
+   <a href="https://build.i3wm.org/docs/lib-i3test-test.html">https://build.i3wm.org/docs/lib-i3test-test.html</a>\r
 </p>\r
 </li>\r
 <li>\r
 <p>\r
 The latest documentation on i3’s IPC interface:\r
-   <a href="http://build.i3wm.org/docs/ipc.html">http://build.i3wm.org/docs/ipc.html</a>\r
+   <a href="https://build.i3wm.org/docs/ipc.html">https://build.i3wm.org/docs/ipc.html</a>\r
 </p>\r
 </li>\r
 </ol></div>\r
@@ -138,11 +139,16 @@ to install all of them.</p></div>
 client, simply called <tt>cpan</tt>. It comes with every Perl installation and can be\r
 used to install the testsuite. Many users prefer to use the more modern\r
 <tt>cpanminus</tt> instead, though (because it asks no questions and just works):</p></div>\r
+<div class="paragraph"><p>The tests additionally require <tt>Xephyr(1)</tt> to run a nested X server. Install\r
+<tt>xserver-xephyr</tt> on Debian or <tt>xorg-server-xephyr</tt> on Arch Linux.</p></div>\r
 <div class="listingblock">\r
 <div class="title">Installing testsuite dependencies using cpanminus (preferred)</div>\r
 <div class="content">\r
 <pre><tt>$ cd ~/i3/testcases\r
 $ sudo apt-get install cpanminus\r
+$ sudo cpanm .\r
+$ cd ~/i3/AnyEvent-I3\r
+$ sudo cpanm Module::Install\r
 $ sudo cpanm .</tt></pre>\r
 </div></div>\r
 <div class="paragraph"><p>If you don’t want to use cpanminus for some reason, the same works with cpan:</p></div>\r
@@ -150,10 +156,13 @@ $ sudo cpanm .</tt></pre>
 <div class="title">Installing testsuite dependencies using cpan</div>\r
 <div class="content">\r
 <pre><tt>$ cd ~/i3/testcases\r
+$ sudo cpan .\r
+$ cd ~/i3/AnyEvent-I3\r
+$ sudo cpan Module::Install\r
 $ sudo cpan .</tt></pre>\r
 </div></div>\r
 <div class="paragraph"><p>In case you don’t have root permissions, you can also install into your home\r
-directory, see <a href="http://michael.stapelberg.de/cpan/">http://michael.stapelberg.de/cpan/</a></p></div>\r
+directory, see <a href="https://michael.stapelberg.de/cpan/">https://michael.stapelberg.de/cpan/</a></p></div>\r
 </div>\r
 <div class="sect2">\r
 <h3 id="_mechanisms">3.2. Mechanisms</h3>\r
@@ -165,11 +174,24 @@ more testcases. Also, it takes care of starting up a separate instance of i3
 with an appropriate configuration file and creates a folder for each run\r
 containing the appropriate i3 logfile for each testcase. The latest folder can\r
 always be found under the symlink <tt>latest/</tt>. Unless told differently, it will\r
-run the tests on a separate X server instance (using the Xdummy script).</p></div>\r
+run the tests on a separate X server instance (using Xephyr).</p></div>\r
+<div class="paragraph"><p>Xephyr will open a window where you can inspect the running test. By default,\r
+tests are run under Xvfb.</p></div>\r
 <div class="listingblock">\r
-<div class="title">Example invocation of complete-run.pl+</div>\r
+<div class="title">Example invocation of <tt>complete-run.pl</tt></div>\r
 <div class="content">\r
-<pre><tt>$ cd ~/i3/testcases\r
+<pre><tt>$ cd ~/i3\r
+\r
+$ autoreconf -fi\r
+\r
+$ mkdir -p build &amp;&amp; cd build\r
+\r
+$ ../configure\r
+\r
+$ make -j8\r
+# output omitted because it is very long\r
+\r
+$ cd testcases\r
 \r
 $ ./complete-run.pl\r
 # output omitted because it is very long\r
@@ -208,27 +230,80 @@ $ less latest/i3-log-for-04-floating.t</tt></pre>
 <div class="paragraph"><p>If your attempt to run the tests with a bare call to ./complete-run.pl fails, try this:</p></div>\r
 <div class="listingblock">\r
 <div class="content">\r
-<pre><tt>$ ./complete-run.pl --parallel=1 --keep-xdummy-output</tt></pre>\r
+<pre><tt>$ ./complete-run.pl --parallel=1 --keep-xserver-output</tt></pre>\r
+</div></div>\r
+<div class="paragraph"><p>This will show the output of Xephyr, which is the X server implementation we\r
+use for testing.</p></div>\r
+<div class="sect4">\r
+<h5 id="_make_command_tt_make_check_tt">make command: <tt>make check</tt></h5>\r
+<div class="paragraph"><p>Make check runs the i3 testsuite.\r
+You can still use ./testcases/complete-run.pl to get the interactive progress output.</p></div>\r
+<div class="listingblock">\r
+<div class="title">Example invocation of <tt>make check</tt></div>\r
+<div class="content">\r
+<pre><tt>$ cd ~/i3\r
+\r
+$ autoreconf -fi\r
+\r
+$ mkdir -p build &amp;&amp; cd build\r
+\r
+$ ../configure\r
+\r
+$ make -j8\r
+# output omitted because it is very long\r
+\r
+$ make check\r
+# output omitted because it is very long\r
+PASS: testcases/complete-run.pl\r
+============================================================================\r
+Testsuite summary for i3 4.13\r
+============================================================================\r
+# TOTAL: 1\r
+# PASS:  1\r
+# SKIP:  0\r
+# XFAIL: 0\r
+# FAIL:  0\r
+# XPASS: 0\r
+# ERROR: 0\r
+============================================================================\r
+\r
+$ less test-suite.log</tt></pre>\r
+</div></div>\r
+</div>\r
+</div>\r
+<div class="sect3">\r
+<h4 id="_coverage_testing">3.2.2. Coverage testing</h4>\r
+<div class="paragraph"><p>Coverage testing is possible with <tt>lcov</tt>, the front-end for GCC&#8217;s coverage\r
+testing tool <tt>gcov</tt>. The testcases can generate a nice html report that tells\r
+you which functions and lines were covered during a run of the tests. You can\r
+use this tool to judge how effective your tests are.</p></div>\r
+<div class="paragraph"><p>To use test coverage tools, first compile with coverage enabled.</p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>COVERAGE=1 make</tt></pre>\r
+</div></div>\r
+<div class="paragraph"><p>Then run the tests with the <tt>--coverage-testing</tt> flag.</p></div>\r
+<div class="listingblock">\r
+<div class="content">\r
+<pre><tt>./complete-run.pl --coverage-testing</tt></pre>\r
 </div></div>\r
-<div class="paragraph"><p>One common cause of failures is not having the X dummy server module\r
-installed.  Under Debian and Ubuntu this is the package\r
-<tt>xserver-xorg-video-dummy</tt>.</p></div>\r
+<div class="paragraph"><p>Then open <tt>latest/i3-coverage/index.html</tt> in your web browser.</p></div>\r
 </div>\r
 <div class="sect3">\r
-<h4 id="_ipc_interface">3.2.2. IPC interface</h4>\r
+<h4 id="_ipc_interface">3.2.3. IPC interface</h4>\r
 <div class="paragraph"><p>The testsuite makes extensive use of the IPC (Inter-Process Communication)\r
 interface which i3 provides. It is used for the startup process of i3, for\r
 terminating it cleanly and (most importantly) for modifying and getting the\r
 current state (layout tree).</p></div>\r
-<div class="paragraph"><p>See [<a href="http://i3wm.org/docs/ipc.html">http://i3wm.org/docs/ipc.html</a>] for documentation on the IPC interface.</p></div>\r
+<div class="paragraph"><p>See [<a href="https://i3wm.org/docs/ipc.html">https://i3wm.org/docs/ipc.html</a>] for documentation on the IPC interface.</p></div>\r
 </div>\r
 <div class="sect3">\r
-<h4 id="_x11_xcb">3.2.3. X11::XCB</h4>\r
+<h4 id="_x11_xcb">3.2.4. X11::XCB</h4>\r
 <div class="paragraph"><p>In order to open new windows, change attributes, get events, etc., the\r
 testsuite uses X11::XCB, a new (and quite specific to i3 at the moment) Perl\r
 module which uses the XCB protocol description to generate Perl bindings to\r
 X11. They work in a very similar way to libxcb (which i3 uses) and provide\r
-relatively high-level interfaces (objects such as <tt>X11::XCB::Window</tt>) aswell as\r
+relatively high-level interfaces (objects such as <tt>X11::XCB::Window</tt>) as well as\r
 access to the low-level interface, which is very useful when testing a window\r
 manager.</p></div>\r
 </div>\r
@@ -236,10 +311,9 @@ manager.</p></div>
 <div class="sect2">\r
 <h3 id="_filesystem_structure">3.3. Filesystem structure</h3>\r
 <div class="paragraph"><p>In the git root of i3, the testcases live in the folder <tt>testcases</tt>. This\r
-folder contains the <tt>complete-run.pl</tt> and <tt>Xdummy</tt> scripts and a base\r
-configuration file which will be used for the tests. The different testcases\r
-(their file extension is .t, not .pl) themselves can be found in the\r
-conventionally named subfolder <tt>t</tt>:</p></div>\r
+folder contains the <tt>complete-run.pl</tt> and a base configuration file which will\r
+be used for the tests. The different testcases (their file extension is .t, not\r
+.pl) themselves can be found in the conventionally named subfolder <tt>t</tt>:</p></div>\r
 <div class="listingblock">\r
 <div class="title">Filesystem structure</div>\r
 <div class="content">\r
@@ -257,8 +331,7 @@ conventionally named subfolder <tt>t</tt>:</p></div>
 │   │   ├── ...\r
 │   │   ├── omitted for brevity\r
 │   │   ├── ...\r
-│   │   └── 74-regress-focus-toggle.t\r
-│   └── Xdummy</tt></pre>\r
+│   │   └── 74-regress-focus-toggle.t</tt></pre>\r
 </div></div>\r
 </div>\r
 </div>\r
@@ -470,7 +543,7 @@ my $right = open_window($x);
 cmd 'focus left';\r
 is($x-&gt;input_focus, $left-&gt;id, 'left window focused');</tt></pre>\r
 </div></div>\r
-<div class="paragraph"><p>However, the test fails. Sometimes. Apparantly, there is a race condition in\r
+<div class="paragraph"><p>However, the test fails. Sometimes. Apparently, there is a race condition in\r
 your test. If you think about it, this is because you are using two different\r
 pieces of software: You tell i3 to update focus, i3 confirms that, and then you\r
 ask X11 to give you the current focus. There is a certain time i3 needs to\r
@@ -643,7 +716,7 @@ activation, we decreased the total amount of time necessary to run all tests
 (72 files at the time of writing) from &gt; 100 seconds to 16 seconds. This makes\r
 it significantly more attractive to run the test suite more often (or at all)\r
 during development.</p></div>\r
-<div class="paragraph"><p>An alternative approach to using socket activation is polling for the existance\r
+<div class="paragraph"><p>An alternative approach to using socket activation is polling for the existence\r
 of the IPC socket and connecting to it. While this might be slightly easier to\r
 implement, it wastes CPU time and is considerably uglier than this solution\r
 :). After all, <tt>lib/SocketActivation.pm</tt> contains only 54 SLOC.</p></div>\r
@@ -653,7 +726,9 @@ implement, it wastes CPU time and is considerably uglier than this solution
 </div>\r
 <div id="footnotes"><hr /></div>\r
 <div id="footer" lang="de">\r
-© 2009-2011 Michael Stapelberg, <a href="/impress.html">Impressum</a>\r
+    © 2009-present Michael Stapelberg,\r
+    <a href="/impress.html">Impressum</a>,\r
+    <a href="https://github.com/i3/i3.github.io">Source</a>\r
 </div>\r
 </body>\r
 </html>\r