autodisc: don't accept NULL values for `support-info` query `group` key
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 26 Aug 2019 20:52:33 +0000 (16:52 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Tue, 27 Aug 2019 04:02:11 +0000 (00:02 -0400)
It is not necessary to support that, and it doesn't help much in
implementing component classes.  To keep the support-info protocol a bit
simpler, let's make it mandatory that if you have a `group` key, it must
be a string.

Change-Id: I45aa0a6fb57727d73d9fea48fbebc04dc9c0d5f5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1977
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/autodisc/autodisc.c
tests/data/auto-source-discovery/grouping/bt_plugin_test.py

index 05b5ed25f2006cbaaa319ec3fdae14a6706eccc8..b69db98ab830f9ce6ed3b5cdeb5c7a8cbc056979 100644 (file)
@@ -458,17 +458,10 @@ auto_source_discovery_internal_status support_info_query_all_sources(
                                        }
 
                                        if (bt_value_map_has_entry(query_result, "group")) {
-                                               enum bt_value_type group_value_type;
-
                                                group_value = bt_value_map_borrow_entry_value_const(query_result, "group");
                                                BT_ASSERT(group_value);
 
-                                               group_value_type = bt_value_get_type(group_value);
-
-                                               if (group_value_type == BT_VALUE_TYPE_NULL) {
-                                                       /* Do as if no value was passed. */
-                                                       group_value = NULL;
-                                               } else if (bt_value_get_type(group_value) != BT_VALUE_TYPE_STRING) {
+                                               if (bt_value_get_type(group_value) != BT_VALUE_TYPE_STRING) {
                                                        BT_LOGW("babeltrace.support-info query: unexpected type for entry `group`: "
                                                                "component-class-name=source.%s.%s, input=%s, input-type=%s, "
                                                                "expected-entry-type=%s,%s, actual-entry-type=%s",
index a4d53dbd88d75b267badb2ed8b645e2698b69aaa..15b7d6021efb4c4971cc25568a947335043a9981 100644 (file)
@@ -66,13 +66,8 @@ class TestSourceExt(Base, bt2._UserSourceComponent, message_iterator_class=TestI
                 elif name.startswith('bbb'):
                     return {'weight': 0.5, 'group': 'bbb'}
                 elif name.startswith('ccc'):
-                    # Try two different ways of returning "no group", and two
-                    # different ways of returning 1 (an int and a float).
+                    # Try two different ways of returning 1 (an int and a float).
                     if name[3] == '1':
-                        return {'weight': 1, 'group': None}
-                    elif name[3] == '2':
-                        return {'weight': 1.0, 'group': None}
-                    elif name[3] == '3':
                         return 1
                     else:
                         return 1.0
This page took 0.025947 seconds and 4 git commands to generate.