* Copyright (C) 2020 Philippe Proulx <pproulx@efficios.com>
*/
+#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include "utils.hpp"
CondTrigger::CondTrigger(const Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix) noexcept :
+ const bt2c::CStringView nameSuffix) noexcept :
_mType {type},
_mCondId {fmt::format("{}:{}", type == Type::PRE ? "pre" : "post", condId)},
- _mName {
- fmt::format("{}{}{}", condId, nameSuffix ? "-" : "", nameSuffix ? nameSuffix->data() : "")}
+ _mName {fmt::format("{}{}{}", condId, nameSuffix ? "-" : "", nameSuffix ? nameSuffix : "")}
{
}
SimpleCondTrigger::SimpleCondTrigger(std::function<void()> func, const Type type,
const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix) :
+ const bt2c::CStringView nameSuffix) :
CondTrigger {type, condId, nameSuffix},
_mFunc {std::move(func)}
{
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]);