From cc09350f7980727557e6b7d23819f1b2618442f6 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 23 May 2023 11:44:36 -0400 Subject: [PATCH] tests: add a basic pre-condition assertion test There is currently no "basic" pre-condition assertion test, even though we have the support for it. Add one, so that the support code is exercised. The new test checks that passing a wrong MIP version to bt_grbt_graph_create triggers an assertion. Change-Id: Iddaa7905684e1bda3a731ab215a0e42b5eb62633 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/10056 Reviewed-by: Philippe Proulx --- tests/lib/conds/conds-triggers.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/lib/conds/conds-triggers.c b/tests/lib/conds/conds-triggers.c index 810af972..7a137052 100644 --- a/tests/lib/conds/conds-triggers.c +++ b/tests/lib/conds/conds-triggers.c @@ -9,6 +9,12 @@ #include "common/assert.h" #include "utils.h" +static +void trigger_graph_mip_version(void) +{ + bt_graph_create(292); +} + static bt_field_class *get_uint_fc(bt_self_component *self_comp) { @@ -42,6 +48,8 @@ void trigger_fc_int_set_field_value_range_null(bt_self_component *self_comp) static const struct cond_trigger triggers[] = { + COND_TRIGGER_PRE_BASIC("pre:graph-create:valid-mip-version", NULL, + trigger_graph_mip_version), COND_TRIGGER_PRE_RUN_IN_COMP_CLS_INIT( "pre:field-class-integer-set-field-value-range:valid-n", "0", -- 2.34.1