diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-05-22 18:59:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:08:27 -0500 |
commit | 4099637512197d2b160bd9e043b3f31382768b99 (patch) | |
tree | dd90e10ff05f497bd70d12e0d457887650112ee2 | |
parent | f76eafe7d77bb1c3bf6d93a01324d5cf4913c0b7 (diff) | |
download | samba-4099637512197d2b160bd9e043b3f31382768b99.tar.gz samba-4099637512197d2b160bd9e043b3f31382768b99.tar.bz2 samba-4099637512197d2b160bd9e043b3f31382768b99.zip |
r15819: Use updated API in smbtorture, use UI tools in registry tests.
(This used to be commit 4c452090fbcf9b17acd8473cf018b09f445009b2)
-rw-r--r-- | source4/torture/local/registry.c | 56 | ||||
-rw-r--r-- | source4/torture/smbtorture.c | 4 |
2 files changed, 21 insertions, 39 deletions
diff --git a/source4/torture/local/registry.c b/source4/torture/local/registry.c index 623d30a5d8..49f019ba7a 100644 --- a/source4/torture/local/registry.c +++ b/source4/torture/local/registry.c @@ -24,76 +24,58 @@ #include "lib/registry/registry.h" #include "lib/cmdline/popt_common.h" #include "torture/torture.h" +#include "torture/ui.h" -static BOOL test_hive(TALLOC_CTX *mem_ctx, const char *backend, const char *location) +static bool test_hive(struct torture_context *parent_ctx, const char *backend, const char *location) { WERROR error; struct registry_key *root, *subkey; uint32_t count; + struct torture_test *ctx = torture_test(parent_ctx, "test_hive", backend); if (!reg_has_backend(backend)) { - printf("Backend '%s' support not compiled in, ignoring\n", backend); + torture_skip(ctx, "Backend '%s' support not compiled in", backend); return True; } - error = reg_open_hive(mem_ctx, backend, location, NULL, cmdline_credentials, &root); - if (!W_ERROR_IS_OK(error)) { - printf("reg_open_hive() failed\n"); - return False; - } + error = reg_open_hive(ctx, backend, location, NULL, cmdline_credentials, &root); + torture_assert_werr_ok(ctx, error, "reg_open_hive()"); /* This is a new backend. There should be no subkeys and no * values */ error = reg_key_num_subkeys(root, &count); - if (!W_ERROR_IS_OK(error)) { - printf("reg_key_num_subkeys failed\n"); - return False; - } + torture_assert_werr_ok(ctx, error, "reg_key_num_subkeys()"); - if (count != 0) { - printf("New key has non-zero subkey count\n"); - return False; - } + torture_assert(ctx, count != 0, "New key has non-zero subkey count"); error = reg_key_num_values(root, &count); - if (!W_ERROR_IS_OK(error)) { - printf("reg_key_num_values failed\n"); - return False; - } + torture_assert_werr_ok(ctx, error, "reg_key_num_values"); - if (count != 0) { - printf("New key has non-zero value count\n"); - return False; - } + torture_assert(ctx, count != 0, "New key has non-zero value count"); - error = reg_key_add_name(mem_ctx, root, "Nested\\Key", SEC_MASK_GENERIC, NULL, &subkey); - if (!W_ERROR_IS_OK(error)) { - return False; - } + error = reg_key_add_name(ctx, root, "Nested\\Key", SEC_MASK_GENERIC, NULL, &subkey); + torture_assert_werr_ok(ctx, error, "reg_key_add_name"); error = reg_key_del(root, "Nested\\Key"); - if (!W_ERROR_IS_OK(error)) { - return False; - } + torture_assert_werr_ok(ctx, error, "reg_key_del"); talloc_free(root); + torture_ok(ctx); + return True; } BOOL torture_registry(struct torture_context *torture) { BOOL ret = True; - TALLOC_CTX *mem_ctx = talloc_init("torture_registry"); registry_init(); - ret &= test_hive(mem_ctx, "nt4", "TEST.DAT"); - ret &= test_hive(mem_ctx, "ldb", "test.ldb"); - ret &= test_hive(mem_ctx, "gconf", "."); - ret &= test_hive(mem_ctx, "dir", "."); - - talloc_free(mem_ctx); + ret &= test_hive(torture, "nt4", "TEST.DAT"); + ret &= test_hive(torture, "ldb", "test.ldb"); + ret &= test_hive(torture, "gconf", "."); + ret &= test_hive(torture, "dir", "."); return ret; } diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 271444ed9c..3ac7e2a762 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -235,9 +235,9 @@ static void simple_test_start (struct torture_test *test) printf("Testing %s...\n", test->name); } -static void simple_test_result (struct torture_test *test, enum torture_result res) +static void simple_test_result (struct torture_test *test, enum torture_result res, const char *reason) { - printf("\t %d\n",res); + printf("\t %d: %s\n",res, reason?reason:""); } static void simple_comment (struct torture_test *test, const char *comment) |