triggers.emplace_back(bt2s::make_unique<RunInCondTrigger<ClockClsCompatRunIn>>(
ClockClsCompatRunIn {msgType1, createClockCls1, msgType2, createClockCls2},
- CondTrigger::Type::Post, condId, fmt::format("{}-{}", msgType1, msgType2)));
+ CondTrigger::Type::Post, condId, 0u, fmt::format("{}-{}", msgType1, msgType2)));
}
}
};
const bt2c::CStringView nameSuffix = {})
{
return bt2s::make_unique<RunInCondTrigger<RunInDelegator>>(
- RunInDelegator::makeOnCompInit(std::move(func)), type, condId, nameSuffix);
+ RunInDelegator::makeOnCompInit(std::move(func)), type, condId, 0u, nameSuffix);
}
bt2::IntegerFieldClass::Shared createUIntFc(const bt2::SelfComponent self)
{
public:
explicit RunInCondTrigger(RunInT runIn, const Type type, const std::string& condId,
+ const std::uint64_t graphMipVersion,
const bt2c::CStringView nameSuffix = {}) :
CondTrigger {type, condId, nameSuffix},
- _mRunIn {std::move(runIn)}
+ _mRunIn {std::move(runIn)}, _mGraphMipVersion {graphMipVersion}
{
}
void operator()() noexcept override
{
- runIn(_mRunIn);
+ runIn(_mRunIn, _mGraphMipVersion);
}
private:
RunInT _mRunIn;
+ std::uint64_t _mGraphMipVersion;
};
/*
plan_tests(NR_TESTS);
TestStringClear testStringClear;
- runIn(testStringClear);
+ runIn(testStringClear, 0);
return exit_status();
}
} /* namespace */
-void runIn(RunIn& runIn)
+void runIn(RunIn& runIn, const std::uint64_t graphMipVersion)
{
const auto srcCompCls = bt2::SourceComponentClass::create<RunInSource>();
bt2::QueryExecutor::create(*srcCompCls, "object-name", runIn)->query();
/* Create graph */
- const auto graph = bt2::Graph::create(0);
+ const auto graph = bt2::Graph::create(graphMipVersion);
/* Add custom source component (executes `compCtxFunc`) */
const auto srcComp = graph->addComponent(*srcCompCls, "the-source", runIn);
/* Run graph (executes `msgIterCtxFunc`) */
graph->run();
}
+
+void forEachMipVersion(const std::function<void(std::uint64_t)>& fn)
+{
+ for (std::uint64_t v = 0; v <= bt_get_maximal_mip_version(); ++v) {
+ fn(v);
+ }
+}
/*
* Runs a simple graph (one source and one sink component), calling the
* `on*()` methods of `runIn` along the way.
+ *
+ * Use `graphMipVersion` as the graph's MIP version.
+ */
+void runIn(RunIn& runIn, std::uint64_t graphMipVersion);
+
+/*
+ * Calls `fn` for each possible MIP version.
*/
-void runIn(RunIn& runIn);
+void forEachMipVersion(const std::function<void(std::uint64_t)>& fn);
#endif /* BABELTRACE_TESTS_LIB_UTILS_RUN_IN_HPP */