diff mbox series

[15/16] lttng-tools: Improve ptest debugging and fix dependencies

Message ID 20230311002722.3211118-15-richard.purdie@linuxfoundation.org
State Accepted, archived
Commit 0f111c6eb1673a60663bcdd3d70c0f81bad370c4
Headers show
Series [01/16] m4/opkg/ethtool/attr/libgpg-error: Add missing bash ptest dependency | expand

Commit Message

Richard Purdie March 11, 2023, 12:27 a.m. UTC
Improve the ptest runner script:

* log output is available should any test fail to aid debugging
* document how to limit the runner to a single test
* stop hiding errors to stderr
* allow easier single test execution by avoiding path issues with PWD

Also depend upon binutils since one of the tests uses addr2line.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../lttng/lttng-tools/run-ptest               | 19 ++++++++++++++++---
 .../lttng/lttng-tools_2.13.9.bb               |  4 ++--
 2 files changed, 18 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meta/recipes-kernel/lttng/lttng-tools/run-ptest b/meta/recipes-kernel/lttng/lttng-tools/run-ptest
index c4dbe50f21b..bf99322ef21 100755
--- a/meta/recipes-kernel/lttng/lttng-tools/run-ptest
+++ b/meta/recipes-kernel/lttng/lttng-tools/run-ptest
@@ -2,6 +2,19 @@ 
 # Without --ignore-exit, the tap harness causes any FAILs within a
 # test plan to raise ERRORs; this is just noise.
 export LD_LIBRARY_PATH=FIXMEPTESTPATH/tests/utils/testapp/userspace-probe-elf-binary/.libs
-makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=$PWD top_builddir=$PWD"
-make -k -t all >/dev/null 2>&1
-exec make -k -s $makeargs check 2>/dev/null | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g'
+makeargs="LOG_DRIVER_FLAGS=--ignore-exit top_srcdir=FIXMEPTESTPATH top_builddir=FIXMEPTESTPATH"
+make -k -t all >error.log 2>&1
+# Can specify a test e.g.:
+# -C tests/regression/ check TESTS='kernel/test_callstack'
+make -k -s $makeargs check 2>error.log | sed -e 's#/tmp/tmp\...........#/tmp/tmp.XXXXXXXXXX#g'
+exitcode=$?
+if [ -e error.log ]; then
+    cat error.log
+fi
+if [ -e tests/unit/test-suite.log ]; then
+    cat tests/unit/test-suite.log
+fi
+if [ -e tests/regression/test-suite.log ]; then
+    cat tests/regression/test-suite.log
+fi
+exit $exitcode
diff --git a/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb b/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
index 340b254b46a..58c0378d66f 100644
--- a/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
+++ b/meta/recipes-kernel/lttng/lttng-tools_2.13.9.bb
@@ -15,7 +15,7 @@  include lttng-platforms.inc
 DEPENDS = "liburcu popt libxml2 util-linux bison-native"
 RDEPENDS:${PN} = "libgcc"
 RRECOMMENDS:${PN} += "${LTTNGMODULES}"
-RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep"
+RDEPENDS:${PN}-ptest += "make perl bash gawk babeltrace procps perl-module-overloading coreutils util-linux kmod ${LTTNGMODULES} sed python3-core grep binutils"
 RDEPENDS:${PN}-ptest:append:libc-glibc = " glibc-utils"
 RDEPENDS:${PN}-ptest:append:libc-musl = " musl-utils"
 # babelstats.pl wants getopt-long
@@ -84,7 +84,7 @@  do_install_ptest () {
     done
 
     # Patch in the correct path for the custom libraries a helper executable needs
-    sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!' "${D}${PTEST_PATH}/run-ptest"
+    sed -i -e 's!FIXMEPTESTPATH!${PTEST_PATH}!g' "${D}${PTEST_PATH}/run-ptest"
 
     # Prevent 'make check' from recursing into non-test subdirectories.
     sed -i -e 's!^SUBDIRS = .*!SUBDIRS = tests!' "${D}${PTEST_PATH}/Makefile"