[PATCH] testing: add section about debugging individual tests with gdb

Micah Fedke micah.fedke at collabora.co.uk
Mon Feb 6 21:50:41 UTC 2017


---
 testing.html | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/testing.html b/testing.html
index e5781fe..c005df1 100644
--- a/testing.html
+++ b/testing.html
@@ -184,4 +184,22 @@ way to learn how to leverage these API's is to study some of the existing tests
 (e.g. tests/button-test.c).
 </p>
 
+<h3>Debugging Tests</h3>
+
+<p>
+Debugging individual .la and .weston tests (those executed by weston-tests-env) using gdb is possible, but takes a few setup steps.
+First run the test normally if you have not done this already, eg.
+<pre>
+make check TESTS=button.weston
+</pre>
+- or -
+<pre>
+abs_builddir=$PWD tests/weston-tests-env button.weston
+</pre>
+The serverlog.txt file (logs/button-serverlog.txt, in this case) generated by the weston-tests-env script will now contain the full execution command used to launch weston and the test, on the line starting with "Command line:".  You can use gdb with this command line to debug the test binary.  Note that the weston-tests-env script sets a few environment variables that you will need to set as well:
+<pre>
+abs_builddir=$PWD abs_top_srcdir=$PWD WESTON_BUILD_DIR=$abs_builddir WESTON_TEST_REFERENCE_PATH=$abs_top_srcdir/tests/reference WESTON_TEST_CLIENT_PATH=$abs_builddir/button.weston
+</pre>
+Significantly, WESTON_TEST_CLIENT_PATH contains the path to the test you want to debug.  When switching between debugging different test binaries, be sure to use the command line from the appropriate serverlog.txt file as well as updating WESTON_TEST_CLIENT_PATH.
+</p>
 </body>
-- 
2.11.0



More information about the wayland-devel mailing list