diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2008-03-03 10:50:53 +0100 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2008-03-03 10:50:53 +0100 |
commit | 7dd0cd26d32980d4edb9db5c77c98a2b112e24cb (patch) | |
tree | 025dad49b789c0e9f2eb03d87ec386295630b3f0 /source4/lib/registry/tests/hive.c | |
parent | 80e9b72e018fb7d7f2cd5ff383e4a533b4ccc705 (diff) | |
parent | 4d4a898742a0439d3f60c84194b02901412f4679 (diff) | |
download | samba-7dd0cd26d32980d4edb9db5c77c98a2b112e24cb.tar.gz samba-7dd0cd26d32980d4edb9db5c77c98a2b112e24cb.tar.bz2 samba-7dd0cd26d32980d4edb9db5c77c98a2b112e24cb.zip |
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
Conflicts:
source/Makefile
source/build/smb_build/makefile.pm
source/librpc/config.mk
(This used to be commit 3e02fcfd3fb6683f51417ba39f4ec177494eff3e)
Diffstat (limited to 'source4/lib/registry/tests/hive.c')
-rw-r--r-- | source4/lib/registry/tests/hive.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 1dcb464d80..1e56f125c5 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -111,6 +111,38 @@ static bool test_add_subkey(struct torture_context *tctx, return true; } +static bool test_del_recursive(struct torture_context *tctx, + const void *test_data) +{ + WERROR error; + struct hive_key *subkey; + struct hive_key *subkey2; + const struct hive_key *root = (const struct hive_key *)test_data; + TALLOC_CTX *mem_ctx = tctx; + uint32_t data = 42; + + /* Create a new key under the root */ + error = hive_key_add_name(mem_ctx, root, "Parent Key", NULL, + NULL, &subkey); + torture_assert_werr_ok(tctx, error, "hive_key_add_name"); + + /* Create a new key under "Parent Key" */ + error = hive_key_add_name(mem_ctx, subkey, "Child Key", NULL, + NULL, &subkey2); + torture_assert_werr_ok(tctx, error, "hive_key_add_name"); + + /* Create a new value under "Child Key" */ + error = hive_key_set_value(subkey2, "Answer Recursive", REG_DWORD, + data_blob_talloc(mem_ctx, &data, sizeof(data))); + torture_assert_werr_ok(tctx, error, "hive_key_set_value"); + + /* Deleting "Parent Key" will also delete "Child Key" and the value. */ + error = hive_key_del(root, "Parent Key"); + torture_assert_werr_ok(tctx, error, "hive_key_del"); + + return true; +} + static bool test_flush_key(struct torture_context *tctx, void *test_data) { struct hive_key *root = (struct hive_key *)test_data; @@ -273,6 +305,11 @@ static void tcase_add_tests(struct torture_tcase *tcase) test_add_subkey); torture_tcase_add_simple_test(tcase, "flush_key", test_flush_key); + /* test_del_recursive() test must run before test_keyinfo_root(). + test_keyinfo_root() checks the number of subkeys, which verifies + the recursive delete worked properly. */ + torture_tcase_add_simple_test_const(tcase, "del_recursive", + test_del_recursive); torture_tcase_add_simple_test_const(tcase, "get_info", test_keyinfo_root); torture_tcase_add_simple_test(tcase, "get_info_nums", |