1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
11 #include <ecoli_string.h>
12 #include <ecoli_malloc.h>
13 #include <ecoli_keyval.h>
14 #include <ecoli_node.h>
15 #include <ecoli_log.h>
16 #include <ecoli_test.h>
17 #include <ecoli_config.h>
19 EC_LOG_TYPE_REGISTER(config);
21 const char *ec_config_reserved_keys[] = {
29 __ec_config_dump(FILE *out, const char *key, const struct ec_config *config,
32 ec_config_dict_validate(const struct ec_keyval *dict,
33 const struct ec_config_schema *schema);
36 ec_config_key_is_reserved(const char *name)
40 for (i = 0; i < EC_COUNT_OF(ec_config_reserved_keys); i++) {
41 if (!strcmp(name, ec_config_reserved_keys[i]))
47 /* return ec_value type as a string */
49 ec_config_type_str(enum ec_config_type type)
52 case EC_CONFIG_TYPE_BOOL: return "bool";
53 case EC_CONFIG_TYPE_INT64: return "int64";
54 case EC_CONFIG_TYPE_UINT64: return "uint64";
55 case EC_CONFIG_TYPE_STRING: return "string";
56 case EC_CONFIG_TYPE_NODE: return "node";
57 case EC_CONFIG_TYPE_LIST: return "list";
58 case EC_CONFIG_TYPE_DICT: return "dict";
59 default: return "unknown";
64 ec_config_schema_len(const struct ec_config_schema *schema)
70 for (i = 0; schema[i].type != EC_CONFIG_TYPE_NONE; i++)
76 __ec_config_schema_validate(const struct ec_config_schema *schema,
77 enum ec_config_type type)
82 if (type == EC_CONFIG_TYPE_LIST) {
83 if (schema[0].key != NULL) {
85 EC_LOG(EC_LOG_ERR, "list schema key must be NULL\n");
88 } else if (type == EC_CONFIG_TYPE_DICT) {
89 for (i = 0; schema[i].type != EC_CONFIG_TYPE_NONE; i++) {
90 if (schema[i].key == NULL) {
93 "dict schema key should not be NULL\n");
99 EC_LOG(EC_LOG_ERR, "invalid schema type\n");
103 for (i = 0; schema[i].type != EC_CONFIG_TYPE_NONE; i++) {
104 if (schema[i].key != NULL &&
105 ec_config_key_is_reserved(schema[i].key)) {
108 "key name <%s> is reserved\n", schema[i].key);
111 /* check for duplicate name if more than one element */
112 for (j = i + 1; schema[j].type != EC_CONFIG_TYPE_NONE; j++) {
113 if (!strcmp(schema[i].key, schema[j].key)) {
116 "duplicate key <%s> in schema\n",
122 switch (schema[i].type) {
123 case EC_CONFIG_TYPE_BOOL:
124 case EC_CONFIG_TYPE_INT64:
125 case EC_CONFIG_TYPE_UINT64:
126 case EC_CONFIG_TYPE_STRING:
127 case EC_CONFIG_TYPE_NODE:
128 if (schema[i].subschema != NULL || ec_config_schema_len(
129 schema[i].subschema) != 0) {
132 "key <%s> should not have subtype/subschema\n",
137 case EC_CONFIG_TYPE_LIST:
138 if (schema[i].subschema == NULL || ec_config_schema_len(
139 schema[i].subschema) != 1) {
142 "key <%s> must have subschema of length 1\n",
147 case EC_CONFIG_TYPE_DICT:
148 if (schema[i].subschema == NULL || ec_config_schema_len(
149 schema[i].subschema) == 0) {
152 "key <%s> must have subschema\n",
158 EC_LOG(EC_LOG_ERR, "invalid type for key <%s>\n",
164 if (schema[i].subschema == NULL)
167 ret = __ec_config_schema_validate(schema[i].subschema,
170 EC_LOG(EC_LOG_ERR, "cannot parse subschema %s%s\n",
171 schema[i].key ? "key=" : "",
172 schema[i].key ? : "");
181 ec_config_schema_validate(const struct ec_config_schema *schema)
183 return __ec_config_schema_validate(schema, EC_CONFIG_TYPE_DICT);
187 __ec_config_schema_dump(FILE *out, const struct ec_config_schema *schema,
192 for (i = 0; schema[i].type != EC_CONFIG_TYPE_NONE; i++) {
193 fprintf(out, "%*s" "%s%s%stype=%s desc='%s'\n",
195 schema[i].key ? "key=": "",
196 schema[i].key ? : "",
197 schema[i].key ? " ": "",
198 ec_config_type_str(schema[i].type),
200 if (schema[i].subschema == NULL)
202 __ec_config_schema_dump(out, schema[i].subschema,
208 ec_config_schema_dump(FILE *out, const struct ec_config_schema *schema)
210 fprintf(out, "------------------- schema dump:\n");
212 if (schema == NULL) {
213 fprintf(out, "no schema\n");
217 __ec_config_schema_dump(out, schema, 0);
220 enum ec_config_type ec_config_get_type(const struct ec_config *config)
226 ec_config_bool(bool boolean)
228 struct ec_config *value = NULL;
230 value = ec_calloc(1, sizeof(*value));
234 value->type = EC_CONFIG_TYPE_BOOL;
235 value->boolean = boolean;
241 ec_config_i64(int64_t i64)
243 struct ec_config *value = NULL;
245 value = ec_calloc(1, sizeof(*value));
249 value->type = EC_CONFIG_TYPE_INT64;
256 ec_config_u64(uint64_t u64)
258 struct ec_config *value = NULL;
260 value = ec_calloc(1, sizeof(*value));
264 value->type = EC_CONFIG_TYPE_UINT64;
270 /* duplicate string */
272 ec_config_string(const char *string)
274 struct ec_config *value = NULL;
280 s = ec_strdup(string);
284 value = ec_calloc(1, sizeof(*value));
288 value->type = EC_CONFIG_TYPE_STRING;
299 /* "consume" the node */
301 ec_config_node(struct ec_node *node)
303 struct ec_config *value = NULL;
308 value = ec_calloc(1, sizeof(*value));
312 value->type = EC_CONFIG_TYPE_NODE;
326 struct ec_config *value = NULL;
327 struct ec_keyval *dict = NULL;
333 value = ec_calloc(1, sizeof(*value));
337 value->type = EC_CONFIG_TYPE_DICT;
343 ec_keyval_free(dict);
351 struct ec_config *value = NULL;
353 value = ec_calloc(1, sizeof(*value));
357 value->type = EC_CONFIG_TYPE_LIST;
358 TAILQ_INIT(&value->list);
363 const struct ec_config_schema *
364 ec_config_schema_lookup(const struct ec_config_schema *schema,
369 for (i = 0; schema[i].type != EC_CONFIG_TYPE_NONE; i++) {
370 if (!strcmp(key, schema[i].key))
379 ec_config_free(struct ec_config *value)
384 switch (value->type) {
385 case EC_CONFIG_TYPE_STRING:
386 ec_free(value->string);
388 case EC_CONFIG_TYPE_NODE:
389 ec_node_free(value->node);
391 case EC_CONFIG_TYPE_LIST:
392 while (!TAILQ_EMPTY(&value->list)) {
394 v = TAILQ_FIRST(&value->list);
395 TAILQ_REMOVE(&value->list, v, next);
399 case EC_CONFIG_TYPE_DICT:
400 ec_keyval_free(value->dict);
410 ec_config_list_cmp(const struct ec_config_list *list1,
411 const struct ec_config_list *list2)
413 const struct ec_config *v1, *v2;
415 for (v1 = TAILQ_FIRST(list1), v2 = TAILQ_FIRST(list2);
416 v1 != NULL && v2 != NULL;
417 v1 = TAILQ_NEXT(v1, next), v2 = TAILQ_NEXT(v2, next)) {
418 if (ec_config_cmp(v1, v2))
421 if (v1 != NULL || v2 != NULL)
427 /* XXX -> ec_keyval_cmp() */
429 ec_config_dict_cmp(const struct ec_keyval *d1,
430 const struct ec_keyval *d2)
432 const struct ec_config *v1, *v2;
433 struct ec_keyval_iter *iter = NULL;
436 if (ec_keyval_len(d1) != ec_keyval_len(d2))
439 for (iter = ec_keyval_iter(d1);
440 ec_keyval_iter_valid(iter);
441 ec_keyval_iter_next(iter)) {
442 key = ec_keyval_iter_get_key(iter);
443 v1 = ec_keyval_iter_get_val(iter);
444 v2 = ec_keyval_get(d2, key);
446 if (ec_config_cmp(v1, v2))
450 ec_keyval_iter_free(iter);
454 ec_keyval_iter_free(iter);
459 ec_config_cmp(const struct ec_config *value1,
460 const struct ec_config *value2)
462 if (value1 == NULL || value2 == NULL) {
467 if (value1->type != value2->type)
470 switch (value1->type) {
471 case EC_CONFIG_TYPE_BOOL:
472 if (value1->boolean == value2->boolean)
474 case EC_CONFIG_TYPE_INT64:
475 if (value1->i64 == value2->i64)
477 case EC_CONFIG_TYPE_UINT64:
478 if (value1->u64 == value2->u64)
480 case EC_CONFIG_TYPE_STRING:
481 if (!strcmp(value1->string, value2->string))
483 case EC_CONFIG_TYPE_NODE:
484 if (value1->node == value2->node)
486 case EC_CONFIG_TYPE_LIST:
487 return ec_config_list_cmp(&value1->list, &value2->list);
488 case EC_CONFIG_TYPE_DICT:
489 return ec_config_dict_cmp(value1->dict, value2->dict);
498 ec_config_list_validate(const struct ec_config_list *list,
499 const struct ec_config_schema *sch)
501 const struct ec_config *value;
503 TAILQ_FOREACH(value, list, next) {
504 if (value->type != sch->type) {
509 if (value->type == EC_CONFIG_TYPE_LIST) {
510 if (ec_config_list_validate(&value->list,
513 } else if (value->type == EC_CONFIG_TYPE_DICT) {
514 if (ec_config_dict_validate(value->dict,
524 ec_config_dict_validate(const struct ec_keyval *dict,
525 const struct ec_config_schema *schema)
527 const struct ec_config *value;
528 struct ec_keyval_iter *iter = NULL;
529 const struct ec_config_schema *sch;
532 for (iter = ec_keyval_iter(dict);
533 ec_keyval_iter_valid(iter);
534 ec_keyval_iter_next(iter)) {
536 key = ec_keyval_iter_get_key(iter);
537 value = ec_keyval_iter_get_val(iter);
538 sch = ec_config_schema_lookup(schema, key);
539 if (sch == NULL || sch->type != value->type) {
543 if (value->type == EC_CONFIG_TYPE_LIST) {
544 if (ec_config_list_validate(&value->list,
547 } else if (value->type == EC_CONFIG_TYPE_DICT) {
548 if (ec_config_dict_validate(value->dict,
554 ec_keyval_iter_free(iter);
558 ec_keyval_iter_free(iter);
563 ec_config_validate(const struct ec_config *dict,
564 const struct ec_config_schema *schema)
566 if (dict->type != EC_CONFIG_TYPE_DICT || schema == NULL) {
571 if (ec_config_dict_validate(dict->dict, schema) < 0)
581 ec_config_dict_get(const struct ec_config *config, const char *key)
583 if (config == NULL) {
588 if (config->type != EC_CONFIG_TYPE_DICT) {
593 return ec_keyval_get(config->dict, key);
597 ec_config_list_first(struct ec_config *list)
599 if (list == NULL || list->type != EC_CONFIG_TYPE_LIST) {
604 return TAILQ_FIRST(&list->list);
608 ec_config_list_next(struct ec_config *list, struct ec_config *config)
611 return TAILQ_NEXT(config, next);
614 /* value is consumed */
615 int ec_config_dict_set(struct ec_config *config, const char *key,
616 struct ec_config *value)
618 void (*free_cb)(struct ec_config *) = ec_config_free;
620 if (config == NULL || key == NULL || value == NULL) {
624 if (config->type != EC_CONFIG_TYPE_DICT) {
629 return ec_keyval_set(config->dict, key, value,
630 (void (*)(void *))free_cb);
633 ec_config_free(value);
637 int ec_config_dict_del(struct ec_config *config, const char *key)
639 if (config == NULL || key == NULL) {
643 if (config->type != EC_CONFIG_TYPE_DICT) {
648 return ec_keyval_del(config->dict, key);
651 /* value is consumed */
653 ec_config_list_add(struct ec_config *list,
654 struct ec_config *value)
656 if (list == NULL || list->type != EC_CONFIG_TYPE_LIST || value == NULL) {
661 TAILQ_INSERT_TAIL(&list->list, value, next);
666 ec_config_free(value);
670 int ec_config_list_del(struct ec_config *list, struct ec_config *config)
672 if (list == NULL || list->type != EC_CONFIG_TYPE_LIST) {
677 TAILQ_REMOVE(&list->list, config, next);
678 ec_config_free(config);
682 static struct ec_config *
683 ec_config_list_dup(const struct ec_config_list *list)
685 struct ec_config *dup = NULL, *v, *value;
687 dup = ec_config_list();
691 TAILQ_FOREACH(v, list, next) {
692 value = ec_config_dup(v);
695 if (ec_config_list_add(dup, value) < 0)
706 static struct ec_config *
707 ec_config_dict_dup(const struct ec_keyval *dict)
709 struct ec_config *dup = NULL, *value;
710 struct ec_keyval_iter *iter = NULL;
713 dup = ec_config_dict();
717 for (iter = ec_keyval_iter(dict);
718 ec_keyval_iter_valid(iter);
719 ec_keyval_iter_next(iter)) {
720 key = ec_keyval_iter_get_key(iter);
721 value = ec_config_dup(ec_keyval_iter_get_val(iter));
724 if (ec_config_dict_set(dup, key, value) < 0)
727 ec_keyval_iter_free(iter);
733 ec_keyval_iter_free(iter);
738 ec_config_dup(const struct ec_config *config)
740 if (config == NULL) {
745 switch (config->type) {
746 case EC_CONFIG_TYPE_BOOL:
747 return ec_config_bool(config->boolean);
748 case EC_CONFIG_TYPE_INT64:
749 return ec_config_i64(config->i64);
750 case EC_CONFIG_TYPE_UINT64:
751 return ec_config_u64(config->u64);
752 case EC_CONFIG_TYPE_STRING:
753 return ec_config_string(config->string);
754 case EC_CONFIG_TYPE_NODE:
755 return ec_config_node(ec_node_clone(config->node));
756 case EC_CONFIG_TYPE_LIST:
757 return ec_config_list_dup(&config->list);
758 case EC_CONFIG_TYPE_DICT:
759 return ec_config_dict_dup(config->dict);
769 ec_config_list_dump(FILE *out, const struct ec_config_list *list,
772 const struct ec_config *v;
774 fprintf(out, "%*s" "type=list:\n", (int)indent * 4, "");
776 TAILQ_FOREACH(v, list, next) {
777 if (__ec_config_dump(out, NULL, v, indent + 1) < 0)
785 ec_config_dict_dump(FILE *out, const struct ec_keyval *dict,
788 const struct ec_config *value;
789 struct ec_keyval_iter *iter;
792 fprintf(out, "%*s" "type=dict:\n", (int)indent * 4, "");
793 for (iter = ec_keyval_iter(dict);
794 ec_keyval_iter_valid(iter);
795 ec_keyval_iter_next(iter)) {
796 key = ec_keyval_iter_get_key(iter);
797 value = ec_keyval_iter_get_val(iter);
798 if (__ec_config_dump(out, key, value, indent + 1) < 0)
801 ec_keyval_iter_free(iter);
805 ec_keyval_iter_free(iter);
810 __ec_config_dump(FILE *out, const char *key, const struct ec_config *value,
813 char *val_str = NULL;
815 switch (value->type) {
816 case EC_CONFIG_TYPE_BOOL:
818 ec_asprintf(&val_str, "true");
820 ec_asprintf(&val_str, "false");
822 case EC_CONFIG_TYPE_INT64:
823 ec_asprintf(&val_str, "%"PRIu64, value->u64);
825 case EC_CONFIG_TYPE_UINT64:
826 ec_asprintf(&val_str, "%"PRIi64, value->i64);
828 case EC_CONFIG_TYPE_STRING:
829 ec_asprintf(&val_str, "%s", value->string);
831 case EC_CONFIG_TYPE_NODE:
832 ec_asprintf(&val_str, "%p", value->node);
834 case EC_CONFIG_TYPE_LIST:
835 return ec_config_list_dump(out, &value->list, indent);
836 case EC_CONFIG_TYPE_DICT:
837 return ec_config_dict_dump(out, value->dict, indent);
843 /* errno is already set on error */
847 fprintf(out, "%*s" "%s%s%stype=%s val=%s\n", (int)indent * 4, "",
851 ec_config_type_str(value->type), val_str);
862 ec_config_dump(FILE *out, const struct ec_config *config)
864 fprintf(out, "------------------- config dump:\n");
866 if (config == NULL) {
867 fprintf(out, "no config\n");
871 if (__ec_config_dump(out, NULL, config, 0) < 0)
872 fprintf(out, "error while dumping\n");
875 /* LCOV_EXCL_START */
876 static const struct ec_config_schema sch_intlist_elt[] = {
878 .desc = "This is a description for int",
879 .type = EC_CONFIG_TYPE_INT64,
882 .type = EC_CONFIG_TYPE_NONE,
886 static const struct ec_config_schema sch_dict[] = {
889 .desc = "This is a description for int",
890 .type = EC_CONFIG_TYPE_INT64,
894 .desc = "This is a description for int2",
895 .type = EC_CONFIG_TYPE_INT64,
898 .type = EC_CONFIG_TYPE_NONE,
902 static const struct ec_config_schema sch_dictlist_elt[] = {
904 .desc = "This is a description for dict",
905 .type = EC_CONFIG_TYPE_DICT,
906 .subschema = sch_dict,
909 .type = EC_CONFIG_TYPE_NONE,
913 static const struct ec_config_schema sch_baseconfig[] = {
916 .desc = "This is a description for bool",
917 .type = EC_CONFIG_TYPE_BOOL,
921 .desc = "This is a description for int",
922 .type = EC_CONFIG_TYPE_INT64,
926 .desc = "This is a description for string",
927 .type = EC_CONFIG_TYPE_STRING,
931 .desc = "This is a description for node",
932 .type = EC_CONFIG_TYPE_NODE,
936 .desc = "This is a description for list",
937 .type = EC_CONFIG_TYPE_LIST,
938 .subschema = sch_intlist_elt,
941 .key = "my_dictlist",
942 .desc = "This is a description for list",
943 .type = EC_CONFIG_TYPE_LIST,
944 .subschema = sch_dictlist_elt,
947 .type = EC_CONFIG_TYPE_NONE,
951 static int ec_config_testcase(void)
953 struct ec_node *node = NULL;
954 struct ec_keyval *dict = NULL;
955 const struct ec_config *value = NULL;
956 struct ec_config *config = NULL, *config2 = NULL;
957 struct ec_config *list = NULL, *subconfig = NULL;
958 struct ec_config *list_, *config_;
962 testres |= EC_TEST_CHECK(ec_config_key_is_reserved("id"),
963 "'id' should be reserved");
964 testres |= EC_TEST_CHECK(!ec_config_key_is_reserved("foo"),
965 "'foo' should not be reserved");
967 node = ec_node("empty", EC_NO_ID);
971 if (ec_config_schema_validate(sch_baseconfig) < 0) {
972 EC_LOG(EC_LOG_ERR, "invalid config schema\n");
976 ec_config_schema_dump(stdout, sch_baseconfig);
978 config = ec_config_dict();
982 ret = ec_config_dict_set(config, "my_bool", ec_config_bool(true));
983 testres |= EC_TEST_CHECK(ret == 0, "cannot set boolean");
984 value = ec_config_dict_get(config, "my_bool");
985 testres |= EC_TEST_CHECK(
987 value->type == EC_CONFIG_TYPE_BOOL &&
988 value->boolean == true,
989 "unexpected boolean value");
991 ret = ec_config_dict_set(config, "my_int", ec_config_i64(1234));
992 testres |= EC_TEST_CHECK(ret == 0, "cannot set int");
993 value = ec_config_dict_get(config, "my_int");
994 testres |= EC_TEST_CHECK(
996 value->type == EC_CONFIG_TYPE_INT64 &&
998 "unexpected int value");
1000 testres |= EC_TEST_CHECK(
1001 ec_config_validate(config, sch_baseconfig) == 0,
1002 "cannot validate config\n");
1004 ret = ec_config_dict_set(config, "my_string", ec_config_string("toto"));
1005 testres |= EC_TEST_CHECK(ret == 0, "cannot set string");
1006 value = ec_config_dict_get(config, "my_string");
1007 testres |= EC_TEST_CHECK(
1009 value->type == EC_CONFIG_TYPE_STRING &&
1010 !strcmp(value->string, "toto"),
1011 "unexpected string value");
1013 list = ec_config_list();
1017 subconfig = ec_config_dict();
1018 if (subconfig == NULL)
1021 ret = ec_config_dict_set(subconfig, "my_int", ec_config_i64(1));
1022 testres |= EC_TEST_CHECK(ret == 0, "cannot set int");
1023 value = ec_config_dict_get(subconfig, "my_int");
1024 testres |= EC_TEST_CHECK(
1026 value->type == EC_CONFIG_TYPE_INT64 &&
1028 "unexpected int value");
1030 ret = ec_config_dict_set(subconfig, "my_int2", ec_config_i64(2));
1031 testres |= EC_TEST_CHECK(ret == 0, "cannot set int");
1032 value = ec_config_dict_get(subconfig, "my_int2");
1033 testres |= EC_TEST_CHECK(
1035 value->type == EC_CONFIG_TYPE_INT64 &&
1037 "unexpected int value");
1039 testres |= EC_TEST_CHECK(
1040 ec_config_validate(subconfig, sch_dict) == 0,
1041 "cannot validate subconfig\n");
1043 ret = ec_config_list_add(list, subconfig);
1044 subconfig = NULL; /* freed */
1045 testres |= EC_TEST_CHECK(ret == 0, "cannot add in list");
1047 subconfig = ec_config_dict();
1048 if (subconfig == NULL)
1051 ret = ec_config_dict_set(subconfig, "my_int", ec_config_i64(3));
1052 testres |= EC_TEST_CHECK(ret == 0, "cannot set int");
1053 value = ec_config_dict_get(subconfig, "my_int");
1054 testres |= EC_TEST_CHECK(
1056 value->type == EC_CONFIG_TYPE_INT64 &&
1058 "unexpected int value");
1060 ret = ec_config_dict_set(subconfig, "my_int2", ec_config_i64(4));
1061 testres |= EC_TEST_CHECK(ret == 0, "cannot set int");
1062 value = ec_config_dict_get(subconfig, "my_int2");
1063 testres |= EC_TEST_CHECK(
1065 value->type == EC_CONFIG_TYPE_INT64 &&
1067 "unexpected int value");
1069 testres |= EC_TEST_CHECK(
1070 ec_config_validate(subconfig, sch_dict) == 0,
1071 "cannot validate subconfig\n");
1073 ret = ec_config_list_add(list, subconfig);
1074 subconfig = NULL; /* freed */
1075 testres |= EC_TEST_CHECK(ret == 0, "cannot add in list");
1077 ret = ec_config_dict_set(config, "my_dictlist", list);
1079 testres |= EC_TEST_CHECK(ret == 0, "cannot set list");
1081 testres |= EC_TEST_CHECK(
1082 ec_config_validate(config, sch_baseconfig) == 0,
1083 "cannot validate config\n");
1085 list_ = ec_config_dict_get(config, "my_dictlist");
1086 for (config_ = ec_config_list_first(list_); config_ != NULL;
1087 config_ = ec_config_list_next(list_, config_)) {
1088 ec_config_dump(stdout, config_);
1091 ec_config_dump(stdout, config);
1093 config2 = ec_config_dup(config);
1094 testres |= EC_TEST_CHECK(config2 != NULL, "cannot duplicate config");
1095 testres |= EC_TEST_CHECK(
1096 ec_config_cmp(config, config2) == 0,
1097 "fail to compare config");
1098 ec_config_free(config2);
1101 /* remove the first element */
1102 ec_config_list_del(list_, ec_config_list_first(list_));
1103 testres |= EC_TEST_CHECK(
1104 ec_config_validate(config, sch_baseconfig) == 0,
1105 "cannot validate config\n");
1107 ec_config_dump(stdout, config);
1109 ec_config_free(list);
1110 ec_config_free(subconfig);
1111 ec_config_free(config);
1112 ec_keyval_free(dict);
1118 ec_config_free(list);
1119 ec_config_free(subconfig);
1120 ec_config_free(config);
1121 ec_config_free(config2);
1122 ec_keyval_free(dict);
1127 /* LCOV_EXCL_STOP */
1129 static struct ec_test ec_config_test = {
1131 .test = ec_config_testcase,
1134 EC_TEST_REGISTER(ec_config_test);