Fix: lib: assert if an error occurs in `bt_message_iterator_class_finalize_method`
authorPhilippe Duplessis-Guindon <pduplessis@efficios.com>
Fri, 16 Oct 2020 18:29:05 +0000 (14:29 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 8 Feb 2021 21:05:49 +0000 (16:05 -0500)
commit4fb18ad2a9fe1fe95931f1aa2960417b9e558ae2
tree40a668c1cfdf6b7be273624501845ba27331ae68
parentc39793dd66eccee4ec1f932729aeabf680b8bab4
Fix: lib: assert if an error occurs in `bt_message_iterator_class_finalize_method`

I tried to append an error with `BT_COMP_LOGE_APPEND_CAUSE_ERRNO`
in `bt_message_iterator_class_finalize_method` from a plugin, and
there was no error. The expected behavior would be for the plugin
to fail if there is an error on the current thread after returning.

This patch adds `BT_ASSERT_POST_NO_ERROR` and the assert fails if
there is an error on the current thread after returning

With this patch, here is the following output, which is the expected behavior:
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:64 Babeltrace 2 library postcondition not satisfied.
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:66 ------------------------------------------------------------------------
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:67 Condition ID: `post:message-iterator-class-finalize-method:no-error`.
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:69 Function: bt_message_iterator_class_finalize_method().
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:70 ------------------------------------------------------------------------
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:71 Error is:
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:73 Current thread has an error
10-16 14:18:05.890 51873 51873 F LIB/ASSERT-COND bt_lib_assert_cond_failed@assert-cond.c:76 Aborting...

Add `BT_ASSERT_POST_NO_ERROR` after calling the method.

Signed-off-by: Philippe Duplessis-Guindon <pduplessis@efficios.com>
Change-Id: I6cf6118661cbe615c1f6ddc77c8b3555dca3b526
Reviewed-on: https://review.lttng.org/c/babeltrace/+/4201
CI-Build: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/graph/iterator.c
This page took 0.026861 seconds and 4 git commands to generate.