*
*/
+#include <common/error.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
{
int ret, action_idx;
struct lttng_action *list_action = NULL, *list_action_from_buffer = NULL,
- *mut_inner_action = NULL, *stop_session_action = NULL,
- *notify_action = NULL, *start_session_action = NULL;
- const struct lttng_action *const_inner_action;
+ *stop_session_action = NULL, *notify_action = NULL,
+ *start_session_action = NULL;
struct lttng_payload payload;
lttng_payload_init(&payload);
"Serialized and de-serialized list action are equal");
action_idx = 0;
- for_each_action_const (const_inner_action, list_action) {
- enum lttng_action_type inner_action_type =
- lttng_action_get_type(const_inner_action);
+ for (auto action : lttng::ctl::const_action_list_view(list_action)) {
+ enum lttng_action_type inner_action_type = lttng_action_get_type(action);
switch (action_idx) {
case 0:
ok(inner_action_type == LTTNG_ACTION_TYPE_START_SESSION,
}
action_idx = 0;
- for_each_action_mutable (mut_inner_action, list_action) {
- enum lttng_action_type inner_action_type = lttng_action_get_type(mut_inner_action);
+ for (auto action : lttng::ctl::action_list_view(list_action)) {
+ enum lttng_action_type inner_action_type = lttng_action_get_type(action);
switch (action_idx) {
case 0:
ok(inner_action_type == LTTNG_ACTION_TYPE_START_SESSION,
lttng_payload_reset(&payload);
}
-int main()
+static int _main()
{
plan_tests(NUM_TESTS);
test_action_notify();
test_action_snapshot_session();
return exit_status();
}
+
+int main()
+{
+ try {
+ return _main();
+ } catch (const std::exception& e) {
+ ERR_FMT("Unhandled exception caught by action unit test: {}", e.what());
+ abort();
+ }
+}