testing: add section about debugging individual tests with gdb

Submitted by Micah Fedke on Feb. 6, 2017, 9:50 p.m.

Details

Message ID 20170206215041.464-1-micah.fedke@collabora.co.uk
State New
Headers show
Series "testing: add section about debugging individual tests with gdb" ( rev: 1 ) in Wayland

Not browsing as part of any series.

Commit Message

Micah Fedke Feb. 6, 2017, 9:50 p.m.
---
 testing.html | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Patch hide | download patch | download mbox

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>