From ba33b664622ee13ddf7ce3682986fda048868277 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 16 Feb 2024 16:30:33 -0500 Subject: [PATCH] tests/lib/conds/utils.cpp: condMain(): unset `BABELTRACE_EXEC_ON_ABORT` This test willingly makes libbabeltrace2 abort, therefore `BABELTRACE_EXEC_ON_ABORT` gets executed each time, and we don't want that in the testing context. condMain() is the closest to where the abort occurs: this means you may run `tests/lib/conds/conds-triggers` directly and `BABELTRACE_EXEC_ON_ABORT` won't impact the program. Signed-off-by: Philippe Proulx Change-Id: I72f21cfcbe2ec8b1f48ec0703c42b3b1d710283c Reviewed-on: https://review.lttng.org/c/babeltrace/+/11818 Reviewed-by: Simon Marchi --- tests/lib/conds/utils.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/lib/conds/utils.cpp b/tests/lib/conds/utils.cpp index 28f0ba40..9bf5450f 100644 --- a/tests/lib/conds/utils.cpp +++ b/tests/lib/conds/utils.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2020 Philippe Proulx */ +#include #include #include @@ -57,6 +58,14 @@ void condMain(const int argc, const char ** const argv, const CondTriggers condT if (strcmp(argv[1], "list") == 0) { listCondTriggers(condTriggers); } else if (strcmp(argv[1], "run") == 0) { + /* + * It's expected that calling `*condTriggers[index]` below + * aborts (calls bt_common_abort()). In this testing context, we + * don't want any custom abortion command to run. + */ + g_unsetenv("BABELTRACE_EXEC_ON_ABORT"); + + /* Call the trigger */ BT_ASSERT(argc >= 3); const auto index = atoi(argv[2]); -- 2.34.1