tests/lib/conds/utils.cpp: condMain(): unset `BABELTRACE_EXEC_ON_ABORT`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 16 Feb 2024 21:30:33 +0000 (16:30 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 29 Feb 2024 23:46:23 +0000 (18:46 -0500)
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 <eeppeliteloop@gmail.com>
Change-Id: I72f21cfcbe2ec8b1f48ec0703c42b3b1d710283c
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11818
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
tests/lib/conds/utils.cpp

index 28f0ba40748eecf0000e2811817eea603ac08546..9bf5450fe5bf56ab461c54e80ccab1439edc5b47 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
  */
 
+#include <glib.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -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]);
This page took 0.026778 seconds and 4 git commands to generate.