Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8acc12b771a7d4040bc136d5860311fc7646295f
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1575
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
#include "common/common.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
#include "common/common.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <babeltrace2/graph/self-component.h>
#include <babeltrace2/graph/component-const.h>
#include <babeltrace2/graph/component-source-const.h>
#include <babeltrace2/graph/self-component.h>
#include <babeltrace2/graph/component-const.h>
#include <babeltrace2/graph/component-source-const.h>
status = method(comp, self_port, (void *) other_port);
BT_LOGD("User method returned: status=%s",
bt_self_component_status_string(status));
status = method(comp, self_port, (void *) other_port);
BT_LOGD("User method returned: status=%s",
bt_self_component_status_string(status));
- BT_ASSERT_PRE(status == BT_SELF_COMPONENT_STATUS_OK ||
+ BT_ASSERT_POST(status == BT_SELF_COMPONENT_STATUS_OK ||
status == BT_SELF_COMPONENT_STATUS_ERROR ||
status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned component status: status=%s",
status == BT_SELF_COMPONENT_STATUS_ERROR ||
status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned component status: status=%s",
#include "common/assert.h"
#include "lib/assert-pre.h"
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <babeltrace2/graph/graph.h>
#include <babeltrace2/graph/graph-const.h>
#include <babeltrace2/graph/component-source-const.h>
#include <babeltrace2/graph/graph.h>
#include <babeltrace2/graph/graph-const.h>
#include <babeltrace2/graph/component-source-const.h>
comp_status = sink_class->methods.consume((void *) comp);
BT_LOGD("User method returned: status=%s",
bt_self_component_status_string(comp_status));
comp_status = sink_class->methods.consume((void *) comp);
BT_LOGD("User method returned: status=%s",
bt_self_component_status_string(comp_status));
- BT_ASSERT_PRE(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
+ BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
comp_status == BT_SELF_COMPONENT_STATUS_END ||
comp_status == BT_SELF_COMPONENT_STATUS_AGAIN ||
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
comp_status == BT_SELF_COMPONENT_STATUS_END ||
comp_status == BT_SELF_COMPONENT_STATUS_AGAIN ||
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
bt_self_component_status_string(comp_status));
#endif
bt_self_component_status_string(comp_status));
#endif
-#ifdef BT_ASSERT_PRE
- BT_ASSERT_PRE(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
+#ifdef BT_ASSERT_POST
+ BT_ASSERT_POST(comp_status == BT_SELF_COMPONENT_STATUS_OK ||
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned status: status=%s",
comp_status == BT_SELF_COMPONENT_STATUS_ERROR ||
comp_status == BT_SELF_COMPONENT_STATUS_NOMEM,
"Unexpected returned status: status=%s",
#include <babeltrace2/types.h>
#include "common/assert.h"
#include "lib/assert-pre.h"
#include <babeltrace2/types.h>
#include "common/assert.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
static
bool clock_snapshots_are_monotonic_one(
struct bt_self_component_port_input_message_iterator *iterator,
static
bool clock_snapshots_are_monotonic_one(
struct bt_self_component_port_input_message_iterator *iterator,
static
bool clock_snapshots_are_monotonic(
struct bt_self_component_port_input_message_iterator *iterator,
static
bool clock_snapshots_are_monotonic(
struct bt_self_component_port_input_message_iterator *iterator,
* stream is compatible with what we've seen before.
*/
* stream is compatible with what we've seen before.
*/
static
bool clock_classes_are_compatible_one(struct bt_self_component_port_input_message_iterator *iterator,
const struct bt_message *msg)
static
bool clock_classes_are_compatible_one(struct bt_self_component_port_input_message_iterator *iterator,
const struct bt_message *msg)
case CLOCK_EXPECTATION_NONE:
if (clock_class) {
case CLOCK_EXPECTATION_NONE:
if (clock_class) {
- BT_ASSERT_PRE_MSG("Expecting no clock class, got one: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting no clock class, got one: %![cc-]+K",
clock_class);
result = false;
goto end;
clock_class);
result = false;
goto end;
case CLOCK_EXPECTATION_ORIGIN_UNIX:
if (!clock_class) {
case CLOCK_EXPECTATION_ORIGIN_UNIX:
if (!clock_class) {
- BT_ASSERT_PRE_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
result = false;
goto end;
}
if (!bt_clock_class_origin_is_unix_epoch(clock_class)) {
result = false;
goto end;
}
if (!bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_PRE_MSG("Expecting a clock class with Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting a clock class with Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
clock_class);
result = false;
goto end;
case CLOCK_EXPECTATION_ORIGIN_OTHER_UUID:
if (!clock_class) {
case CLOCK_EXPECTATION_ORIGIN_OTHER_UUID:
if (!clock_class) {
- BT_ASSERT_PRE_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_PRE_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (!clock_class_uuid) {
clock_class);
result = false;
goto end;
}
if (!clock_class_uuid) {
- BT_ASSERT_PRE_MSG("Expecting a clock class with UUID: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting a clock class with UUID: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (bt_uuid_compare(iterator->clock_expectation.uuid, clock_class_uuid)) {
clock_class);
result = false;
goto end;
}
if (bt_uuid_compare(iterator->clock_expectation.uuid, clock_class_uuid)) {
- BT_ASSERT_PRE_MSG("Expecting a clock class with UUID, got one "
+ BT_ASSERT_POST_MSG("Expecting a clock class with UUID, got one "
"with a different UUID: %![cc-]+K, expected-uuid=%!u",
clock_class, iterator->clock_expectation.uuid);
result = false;
"with a different UUID: %![cc-]+K, expected-uuid=%!u",
clock_class, iterator->clock_expectation.uuid);
result = false;
case CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID:
if (!clock_class) {
case CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID:
if (!clock_class) {
- BT_ASSERT_PRE_MSG("Expecting a clock class, got none.");
+ BT_ASSERT_POST_MSG("Expecting a clock class, got none.");
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
result = false;
goto end;
}
if (bt_clock_class_origin_is_unix_epoch(clock_class)) {
- BT_ASSERT_PRE_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting a clock class without Unix epoch origin: %![cc-]+K",
clock_class);
result = false;
goto end;
}
if (clock_class_uuid) {
clock_class);
result = false;
goto end;
}
if (clock_class_uuid) {
- BT_ASSERT_PRE_MSG("Expecting a clock class without UUID: %![cc-]+K",
+ BT_ASSERT_POST_MSG("Expecting a clock class without UUID: %![cc-]+K",
clock_class);
result = false;
goto end;
clock_class);
result = false;
goto end;
static
bool clock_classes_are_compatible(
struct bt_self_component_port_input_message_iterator *iterator,
static
bool clock_classes_are_compatible(
struct bt_self_component_port_input_message_iterator *iterator,
BT_ASSERT(iterator->methods.next);
BT_LOGD_STR("Calling user's \"next\" method.");
BT_ASSERT(iterator->methods.next);
BT_LOGD_STR("Calling user's \"next\" method.");
status = iterator->methods.next(iterator, msgs, capacity, user_count);
status = iterator->methods.next(iterator, msgs, capacity, user_count);
+ BT_LOGD("User method returned: status=%s, msg-count=%" PRIu64,
+ bt_message_iterator_status_string(status), *user_count);
if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
if (status == BT_MESSAGE_ITERATOR_STATUS_OK) {
- BT_ASSERT_PRE(clock_classes_are_compatible(iterator, msgs, *user_count),
+ BT_ASSERT_POST(clock_classes_are_compatible(iterator, msgs, *user_count),
"Clocks are not compatible");
"Clocks are not compatible");
- BT_ASSERT_PRE(clock_snapshots_are_monotonic(iterator, msgs, *user_count),
+ BT_ASSERT_POST(clock_snapshots_are_monotonic(iterator, msgs, *user_count),
"Clock snapshots are not monotonic");
}
"Clock snapshots are not monotonic");
}
status = call_iterator_next_method(iterator,
(void *) iterator->base.msgs->pdata, MSG_BATCH_SIZE,
user_count);
status = call_iterator_next_method(iterator,
(void *) iterator->base.msgs->pdata, MSG_BATCH_SIZE,
user_count);
- BT_LOGD("User method returned: status=%s, msg-count=%" PRIu64,
- bt_message_iterator_status_string(status), *user_count);
if (status < 0) {
BT_LOGW_STR("User method failed.");
goto end;
if (status < 0) {
BT_LOGW_STR("User method failed.");
goto end;
switch (status) {
case BT_MESSAGE_ITERATOR_STATUS_OK:
switch (status) {
case BT_MESSAGE_ITERATOR_STATUS_OK:
- BT_ASSERT_PRE(*user_count <= MSG_BATCH_SIZE,
+ BT_ASSERT_POST(*user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
*user_count, MSG_BATCH_SIZE);
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
*user_count, MSG_BATCH_SIZE);
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
- BT_ASSERT_PRE(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
+ BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
(const void *) msg;
clk_snapshot = event_msg->default_cs;
(const void *) msg;
clk_snapshot = event_msg->default_cs;
- BT_ASSERT_PRE(clk_snapshot,
+ BT_ASSERT_POST(clk_snapshot,
"Event message has no default clock snapshot: %!+n",
event_msg);
break;
"Event message has no default clock snapshot: %!+n",
event_msg);
break;
(const void *) msg;
clk_snapshot = packet_msg->default_cs;
(const void *) msg;
clk_snapshot = packet_msg->default_cs;
- BT_ASSERT_PRE(clk_snapshot,
+ BT_ASSERT_POST(clk_snapshot,
"Packet message has no default clock snapshot: %!+n",
packet_msg);
break;
"Packet message has no default clock snapshot: %!+n",
packet_msg);
break;
struct bt_message_discarded_items *msg_disc_items =
(void *) msg;
struct bt_message_discarded_items *msg_disc_items =
(void *) msg;
- BT_ASSERT_PRE(msg_disc_items->default_begin_cs &&
+ BT_ASSERT_POST(msg_disc_items->default_begin_cs &&
msg_disc_items->default_end_cs,
"Discarded events/packets message has no default clock snapshots: %!+n",
msg_disc_items);
msg_disc_items->default_end_cs,
"Discarded events/packets message has no default clock snapshots: %!+n",
msg_disc_items);
*/
status = call_iterator_next_method(iterator,
&messages[0], MSG_BATCH_SIZE, &user_count);
*/
status = call_iterator_next_method(iterator,
&messages[0], MSG_BATCH_SIZE, &user_count);
- BT_LOGD("User method returned: status=%s",
- bt_message_iterator_status_string(status));
/*
* The user's "next" method must not do any action which
/*
* The user's "next" method must not do any action which
switch (status) {
case BT_MESSAGE_ITERATOR_STATUS_OK:
switch (status) {
case BT_MESSAGE_ITERATOR_STATUS_OK:
- BT_ASSERT_PRE(user_count <= MSG_BATCH_SIZE,
+ BT_ASSERT_POST(user_count <= MSG_BATCH_SIZE,
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
user_count, MSG_BATCH_SIZE);
"Invalid returned message count: greater than "
"batch size: count=%" PRIu64 ", batch-size=%u",
user_count, MSG_BATCH_SIZE);
ns_from_origin);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
ns_from_origin);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
- BT_ASSERT_PRE(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
+ BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
bt_message_iterator_status_string(status));
- BT_ASSERT_PRE(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
+ BT_ASSERT_POST(status == BT_MESSAGE_ITERATOR_STATUS_OK ||
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
status == BT_MESSAGE_ITERATOR_STATUS_ERROR ||
status == BT_MESSAGE_ITERATOR_STATUS_NOMEM ||
status == BT_MESSAGE_ITERATOR_STATUS_AGAIN,
#include "common/assert.h"
#include "common/common.h"
#include "lib/assert-pre.h"
#include "common/assert.h"
#include "common/common.h"
#include "lib/assert-pre.h"
+#include "lib/assert-post.h"
#include <babeltrace2/graph/query-executor-const.h>
#include <babeltrace2/graph/query-executor.h>
#include <babeltrace2/graph/component-class.h>
#include <babeltrace2/graph/query-executor-const.h>
#include <babeltrace2/graph/query-executor.h>
#include <babeltrace2/graph/component-class.h>
log_level, user_result);
BT_LIB_LOGD("User method returned: status=%s, %![res-]+v",
bt_query_status_string(status), *user_result);
log_level, user_result);
BT_LIB_LOGD("User method returned: status=%s, %![res-]+v",
bt_query_status_string(status), *user_result);
- BT_ASSERT_PRE(status != BT_QUERY_STATUS_OK || *user_result,
+ BT_ASSERT_POST(status != BT_QUERY_STATUS_OK || *user_result,
"User method returned `BT_QUERY_STATUS_OK` without a result.");
exec_status = (int) status;
if (query_exec->canceled) {
"User method returned `BT_QUERY_STATUS_OK` without a result.");
exec_status = (int) status;
if (query_exec->canceled) {