summaryrefslogtreecommitdiff
path: root/source4/torture/local/registry.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-06-16 22:06:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:09 -0500
commit582d46ec42144bddccddacadd52a0256f58cb453 (patch)
tree0545454b21f1ef986117f7c2e72fe957d2b662e2 /source4/torture/local/registry.c
parentcc9d70bbba4e326ba89dec8cdc58b64b89f33091 (diff)
downloadsamba-582d46ec42144bddccddacadd52a0256f58cb453.tar.gz
samba-582d46ec42144bddccddacadd52a0256f58cb453.tar.bz2
samba-582d46ec42144bddccddacadd52a0256f58cb453.zip
r16304: Improve testing UI API. This now allows registering the full
test suite tree, looks a bit more like other unit testing API's, fixes some memory responsibility issues, introduces testcases, and removes the need for tests to call torture_ok(). (This used to be commit 0445b1a56a02552f895f400960b9ced39244a144)
Diffstat (limited to 'source4/torture/local/registry.c')
-rw-r--r--source4/torture/local/registry.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/source4/torture/local/registry.c b/source4/torture/local/registry.c
index 49f019ba7a..4c8d773a44 100644
--- a/source4/torture/local/registry.c
+++ b/source4/torture/local/registry.c
@@ -26,19 +26,32 @@
#include "torture/torture.h"
#include "torture/ui.h"
-static bool test_hive(struct torture_context *parent_ctx, const char *backend, const char *location)
+const static struct test_backend_settings {
+ const char *name;
+ const char *location;
+} backends[] = {
+ { "nt4", "TEST.DAT" },
+ { "ldb", "test.ldb" },
+ { "gconf", "." },
+ { "dir", "." },
+ { NULL, NULL }
+};
+
+static BOOL test_hive(struct torture_context *ctx, const void *_backend)
{
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)) {
- torture_skip(ctx, "Backend '%s' support not compiled in", backend);
+ const struct test_backend_settings *backend = _backend;
+
+ if (!reg_has_backend(backend->name)) {
+ torture_skip(ctx, "Backend '%s' support not compiled in",
+ backend->name);
return True;
}
- error = reg_open_hive(ctx, backend, location, NULL, cmdline_credentials, &root);
+ error = reg_open_hive(ctx, backend->name,
+ 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
@@ -61,21 +74,20 @@ static bool test_hive(struct torture_context *parent_ctx, const char *backend, c
talloc_free(root);
- torture_ok(ctx);
-
return True;
}
BOOL torture_registry(struct torture_context *torture)
{
- BOOL ret = True;
+ struct torture_suite *suite = torture_suite_create(torture,
+ "LOCAL-REGISTRY");
+ int i;
registry_init();
- ret &= test_hive(torture, "nt4", "TEST.DAT");
- ret &= test_hive(torture, "ldb", "test.ldb");
- ret &= test_hive(torture, "gconf", ".");
- ret &= test_hive(torture, "dir", ".");
+ for (i = 0; backends[i].name; i++) {
+ torture_suite_add_simple_tcase(suite, backends[i].name, test_hive, &backends[i]);
+ }
- return ret;
+ return torture_run_suite(torture, suite);
}