cli: assert that valid_parts are set for base types
This commit is contained in:
@@ -2564,8 +2564,12 @@ static const char *const *_complete_fcn_connection_type(ARGS_COMPLETE_FCN)
|
||||
GType gtype = setting_info->general->get_setting_gtype();
|
||||
const char * v;
|
||||
|
||||
if (_nm_setting_type_get_base_type_priority(gtype) == NM_SETTING_PRIORITY_INVALID)
|
||||
if (_nm_setting_type_get_base_type_priority(gtype) == NM_SETTING_PRIORITY_INVALID) {
|
||||
nm_assert(!setting_info->valid_parts);
|
||||
continue;
|
||||
}
|
||||
|
||||
nm_assert(setting_info->valid_parts);
|
||||
|
||||
v = setting_info->alias;
|
||||
if (v) {
|
||||
@@ -8150,7 +8154,12 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
|
||||
NM_META_SETTING_VALID_PART_ITEM (WIRED, FALSE),
|
||||
),
|
||||
),
|
||||
SETTING_INFO (OVS_DPDK),
|
||||
SETTING_INFO (OVS_DPDK,
|
||||
.valid_parts = NM_META_SETTING_VALID_PARTS (
|
||||
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
|
||||
NM_META_SETTING_VALID_PART_ITEM (OVS_DPDK, TRUE),
|
||||
),
|
||||
),
|
||||
SETTING_INFO_EMPTY (OVS_EXTERNAL_IDS),
|
||||
SETTING_INFO (OVS_INTERFACE,
|
||||
.valid_parts = NM_META_SETTING_VALID_PARTS (
|
||||
@@ -8164,7 +8173,12 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
|
||||
NM_META_SETTING_VALID_PART_ITEM (ETHTOOL, FALSE),
|
||||
),
|
||||
),
|
||||
SETTING_INFO (OVS_PATCH),
|
||||
SETTING_INFO (OVS_PATCH,
|
||||
.valid_parts = NM_META_SETTING_VALID_PARTS (
|
||||
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
|
||||
NM_META_SETTING_VALID_PART_ITEM (OVS_PATCH, TRUE),
|
||||
),
|
||||
),
|
||||
SETTING_INFO (OVS_PORT,
|
||||
.valid_parts = NM_META_SETTING_VALID_PARTS (
|
||||
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
|
||||
|
@@ -53,6 +53,9 @@ test_client_meta_check(void)
|
||||
|
||||
for (m = 0; m < _NM_META_SETTING_TYPE_NUM; m++) {
|
||||
const NMMetaSettingInfoEditor *info = &nm_meta_setting_infos_editor[m];
|
||||
GType gtype;
|
||||
NMSettingPriority base_priority;
|
||||
gboolean is_base_type;
|
||||
|
||||
g_assert(info);
|
||||
g_assert(info->meta_type == &nm_meta_type_setting_info_editor);
|
||||
@@ -97,6 +100,11 @@ test_client_meta_check(void)
|
||||
} else
|
||||
g_assert(!info->properties);
|
||||
|
||||
gtype = info->general->get_setting_gtype();
|
||||
base_priority = _nm_setting_type_get_base_type_priority(gtype);
|
||||
is_base_type = (base_priority != NM_SETTING_PRIORITY_INVALID);
|
||||
g_assert((!!info->valid_parts) == is_base_type);
|
||||
|
||||
if (info->valid_parts) {
|
||||
gsize i, l;
|
||||
gs_unref_hashtable GHashTable *dup = g_hash_table_new(nm_direct_hash, NULL);
|
||||
|
Reference in New Issue
Block a user