From e90971137396196095c7f4bb07ec470215c37a29 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Fri, 26 Jul 2024 10:46:40 -0400 Subject: [PATCH] Tests: Do not remove interrupted test log files by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Observed issue ============== During CI runs, builds may timeout or be killed for another reason. Those tests logs are deleted and cannot be checked for diagnostic information, warnings, or errors. Cause ===== By default, the test log for the currently running test is deleted by automake so that subsequent invocations of `make check` will re-run the test. Solution ======== Add a disable flag `--disable-precious-tests` and set `PRECIOUS_TESTS` to true by default when configuring lttng-tools. When `PRECIOUS_TOOLS` is set, all test logs in `tests/regression` will be marked as `.PRECIOUS` and subsequently not deleted when interrupted. Known drawbacks =============== This could make interrupting a test and re-running during test development more of a hassle. References ========== [1]: https://www.gnu.org/software/make/manual/html_node/Special-Targets.html [2]: https://automake.gnu.narkive.com/1TjEGbH2/delete-on-error-test-suite-log-and-precious Change-Id: I08b4a1bb29eb609827cc1c047f141f94b210effe Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- configure.ac | 12 ++++++++++++ tests/regression/Makefile.am | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/configure.ac b/configure.ac index 0a4d726d7..b6309378c 100644 --- a/configure.ac +++ b/configure.ac @@ -979,6 +979,18 @@ AS_IF([test "$test_sdt_uprobe" = "autodetect"], [ AM_CONDITIONAL([TEST_SDT_UPROBE], [test "$test_sdt_uprobe" = "yes"]) +AC_ARG_ENABLE( + [precious-tests], + AS_HELP_STRING( + [--disable-precious-tests], + [Delete log files for interrupted tests] + ), + [precious_tests=$enableval], + [precious_tests=yes] +) + +AM_CONDITIONAL([PRECIOUS_TESTS], [test x$precious_tests = xyes]) + AC_ARG_ENABLE([lib-lttng-ctl], AS_HELP_STRING([--disable-lib-lttng-ctl], [Disable the build of liblttng-ctl (only possible if no binaries that depend on it are built)])) diff --git a/tests/regression/Makefile.am b/tests/regression/Makefile.am index 5ee205026..1b790b706 100644 --- a/tests/regression/Makefile.am +++ b/tests/regression/Makefile.am @@ -143,3 +143,7 @@ TESTS += ust/linking/test_linking \ ust/ust-dl/test_ust-dl \ ust/type-declarations/test_type_declarations endif + +if PRECIOUS_TESTS +.PRECIOUS: $(TEST_LOGS) +endif -- 2.34.1