From 6837fdb7c4eac3e36b297e8dd1c3943bf6767884 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Mon, 12 Oct 2020 04:08:09 +0200 Subject: Bump liberty We've moved most of our configuration test in there. --- degesch.c | 54 ++++++++++-------------------------------------------- liberty | 2 +- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/degesch.c b/degesch.c index 92863da..d4c84c1 100644 --- a/degesch.c +++ b/degesch.c @@ -13768,64 +13768,30 @@ init_poller_events (struct app_context *ctx) #ifdef TESTING -static void -on_test_config_foo_change (struct config_item *item) -{ - *(bool *) item->user_data = item->value.boolean; -} - static struct config_schema g_config_test[] = { - { .name = "foo", - .comment = "baz", - .type = CONFIG_ITEM_BOOLEAN, - .default_ = "off", - .on_change = on_test_config_foo_change }, - { .name = "bar", - .type = CONFIG_ITEM_INTEGER, - .validate = config_validate_nonnegative, - .default_ = "1" }, - { .name = "foobar", - .type = CONFIG_ITEM_STRING, - .default_ = "\"qux\"" }, + { .name = "foo", .type = CONFIG_ITEM_BOOLEAN, .default_ = "off" }, + { .name = "bar", .type = CONFIG_ITEM_INTEGER, .default_ = "1" }, + { .name = "foobar", .type = CONFIG_ITEM_STRING, .default_ = "\"x\\x01\"" }, {} }; -static void -test_config_load (struct config_item *subtree, void *user_data) -{ - config_schema_apply_to_object (g_config_test, subtree, user_data); -} - static void test_config (void) { - struct config config = config_make (); - - bool b = true; - config_register_module (&config, "top", test_config_load, &b); - config_load (&config, config_item_object ()); - config_schema_call_changed (config.root); - hard_assert (b == false); - - struct config_item *invalid = config_item_integer (-1); - hard_assert (!config_item_set_from (config_item_get (config.root, - "top.bar", NULL), invalid, NULL)); - config_item_destroy (invalid); - - struct str s = str_make (); - serialize_configuration (config.root, &s); - config_load (&config, config_item_parse (s.str, s.len, false, NULL)); - str_free (&s); + struct config_item *foo = config_item_object (); + config_schema_apply_to_object (g_config_test, foo, NULL); + struct config_item *root = config_item_object (); + str_map_set (&root->value.object, "top", foo); struct strv v = strv_make (); - dump_matching_options (config.root, "*foo*", &v); + dump_matching_options (root, "*foo*", &v); hard_assert (v.len == 2); hard_assert (!strcmp (v.vector[0], "top.foo = off")); - hard_assert (!strcmp (v.vector[1], "top.foobar = \"qux\"")); + hard_assert (!strcmp (v.vector[1], "top.foobar = \"x\\x01\"")); strv_free (&v); - config_free (&config); + config_item_destroy (root); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/liberty b/liberty index e029aae..9b72304 160000 --- a/liberty +++ b/liberty @@ -1 +1 @@ -Subproject commit e029aae1d3d1884ca868c3694bdec0456b3e8267 +Subproject commit 9b723049635329feda63fab675df794e429aa151 -- cgit v1.2.3-70-g09d2