testing: add section about debugging individual tests with gdb

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


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).
+<h3>Debugging Tests</h3>
+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.
+make check TESTS=button.weston
+- or -
+abs_builddir=$PWD tests/weston-tests-env button.weston
+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:
+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
+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.