summaryrefslogtreecommitdiff
path: root/source4/lib
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-12-03 17:47:39 +1100
committerAndrew Tridgell <tridge@samba.org>2008-12-03 17:47:39 +1100
commita226d86dcec393b2cd657d5441c3041dfdf5cd8f (patch)
tree03ef7f3207607a4e5351bf50892b0a39dcf6f219 /source4/lib
parent30eff4f31b497ac94d8ee02ee2ec24bc8865ce0d (diff)
parent85b8cccab072bab263061654b677bc84826646c9 (diff)
downloadsamba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.tar.gz
samba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.tar.bz2
samba-a226d86dcec393b2cd657d5441c3041dfdf5cd8f.zip
Merge branch 'master' of ssh://git.samba.org/data/git/samba
Diffstat (limited to 'source4/lib')
-rw-r--r--source4/lib/ldb-samba/config.mk2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c6
-rw-r--r--source4/lib/ldb/ldb.i3
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c9
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.h1
-rw-r--r--source4/lib/ldb/ldb_wrap.c1
-rw-r--r--source4/lib/registry/config.mk2
-rw-r--r--source4/lib/torture/config.mk14
-rw-r--r--source4/lib/torture/subunit.c96
-rw-r--r--source4/lib/torture/torture.c627
-rw-r--r--source4/lib/torture/torture.h425
-rw-r--r--source4/lib/torture/torture.pc.in12
-rw-r--r--source4/lib/wmi/config.mk2
13 files changed, 14 insertions, 1186 deletions
diff --git a/source4/lib/ldb-samba/config.mk b/source4/lib/ldb-samba/config.mk
index f84b44dfc7..ceacf277e4 100644
--- a/source4/lib/ldb-samba/config.mk
+++ b/source4/lib/ldb-samba/config.mk
@@ -2,7 +2,7 @@
# Start SUBSYSTEM LDBSAMBA
[SUBSYSTEM::LDBSAMBA]
PUBLIC_DEPENDENCIES = LIBLDB
-PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_MISC NDR_DRSBLOBS
+PRIVATE_DEPENDENCIES = LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_DRSBLOBS
# End SUBSYSTEM LDBSAMBA
################################################
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 538ff8feaa..69490e670b 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -328,8 +328,10 @@ int ldb_ldif_write(struct ldb_context *ldb,
for (j=0;j<msg->elements[i].num_values;j++) {
struct ldb_val v;
ret = a->syntax->ldif_write_fn(ldb, mem_ctx, &msg->elements[i].values[j], &v);
- CHECK_RET;
- if (ldb_should_b64_encode(&v)) {
+ if (ret != LDB_SUCCESS) {
+ v = msg->elements[i].values[j];
+ }
+ if (ret != LDB_SUCCESS || ldb_should_b64_encode(&v)) {
ret = fprintf_fn(private_data, "%s:: ",
msg->elements[i].name);
CHECK_RET;
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index 35d443e809..0f05c1fbab 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -217,7 +217,7 @@ typedef struct ldb_dn {
we do it this way... */
talloc_steal(NULL, ret);
- if (ret == NULL)
+ if (ret == NULL || !ldb_dn_validate(ret))
SWIG_exception(SWIG_ValueError,
"unable to parse dn string");
fail:
@@ -263,7 +263,6 @@ fail:
{
char *dn = ldb_dn_get_linearized($self), *ret;
asprintf(&ret, "Dn('%s')", dn);
- talloc_free(dn);
return ret;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 34a4e03965..9e3ad80705 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -1076,12 +1076,14 @@ static void ltdb_callback(struct event_context *ev,
}
if (!ctx->callback_failed) {
+ /* Once we are done, we do not need timeout events */
+ talloc_free(ctx->timeout_event);
ltdb_request_done(ctx->req, ret);
}
}
static int ltdb_handle_request(struct ldb_module *module,
- struct ldb_request *req)
+ struct ldb_request *req)
{
struct event_context *ev;
struct ltdb_context *ac;
@@ -1115,10 +1117,9 @@ static int ltdb_handle_request(struct ldb_module *module,
return LDB_ERR_OPERATIONS_ERROR;
}
-
tv.tv_sec = req->starttime + req->timeout;
- te = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
- if (NULL == te) {
+ ac->timeout_event = event_add_timed(ev, ac, tv, ltdb_timeout, ac);
+ if (NULL == ac->timeout_event) {
return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index 61e90bccc6..c78a8172c7 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -50,6 +50,7 @@ struct ltdb_context {
struct ldb_dn *base;
enum ldb_scope scope;
const char * const *attrs;
+ struct timed_event *timeout_event;
};
/* special record types */
diff --git a/source4/lib/ldb/ldb_wrap.c b/source4/lib/ldb/ldb_wrap.c
index 194b562c30..4a34c1c998 100644
--- a/source4/lib/ldb/ldb_wrap.c
+++ b/source4/lib/ldb/ldb_wrap.c
@@ -2732,7 +2732,6 @@ SWIGINTERN char const *ldb_dn_canonical_ex_str(ldb_dn *self){
SWIGINTERN char *ldb_dn___repr__(ldb_dn *self){
char *dn = ldb_dn_get_linearized(self), *ret;
asprintf(&ret, "Dn('%s')", dn);
- talloc_free(dn);
return ret;
}
SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){
diff --git a/source4/lib/registry/config.mk b/source4/lib/registry/config.mk
index 2e2b45abe9..9af61f9632 100644
--- a/source4/lib/registry/config.mk
+++ b/source4/lib/registry/config.mk
@@ -97,7 +97,7 @@ regtree_OBJ_FILES = $(libregistrysrcdir)/tools/regtree.o
MANPAGES += $(libregistrysrcdir)/man/regtree.1
[SUBSYSTEM::torture_registry]
-PRIVATE_DEPENDENCIES = registry
+PRIVATE_DEPENDENCIES = torture registry
torture_registry_OBJ_FILES = $(addprefix $(libregistrysrcdir)/tests/, generic.o hive.o diff.o registry.o)
diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk
deleted file mode 100644
index 8a7f2a3b6b..0000000000
--- a/source4/lib/torture/config.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-# TORTURE subsystem
-[LIBRARY::torture]
-PUBLIC_DEPENDENCIES = \
- LIBSAMBA-HOSTCONFIG \
- LIBSAMBA-UTIL \
- LIBTALLOC
-
-torture_VERSION = 0.0.1
-torture_SOVERSION = 0
-
-PC_FILES += $(libtorturesrcdir)/torture.pc
-torture_OBJ_FILES = $(addprefix $(libtorturesrcdir)/, torture.o subunit.o)
-
-PUBLIC_HEADERS += $(libtorturesrcdir)/torture.h
diff --git a/source4/lib/torture/subunit.c b/source4/lib/torture/subunit.c
deleted file mode 100644
index d5ee344596..0000000000
--- a/source4/lib/torture/subunit.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- Samba utility functions
- Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "lib/torture/torture.h"
-
-static void subunit_init(struct torture_results *results)
-{
- /* FIXME: register segv and bus handler */
-}
-
-static void subunit_suite_start(struct torture_context *ctx,
- struct torture_suite *suite)
-{
-}
-
-static void subunit_print_testname(struct torture_context *ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- if (!strcmp(tcase->name, test->name)) {
- printf("%s", test->name);
- } else {
- printf("%s.%s", tcase->name, test->name);
- }
-}
-
-static void subunit_test_start(struct torture_context *ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- printf("test: ");
- subunit_print_testname(ctx, tcase, test);
- printf("\n");
-}
-
-static void subunit_test_result(struct torture_context *context,
- enum torture_result res, const char *reason)
-{
- switch (res) {
- case TORTURE_OK:
- printf("success: ");
- break;
- case TORTURE_FAIL:
- printf("failure: ");
- break;
- case TORTURE_ERROR:
- printf("error: ");
- break;
- case TORTURE_SKIP:
- printf("skip: ");
- break;
- }
- subunit_print_testname(context, context->active_tcase, context->active_test);
-
- if (reason)
- printf(" [\n%s\n]", reason);
- printf("\n");
-}
-
-static void subunit_comment(struct torture_context *test,
- const char *comment)
-{
- fprintf(stderr, "%s", comment);
-}
-
-static void subunit_warning(struct torture_context *test,
- const char *comment)
-{
- fprintf(stderr, "WARNING!: %s\n", comment);
-}
-
-const struct torture_ui_ops torture_subunit_ui_ops = {
- .init = subunit_init,
- .comment = subunit_comment,
- .warning = subunit_warning,
- .test_start = subunit_test_start,
- .test_result = subunit_test_result,
- .suite_start = subunit_suite_start
-};
diff --git a/source4/lib/torture/torture.c b/source4/lib/torture/torture.c
deleted file mode 100644
index e465529f6b..0000000000
--- a/source4/lib/torture/torture.c
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB torture UI functions
-
- Copyright (C) Jelmer Vernooij 2006
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "torture/torture.h"
-#include "../lib/util/dlinklist.h"
-#include "param/param.h"
-#include "system/filesys.h"
-
-struct torture_results *torture_results_init(TALLOC_CTX *mem_ctx, const struct torture_ui_ops *ui_ops)
-{
- struct torture_results *results = talloc_zero(mem_ctx, struct torture_results);
-
- results->ui_ops = ui_ops;
- results->returncode = true;
-
- if (ui_ops->init)
- ui_ops->init(results);
-
- return results;
-}
-
-/**
- * Initialize a torture context
- */
-struct torture_context *torture_context_init(struct event_context *event_ctx,
- struct torture_results *results)
-{
- struct torture_context *torture = talloc_zero(event_ctx,
- struct torture_context);
-
- if (torture == NULL)
- return NULL;
-
- torture->ev = event_ctx;
- torture->results = talloc_reference(torture, results);
-
- return torture;
-}
-
-/**
- * Create a sub torture context
- */
-struct torture_context *torture_context_child(struct torture_context *parent)
-{
- struct torture_context *subtorture = talloc_zero(parent, struct torture_context);
-
- if (subtorture == NULL)
- return NULL;
-
- subtorture->level = parent->level+1;
- subtorture->ev = talloc_reference(subtorture, parent->ev);
- subtorture->lp_ctx = talloc_reference(subtorture, parent->lp_ctx);
- subtorture->outputdir = talloc_reference(subtorture, parent->outputdir);
- subtorture->results = talloc_reference(subtorture, parent->results);
-
- return subtorture;
-}
-
-/**
- create a temporary directory.
-*/
-_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
- const char *prefix,
- char **tempdir)
-{
- SMB_ASSERT(tctx->outputdir != NULL);
-
- *tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir,
- prefix);
- NT_STATUS_HAVE_NO_MEMORY(*tempdir);
-
- if (mkdtemp(*tempdir) == NULL) {
- return map_nt_error_from_unix(errno);
- }
-
- return NT_STATUS_OK;
-}
-
-/**
- * Comment on the status/progress of a test
- */
-void torture_comment(struct torture_context *context, const char *comment, ...)
-{
- va_list ap;
- char *tmp;
-
- if (!context->results->ui_ops->comment)
- return;
-
- va_start(ap, comment);
- tmp = talloc_vasprintf(context, comment, ap);
-
- context->results->ui_ops->comment(context, tmp);
-
- talloc_free(tmp);
-}
-
-/**
- * Print a warning about the current test
- */
-void torture_warning(struct torture_context *context, const char *comment, ...)
-{
- va_list ap;
- char *tmp;
-
- if (!context->results->ui_ops->warning)
- return;
-
- va_start(ap, comment);
- tmp = talloc_vasprintf(context, comment, ap);
-
- context->results->ui_ops->warning(context, tmp);
-
- talloc_free(tmp);
-}
-
-/**
- * Store the result of a torture test.
- */
-void torture_result(struct torture_context *context,
- enum torture_result result, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
-
- if (context->last_reason) {
- torture_warning(context, "%s", context->last_reason);
- talloc_free(context->last_reason);
- }
-
- context->last_result = result;
- context->last_reason = talloc_vasprintf(context, fmt, ap);
- va_end(ap);
-}
-
-/**
- * Create a new torture suite
- */
-struct torture_suite *torture_suite_create(TALLOC_CTX *ctx, const char *name)
-{
- struct torture_suite *suite = talloc_zero(ctx, struct torture_suite);
-
- suite->name = talloc_strdup(suite, name);
- suite->testcases = NULL;
- suite->children = NULL;
-
- return suite;
-}
-
-/**
- * Set the setup() and teardown() functions for a testcase.
- */
-void torture_tcase_set_fixture(struct torture_tcase *tcase,
- bool (*setup) (struct torture_context *, void **),
- bool (*teardown) (struct torture_context *, void *))
-{
- tcase->setup = setup;
- tcase->teardown = teardown;
-}
-
-static bool wrap_test_with_testcase_const(struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- bool (*fn) (struct torture_context *,
- const void *tcase_data,
- const void *test_data);
-
- fn = test->fn;
-
- return fn(torture_ctx, tcase->data, test->data);
-}
-
-/**
- * Add a test that uses const data to a testcase
- */
-struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *, const void *tcase_data,
- const void *test_data),
- const void *data)
-{
- struct torture_test *test = talloc(tcase, struct torture_test);
-
- test->name = talloc_strdup(test, name);
- test->description = NULL;
- test->run = wrap_test_with_testcase_const;
- test->fn = run;
- test->dangerous = false;
- test->data = data;
-
- DLIST_ADD_END(tcase->tests, test, struct torture_test *);
-
- return test;
-}
-
-/**
- * Add a new testcase
- */
-bool torture_suite_init_tcase(struct torture_suite *suite,
- struct torture_tcase *tcase,
- const char *name)
-{
- tcase->name = talloc_strdup(tcase, name);
- tcase->description = NULL;
- tcase->setup = NULL;
- tcase->teardown = NULL;
- tcase->fixture_persistent = true;
- tcase->tests = NULL;
-
- DLIST_ADD_END(suite->testcases, tcase, struct torture_tcase *);
-
- return true;
-}
-
-
-struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite,
- const char *name)
-{
- struct torture_tcase *tcase = talloc(suite, struct torture_tcase);
-
- if (!torture_suite_init_tcase(suite, tcase, name))
- return NULL;
-
- return tcase;
-}
-
-/**
- * Run a torture test suite.
- */
-bool torture_run_suite(struct torture_context *context,
- struct torture_suite *suite)
-{
- bool ret = true;
- struct torture_tcase *tcase;
- struct torture_suite *tsuite;
- char *old_testname;
-
- context->level++;
- if (context->results->ui_ops->suite_start)
- context->results->ui_ops->suite_start(context, suite);
-
- old_testname = context->active_testname;
- if (old_testname != NULL)
- context->active_testname = talloc_asprintf(context, "%s-%s",
- old_testname, suite->name);
- else
- context->active_testname = talloc_strdup(context, suite->name);
-
- for (tcase = suite->testcases; tcase; tcase = tcase->next) {
- ret &= torture_run_tcase(context, tcase);
- }
-
- for (tsuite = suite->children; tsuite; tsuite = tsuite->next) {
- ret &= torture_run_suite(context, tsuite);
- }
-
- talloc_free(context->active_testname);
- context->active_testname = old_testname;
-
- if (context->results->ui_ops->suite_finish)
- context->results->ui_ops->suite_finish(context, suite);
-
- context->level--;
-
- return ret;
-}
-
-void torture_ui_test_start(struct torture_context *context,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- if (context->results->ui_ops->test_start)
- context->results->ui_ops->test_start(context, tcase, test);
-}
-
-void torture_ui_test_result(struct torture_context *context,
- enum torture_result result,
- const char *comment)
-{
- if (context->results->ui_ops->test_result)
- context->results->ui_ops->test_result(context, result, comment);
-
- if (result == TORTURE_ERROR || result == TORTURE_FAIL)
- context->results->returncode = false;
-}
-
-static bool internal_torture_run_test(struct torture_context *context,
- struct torture_tcase *tcase,
- struct torture_test *test,
- bool already_setup)
-{
- bool success;
- char *old_testname;
-
- if (tcase == NULL || strcmp(test->name, tcase->name) != 0) {
- old_testname = context->active_testname;
- context->active_testname = talloc_asprintf(context, "%s-%s", old_testname, test->name);
- }
-
- context->active_tcase = tcase;
- context->active_test = test;
-
- torture_ui_test_start(context, tcase, test);
-
- context->last_reason = NULL;
- context->last_result = TORTURE_OK;
-
- if (!already_setup && tcase->setup &&
- !tcase->setup(context, &(tcase->data))) {
- if (context->last_reason == NULL)
- context->last_reason = talloc_strdup(context, "Setup failure");
- context->last_result = TORTURE_ERROR;
- success = false;
- } else if (test->dangerous &&
- !torture_setting_bool(context, "dangerous", false)) {
- context->last_result = TORTURE_SKIP;
- context->last_reason = talloc_asprintf(context,
- "disabled %s - enable dangerous tests to use", test->name);
- success = true;
- } else {
- success = test->run(context, tcase, test);
-
- if (!success && context->last_result == TORTURE_OK) {
- if (context->last_reason == NULL)
- context->last_reason = talloc_strdup(context, "Unknown error/failure");
- context->last_result = TORTURE_ERROR;
- }
- }
-
- if (!already_setup && tcase->teardown && !tcase->teardown(context, tcase->data)) {
- if (context->last_reason == NULL)
- context->last_reason = talloc_strdup(context, "Setup failure");
- context->last_result = TORTURE_ERROR;
- success = false;
- }
-
- torture_ui_test_result(context, context->last_result,
- context->last_reason);
-
- talloc_free(context->last_reason);
-
- if (tcase == NULL || strcmp(test->name, tcase->name) != 0) {
- talloc_free(context->active_testname);
- context->active_testname = old_testname;
- }
- context->active_test = NULL;
- context->active_tcase = NULL;
-
- return success;
-}
-
-bool torture_run_tcase(struct torture_context *context,
- struct torture_tcase *tcase)
-{
- bool ret = true;
- char *old_testname;
- struct torture_test *test;
-
- context->level++;
-
- context->active_tcase = tcase;
- if (context->results->ui_ops->tcase_start)
- context->results->ui_ops->tcase_start(context, tcase);
-
- if (tcase->fixture_persistent && tcase->setup
- && !tcase->setup(context, &tcase->data)) {
- /* FIXME: Use torture ui ops for reporting this error */
- fprintf(stderr, "Setup failed: ");
- if (context->last_reason != NULL)
- fprintf(stderr, "%s", context->last_reason);
- fprintf(stderr, "\n");
- ret = false;
- goto done;
- }
-
- old_testname = context->active_testname;
- context->active_testname = talloc_asprintf(context, "%s-%s",
- old_testname, tcase->name);
- for (test = tcase->tests; test; test = test->next) {
- ret &= internal_torture_run_test(context, tcase, test,
- tcase->fixture_persistent);
- }
- talloc_free(context->active_testname);
- context->active_testname = old_testname;
-
- if (tcase->fixture_persistent && tcase->teardown &&
- !tcase->teardown(context, tcase->data))
- ret = false;
-
-done:
- context->active_tcase = NULL;
-
- if (context->results->ui_ops->tcase_finish)
- context->results->ui_ops->tcase_finish(context, tcase);
-
- context->level--;
-
- return ret;
-}
-
-bool torture_run_test(struct torture_context *context,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- return internal_torture_run_test(context, tcase, test, false);
-}
-
-int torture_setting_int(struct torture_context *test, const char *name,
- int default_value)
-{
- return lp_parm_int(test->lp_ctx, NULL, "torture", name, default_value);
-}
-
-double torture_setting_double(struct torture_context *test, const char *name,
- double default_value)
-{
- return lp_parm_double(test->lp_ctx, NULL, "torture", name, default_value);
-}
-
-bool torture_setting_bool(struct torture_context *test, const char *name,
- bool default_value)
-{
- return lp_parm_bool(test->lp_ctx, NULL, "torture", name, default_value);
-}
-
-const char *torture_setting_string(struct torture_context *test,
- const char *name,
- const char *default_value)
-{
- const char *ret;
-
- SMB_ASSERT(test != NULL);
- SMB_ASSERT(test->lp_ctx != NULL);
-
- ret = lp_parm_string(test->lp_ctx, NULL, "torture", name);
-
- if (ret == NULL)
- return default_value;
-
- return ret;
-}
-
-static bool wrap_test_with_simple_tcase_const (
- struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- bool (*fn) (struct torture_context *, const void *tcase_data);
-
- fn = test->fn;
-
- return fn(torture_ctx, test->data);
-}
-
-struct torture_tcase *torture_suite_add_simple_tcase_const(
- struct torture_suite *suite, const char *name,
- bool (*run) (struct torture_context *test, const void *),
- const void *data)
-{
- struct torture_tcase *tcase;
- struct torture_test *test;
-
- tcase = torture_suite_add_tcase(suite, name);
-
- test = talloc(tcase, struct torture_test);
-
- test->name = talloc_strdup(test, name);
- test->description = NULL;
- test->run = wrap_test_with_simple_tcase_const;
- test->fn = run;
- test->data = data;
- test->dangerous = false;
-
- DLIST_ADD_END(tcase->tests, test, struct torture_test *);
-
- return tcase;
-}
-
-static bool wrap_simple_test(struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- bool (*fn) (struct torture_context *);
-
- fn = test->fn;
-
- return fn(torture_ctx);
-}
-
-struct torture_tcase *torture_suite_add_simple_test(
- struct torture_suite *suite,
- const char *name,
- bool (*run) (struct torture_context *test))
-{
- struct torture_test *test;
- struct torture_tcase *tcase;
-
- tcase = torture_suite_add_tcase(suite, name);
-
- test = talloc(tcase, struct torture_test);
-
- test->name = talloc_strdup(test, name);
- test->description = NULL;
- test->run = wrap_simple_test;
- test->fn = run;
- test->dangerous = false;
-
- DLIST_ADD_END(tcase->tests, test, struct torture_test *);
-
- return tcase;
-}
-
-/**
- * Add a child testsuite to a testsuite.
- */
-bool torture_suite_add_suite(struct torture_suite *suite,
- struct torture_suite *child)
-{
- if (child == NULL)
- return false;
-
- DLIST_ADD_END(suite->children, child, struct torture_suite *);
-
- /* FIXME: Check for duplicates and return false if the
- * added suite already exists as a child */
-
- return true;
-}
-
-/**
- * Find the child testsuite with the specified name.
- */
-struct torture_suite *torture_find_suite(struct torture_suite *parent,
- const char *name)
-{
- struct torture_suite *child;
-
- for (child = parent->children; child; child = child->next)
- if (!strcmp(child->name, name))
- return child;
-
- return NULL;
-}
-
-static bool wrap_test_with_simple_test_const(struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- bool (*fn) (struct torture_context *, const void *tcase_data);
-
- fn = test->fn;
-
- return fn(torture_ctx, tcase->data);
-}
-
-struct torture_test *torture_tcase_add_simple_test_const(
- struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *test,
- const void *tcase_data))
-{
- struct torture_test *test;
-
- test = talloc(tcase, struct torture_test);
-
- test->name = talloc_strdup(test, name);
- test->description = NULL;
- test->run = wrap_test_with_simple_test_const;
- test->fn = run;
- test->data = NULL;
- test->dangerous = false;
-
- DLIST_ADD_END(tcase->tests, test, struct torture_test *);
-
- return test;
-}
-
-static bool wrap_test_with_simple_test(struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test)
-{
- bool (*fn) (struct torture_context *, void *tcase_data);
-
- fn = test->fn;
-
- return fn(torture_ctx, tcase->data);
-}
-
-struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *test, void *tcase_data))
-{
- struct torture_test *test;
-
- test = talloc(tcase, struct torture_test);
-
- test->name = talloc_strdup(test, name);
- test->description = NULL;
- test->run = wrap_test_with_simple_test;
- test->fn = run;
- test->data = NULL;
- test->dangerous = false;
-
- DLIST_ADD_END(tcase->tests, test, struct torture_test *);
-
- return test;
-}
diff --git a/source4/lib/torture/torture.h b/source4/lib/torture/torture.h
deleted file mode 100644
index f06ffe012b..0000000000
--- a/source4/lib/torture/torture.h
+++ /dev/null
@@ -1,425 +0,0 @@
-/*
- Unix SMB/CIFS implementation.
- SMB torture UI functions
-
- Copyright (C) Jelmer Vernooij 2006
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef __TORTURE_UI_H__
-#define __TORTURE_UI_H__
-
-struct torture_test;
-struct torture_context;
-struct torture_suite;
-struct torture_tcase;
-struct torture_results;
-
-enum torture_result {
- TORTURE_OK=0,
- TORTURE_FAIL=1,
- TORTURE_ERROR=2,
- TORTURE_SKIP=3
-};
-
-/*
- * These callbacks should be implemented by any backend that wishes
- * to listen to reports from the torture tests.
- */
-struct torture_ui_ops
-{
- void (*init) (struct torture_results *);
- void (*comment) (struct torture_context *, const char *);
- void (*warning) (struct torture_context *, const char *);
- void (*suite_start) (struct torture_context *, struct torture_suite *);
- void (*suite_finish) (struct torture_context *, struct torture_suite *);
- void (*tcase_start) (struct torture_context *, struct torture_tcase *);
- void (*tcase_finish) (struct torture_context *, struct torture_tcase *);
- void (*test_start) (struct torture_context *,
- struct torture_tcase *,
- struct torture_test *);
- void (*test_result) (struct torture_context *,
- enum torture_result, const char *reason);
-};
-
-void torture_ui_test_start(struct torture_context *context,
- struct torture_tcase *tcase,
- struct torture_test *test);
-
-void torture_ui_test_result(struct torture_context *context,
- enum torture_result result,
- const char *comment);
-
-/*
- * Holds information about a specific run of the testsuite.
- * The data in this structure should be considered private to
- * the torture tests and should only be used directly by the torture
- * code and the ui backends.
- *
- * Torture tests should instead call the torture_*() macros and functions
- * specified below.
- */
-
-struct torture_context
-{
- struct torture_results *results;
-
- char *active_testname;
- struct torture_test *active_test;
- struct torture_tcase *active_tcase;
-
- enum torture_result last_result;
- char *last_reason;
-
- /** Directory used for temporary test data */
- const char *outputdir;
-
- /** Indentation level */
- int level;
-
- /** Event context */
- struct event_context *ev;
-
- /** Loadparm context (will go away in favor of torture_setting_ at some point) */
- struct loadparm_context *lp_ctx;
-};
-
-struct torture_results
-{
- const struct torture_ui_ops *ui_ops;
- void *ui_data;
-
- /** Whether tests should avoid writing output to stdout */
- bool quiet;
-
- bool returncode;
-
-
-};
-
-/*
- * Describes a particular torture test
- */
-struct torture_test {
- /** Short unique name for the test. */
- const char *name;
-
- /** Long description for the test. */
- const char *description;
-
- /** Whether this is a dangerous test
- * (can corrupt the remote servers data or bring it down). */
- bool dangerous;
-
- /** Function to call to run this test */
- bool (*run) (struct torture_context *torture_ctx,
- struct torture_tcase *tcase,
- struct torture_test *test);
-
- struct torture_test *prev, *next;
-
- /** Pointer to the actual test function. This is run by the
- * run() function above. */
- void *fn;
-
- /** Use data for this test */
- const void *data;
-};
-
-/*
- * Describes a particular test case.
- */
-struct torture_tcase {
- const char *name;
- const char *description;
- bool (*setup) (struct torture_context *tcase, void **data);
- bool (*teardown) (struct torture_context *tcase, void *data);
- bool fixture_persistent;
- void *data;
- struct torture_test *tests;
- struct torture_tcase *prev, *next;
-};
-
-struct torture_suite
-{
- const char *name;
- const char *description;
- struct torture_tcase *testcases;
- struct torture_suite *children;
-
- /* Pointers to siblings of this torture suite */
- struct torture_suite *prev, *next;
-};
-
-/** Create a new torture suite */
-struct torture_suite *torture_suite_create(TALLOC_CTX *mem_ctx,
- const char *name);
-
-/** Change the setup and teardown functions for a testcase */
-void torture_tcase_set_fixture(struct torture_tcase *tcase,
- bool (*setup) (struct torture_context *, void **),
- bool (*teardown) (struct torture_context *, void *));
-
-/* Add another test to run for a particular testcase */
-struct torture_test *torture_tcase_add_test_const(struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *test,
- const void *tcase_data, const void *test_data),
- const void *test_data);
-
-/* Add a testcase to a testsuite */
-struct torture_tcase *torture_suite_add_tcase(struct torture_suite *suite,
- const char *name);
-
-/* Convenience wrapper that adds a testcase against only one
- * test will be run */
-struct torture_tcase *torture_suite_add_simple_tcase_const(
- struct torture_suite *suite,
- const char *name,
- bool (*run) (struct torture_context *test,
- const void *test_data),
- const void *data);
-
-/* Convenience function that adds a test which only
- * gets the test case data */
-struct torture_test *torture_tcase_add_simple_test_const(
- struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *test,
- const void *tcase_data));
-
-/* Convenience wrapper that adds a test that doesn't need any
- * testcase data */
-struct torture_tcase *torture_suite_add_simple_test(
- struct torture_suite *suite,
- const char *name,
- bool (*run) (struct torture_context *test));
-
-/* Add a child testsuite to an existing testsuite */
-bool torture_suite_add_suite(struct torture_suite *suite,
- struct torture_suite *child);
-
-/* Run the specified testsuite recursively */
-bool torture_run_suite(struct torture_context *context,
- struct torture_suite *suite);
-
-/* Run the specified testcase */
-bool torture_run_tcase(struct torture_context *context,
- struct torture_tcase *tcase);
-
-/* Run the specified test */
-bool torture_run_test(struct torture_context *context,
- struct torture_tcase *tcase,
- struct torture_test *test);
-
-void torture_comment(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3);
-void torture_warning(struct torture_context *test, const char *comment, ...) PRINTF_ATTRIBUTE(2,3);
-void torture_result(struct torture_context *test,
- enum torture_result, const char *reason, ...) PRINTF_ATTRIBUTE(3,4);
-
-#define torture_assert(torture_ctx,expr,cmt) \
- if (!(expr)) { \
- torture_result(torture_ctx, TORTURE_FAIL, __location__": Expression `%s' failed: %s", __STRING(expr), cmt); \
- return false; \
- }
-
-#define torture_assert_werr_equal(torture_ctx, got, expected, cmt) \
- do { WERROR __got = got, __expected = expected; \
- if (!W_ERROR_EQUAL(__got, __expected)) { \
- torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", win_errstr(__got), win_errstr(__expected), cmt); \
- return false; \
- } \
- } while (0)
-
-#define torture_assert_ntstatus_equal(torture_ctx,got,expected,cmt) \
- do { NTSTATUS __got = got, __expected = expected; \
- if (!NT_STATUS_EQUAL(__got, __expected)) { \
- torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", nt_errstr(__got), nt_errstr(__expected), cmt); \
- return false; \
- }\
- } while(0)
-
-#define torture_assert_ndr_err_equal(torture_ctx,got,expected,cmt) \
- do { enum ndr_err_code __got = got, __expected = expected; \
- if (__got != __expected) { \
- torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %d, expected %d (%s): %s", __got, __expected, __STRING(expected), cmt); \
- return false; \
- }\
- } while(0)
-
-#define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \
- do { const char *__got = (got), *__expected = (expected); \
- if (!strequal(__got, __expected)) { \
- torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", __got, __expected, cmt); \
- return false; \
- } \
- } while(0)
-
-#define torture_assert_str_equal(torture_ctx,got,expected,cmt)\
- do { const char *__got = (got), *__expected = (expected); \
- if (strcmp_safe(__got, __expected) != 0) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %s, expected %s: %s", \
- __got, __expected, cmt); \
- return false; \
- } \
- } while(0)
-
-#define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\
- do { const void *__got = (got), *__expected = (expected); \
- if (memcmp(__got, __expected, len) != 0) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" of len %d did not match"#expected": %s", (int)len, cmt); \
- return false; \
- } \
- } while(0)
-
-#define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
- do { \
- char *__got; \
- const char *__expected = (expected); \
- size_t __size; \
- __got = file_load(filename, &__size, 0, torture_ctx); \
- if (__got == NULL) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": unable to open %s: %s\n", \
- filename, cmt); \
- return false; \
- } \
- \
- if (strcmp_safe(__got, __expected) != 0) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": %s contained:\n%sExpected: %s%s\n", \
- filename, __got, __expected, cmt); \
- talloc_free(__got); \
- return false; \
- } \
- talloc_free(__got); \
- } while(0)
-
-#define torture_assert_file_contains(torture_ctx,filename,expected,cmt)\
- do { const char *__got, *__expected = (expected); \
- size_t __size; \
- __got = file_load(filename, *size, 0, torture_ctx); \
- if (strcmp_safe(__got, __expected) != 0) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": %s contained:\n%sExpected: %s%s\n", \
- __got, __expected, cmt); \
- talloc_free(__got); \
- return false; \
- } \
- talloc_free(__got); \
- } while(0)
-
-#define torture_assert_int_equal(torture_ctx,got,expected,cmt)\
- do { int __got = (got), __expected = (expected); \
- if (__got != __expected) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %d, expected %d: %s", \
- __got, __expected, cmt); \
- return false; \
- } \
- } while(0)
-
-#define torture_assert_u64_equal(torture_ctx,got,expected,cmt)\
- do { uint64_t __got = (got), __expected = (expected); \
- if (__got != __expected) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": "#got" was %llu, expected %llu: %s", \
- (unsigned long long)__got, (unsigned long long)__expected, cmt); \
- return false; \
- } \
- } while(0)
-
-#define torture_assert_errno_equal(torture_ctx,expected,cmt)\
- do { int __expected = (expected); \
- if (errno != __expected) { \
- torture_result(torture_ctx, TORTURE_FAIL, \
- __location__": errno was %d (%s), expected %d: %s: %s", \
- errno, strerror(errno), __expected, \
- strerror(__expected), cmt); \
- return false; \
- } \
- } while(0)
-
-
-
-#define torture_skip(torture_ctx,cmt) do {\
- torture_result(torture_ctx, TORTURE_SKIP, __location__": %s", cmt);\
- return true; \
- } while(0)
-#define torture_fail(torture_ctx,cmt) do {\
- torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\
- return false; \
- } while (0)
-#define torture_fail_goto(torture_ctx,label,cmt) do {\
- torture_result(torture_ctx, TORTURE_FAIL, __location__": %s", cmt);\
- goto label; \
- } while (0)
-
-#define torture_out stderr
-
-/* Convenience macros */
-#define torture_assert_ntstatus_ok(torture_ctx,expr,cmt) \
- torture_assert_ntstatus_equal(torture_ctx,expr,NT_STATUS_OK,cmt)
-
-#define torture_assert_werr_ok(torture_ctx,expr,cmt) \
- torture_assert_werr_equal(torture_ctx,expr,WERR_OK,cmt)
-
-#define torture_assert_ndr_success(torture_ctx,expr,cmt) \
- torture_assert_ndr_err_equal(torture_ctx,expr,NDR_ERR_SUCCESS,cmt)
-
-/* Getting settings */
-const char *torture_setting_string(struct torture_context *test, \
- const char *name,
- const char *default_value);
-
-int torture_setting_int(struct torture_context *test,
- const char *name,
- int default_value);
-
-double torture_setting_double(struct torture_context *test,
- const char *name,
- double default_value);
-
-bool torture_setting_bool(struct torture_context *test,
- const char *name,
- bool default_value);
-
-struct torture_suite *torture_find_suite(struct torture_suite *parent,
- const char *name);
-
-NTSTATUS torture_temp_dir(struct torture_context *tctx,
- const char *prefix,
- char **tempdir);
-
-struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
- const char *name,
- bool (*run) (struct torture_context *test, void *tcase_data));
-
-
-bool torture_suite_init_tcase(struct torture_suite *suite,
- struct torture_tcase *tcase,
- const char *name);
-
-struct torture_context *torture_context_init(struct event_context *event_ctx, struct torture_results *results);
-
-struct torture_results *torture_results_init(TALLOC_CTX *mem_ctx, const struct torture_ui_ops *ui_ops);
-
-struct torture_context *torture_context_child(struct torture_context *tctx);
-
-extern const struct torture_ui_ops torture_subunit_ui_ops;
-
-#endif /* __TORTURE_UI_H__ */
diff --git a/source4/lib/torture/torture.pc.in b/source4/lib/torture/torture.pc.in
deleted file mode 100644
index 6582816cb5..0000000000
--- a/source4/lib/torture/torture.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-modulesdir=${prefix}/modules/torture
-
-Name: torture
-Description: Samba torture (test) suite
-Requires: talloc
-Version: 0.0.1
-Libs: -L${libdir} -ltorture
-Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1
diff --git a/source4/lib/wmi/config.mk b/source4/lib/wmi/config.mk
index 28f6c73dcd..3bb1690c7b 100644
--- a/source4/lib/wmi/config.mk
+++ b/source4/lib/wmi/config.mk
@@ -43,7 +43,7 @@ librpc/gen_ndr/dcom_p.c: idl
#######################
# Start LIBRARY swig_dcerpc
[PYTHON::pywmi]
-PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-CONFIG WMI
+PUBLIC_DEPENDENCIES = LIBCLI_SMB LIBNDR LIBSAMBA-UTIL LIBSAMBA-CONFIG WMI
$(eval $(call python_py_module_template,wmi.py,$(wmisrcdir)/wmi.py))