public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: mornfall@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2/test/unit config_t.c Date: Sun, 18 Dec 2011 23:56:00 -0000 [thread overview] Message-ID: <20111218235636.25983.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mornfall@sourceware.org 2011-12-18 23:56:36 Modified files: test/unit : config_t.c Log message: Add a unit test for config cascade (overlay). Needs expanding though. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/unit/config_t.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4 --- LVM2/test/unit/config_t.c 2011/12/13 12:08:42 1.3 +++ LVM2/test/unit/config_t.c 2011/12/18 23:56:36 1.4 @@ -48,6 +48,18 @@ " }\n" "}\n"; +static const char *overlay = + "id = \"yoda-soda\"\n" + "flags = [\"FOO\"]\n" + "physical_volumes {\n" + " pv1 {\n" + " id = \"hgfe-dcba\"\n" + " }\n" + " pv3 {\n" + " id = \"dbcd-efgh\"\n" + " }\n" + "}\n"; + static void test_parse(void) { struct dm_config_tree *tree = dm_config_from_string(conf); @@ -119,8 +131,26 @@ dm_config_destroy(tree); } +static void test_cascade() +{ + struct dm_config_tree *t1 = dm_config_from_string(conf), + *t2 = dm_config_from_string(overlay), + *tree = dm_config_insert_cascaded_tree(t2, t1); + + CU_ASSERT(!strcmp(dm_config_tree_find_str(tree, "id", "foo"), "yoda-soda")); + CU_ASSERT(!strcmp(dm_config_tree_find_str(tree, "idt", "foo"), "foo")); + + CU_ASSERT(!strcmp(dm_config_tree_find_str(tree, "physical_volumes/pv0/bb", "foo"), "foo")); + CU_ASSERT(!strcmp(dm_config_tree_find_str(tree, "physical_volumes/pv1/id", "foo"), "hgfe-dcba")); + CU_ASSERT(!strcmp(dm_config_tree_find_str(tree, "physical_volumes/pv3/id", "foo"), "dbcd-efgh")); + + dm_config_destroy(t1); + dm_config_destroy(t2); +} + CU_TestInfo config_list[] = { { (char*)"parse", test_parse }, { (char*)"clone", test_clone }, + { (char*)"cascade", test_cascade }, CU_TEST_INFO_NULL };
next reply other threads:[~2011-12-18 23:56 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-12-18 23:56 mornfall [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-01-09 12:29 zkabelac 2011-12-11 15:45 mornfall
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20111218235636.25983.qmail@sourceware.org \ --to=mornfall@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).