[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Tue Sep 21 23:54:32 MDT 2010
The branch, master has been updated
via e12e661 s4-selftest: Move more tests to scripting/python, simplifies running of tests.
via 118c654 selftest: Fix run for systems without testtools installed.
via 7c1b00f selftest: Use idlist testing for python tests.
via bf907d2 selftest: Support running individual tests using idlists, for testsuites that support them.
via 1783d0d s4-selftest: Use loadlist in a couple more places.
via 0aff42a torture: Remove active_testname variable.
via ea1ed67 s4-test: Allow running individual tests for smbtorture tests.
via e456c69 torture: Fix running individual tests.
via e8b2003 selftest: Fix generation of test id file.
via 4c681f7 strlist: Make test names unique.
via 94f84da s4-land: Print commands that are being run.
via 10da4b0 pymessaging: Remove unused older python irpc bindings.
from cb5c86e s3:net: add subcommand net registry deletekey_recursive
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit e12e661f35983dfab3e7d869df7770f519b49e48
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 22:54:10 2010 -0700
s4-selftest: Move more tests to scripting/python, simplifies running of tests.
commit 118c6548bbc4d1ff889688372190a4503fc2855f
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 21:33:30 2010 -0700
selftest: Fix run for systems without testtools installed.
commit 7c1b00f4a80ee5eb91333cad9c27ba699c6b2e3b
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:58:23 2010 -0700
selftest: Use idlist testing for python tests.
commit bf907d2c4a7c9c4d95d2af644eb5f8dc97e073c3
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:36:50 2010 -0700
selftest: Support running individual tests using idlists, for testsuites that support them.
commit 1783d0d6fcf20e568a1187b1e28cbf1d60c54d34
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:23:41 2010 -0700
s4-selftest: Use loadlist in a couple more places.
commit 0aff42a6e4bd4330c50566a13ecf684486f8e96d
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:16:40 2010 -0700
torture: Remove active_testname variable.
commit ea1ed67d15b0b2d70fff638c3c5c79de66312e9c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:11:47 2010 -0700
s4-test: Allow running individual tests for smbtorture tests.
commit e456c69498bfe5beb8421bcde523d24f50a34d0c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 20:11:43 2010 -0700
torture: Fix running individual tests.
commit e8b20039a7b77e17fd3caa66b68528f70d3b6cec
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 17:35:53 2010 -0700
selftest: Fix generation of test id file.
commit 4c681f760fbf0dc98627fdc94046df793c405ef1
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 17:35:26 2010 -0700
strlist: Make test names unique.
commit 94f84da1f6ef5d05439e582012eb5349de618e41
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 16:46:12 2010 -0700
s4-land: Print commands that are being run.
commit 10da4b042250ca13deca40d11320451a06663d2e
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Tue Sep 21 16:08:46 2010 -0700
pymessaging: Remove unused older python irpc bindings.
-----------------------------------------------------------------------
Summary of changes:
lib/torture/subunit.c | 4 +-
lib/torture/torture.c | 104 ++++---
lib/torture/torture.h | 11 +-
lib/util/tests/strlist.c | 10 +-
selftest/selftest.pl | 24 +-
source4/lib/messaging/pymessaging.c | 352 +-------------------
source4/script/land-remote.py | 30 ++-
source4/scripting/python/pyglue.c | 2 -
source4/scripting/python/samba/__init__.py | 1 +
.../python/samba/tests/auth.py} | 0
.../python/samba/tests/dcerpc/__init__.py | 4 +-
.../scripting/python/samba/tests/dcerpc/misc.py | 4 +-
.../python/samba/tests/gensec.py} | 0
.../python/samba/tests/messaging.py} | 0
.../python/samba/tests/param.py} | 0
.../python/samba/tests/registry.py} | 0
.../python/samba/tests/security.py} | 0
source4/selftest/tests.sh | 141 +++++----
source4/torture/smbtorture.c | 7 +-
19 files changed, 204 insertions(+), 490 deletions(-)
rename source4/{auth/tests/bindings.py => scripting/python/samba/tests/auth.py} (100%)
rename source4/{auth/gensec/tests/bindings.py => scripting/python/samba/tests/gensec.py} (100%)
rename source4/{lib/messaging/tests/bindings.py => scripting/python/samba/tests/messaging.py} (100%)
rename source4/{param/tests/bindings.py => scripting/python/samba/tests/param.py} (100%)
rename source4/{lib/registry/tests/bindings.py => scripting/python/samba/tests/registry.py} (100%)
rename source4/{libcli/security/tests/bindings.py => scripting/python/samba/tests/security.py} (100%)
Changeset truncated at 500 lines:
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
index 86b3dd0..6c58cfe 100644
--- a/lib/torture/subunit.c
+++ b/lib/torture/subunit.c
@@ -41,7 +41,7 @@ static void subunit_test_start(struct torture_context *ctx,
struct torture_test *test)
{
printf("test: ");
- subunit_print_testname(ctx, tcase, test);
+ subunit_print_testname(ctx, tcase, test);
printf("\n");
}
@@ -62,7 +62,7 @@ static void subunit_test_result(struct torture_context *context,
printf("skip: ");
break;
}
- subunit_print_testname(context, context->active_tcase, context->active_test);
+ subunit_print_testname(context, context->active_tcase, context->active_test);
if (reason)
printf(" [\n%s\n]", reason);
diff --git a/lib/torture/torture.c b/lib/torture/torture.c
index 0bf50cc..d6f893e 100644
--- a/lib/torture/torture.c
+++ b/lib/torture/torture.c
@@ -1,19 +1,19 @@
-/*
+/*
Unix SMB/CIFS implementation.
SMB torture UI functions
Copyright (C) Jelmer Vernooij 2006-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/>.
*/
@@ -24,6 +24,7 @@
#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);
@@ -76,13 +77,12 @@ struct torture_context *torture_context_child(struct torture_context *parent)
/**
create a temporary directory.
*/
-_PUBLIC_ NTSTATUS torture_temp_dir(struct torture_context *tctx,
- const char *prefix,
- char **tempdir)
+_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,
+ *tempdir = talloc_asprintf(tctx, "%s/%s.XXXXXX", tctx->outputdir,
prefix);
NT_STATUS_HAVE_NO_MEMORY(*tempdir);
@@ -107,9 +107,9 @@ void torture_comment(struct torture_context *context, const char *comment, ...)
va_start(ap, comment);
tmp = talloc_vasprintf(context, comment, ap);
va_end(ap);
-
+
context->results->ui_ops->comment(context, tmp);
-
+
talloc_free(tmp);
}
@@ -268,6 +268,12 @@ int torture_suite_children_count(const struct torture_suite *suite)
bool torture_run_suite(struct torture_context *context,
struct torture_suite *suite)
{
+ return torture_run_suite_restricted(context, suite, NULL);
+}
+
+bool torture_run_suite_restricted(struct torture_context *context,
+ struct torture_suite *suite, const char **restricted)
+{
bool ret = true;
struct torture_tcase *tcase;
struct torture_suite *tsuite;
@@ -276,41 +282,26 @@ bool torture_run_suite(struct torture_context *context,
if (context->results->ui_ops->suite_start)
context->results->ui_ops->suite_start(context, suite);
- context->results->ui_ops->progress(context,
- torture_suite_children_count(suite), TORTURE_PROGRESS_SET);
- 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);
+ /* FIXME: Adjust torture_suite_children_count if restricted != NULL */
+ context->results->ui_ops->progress(context,
+ torture_suite_children_count(suite), TORTURE_PROGRESS_SET);
for (tcase = suite->testcases; tcase; tcase = tcase->next) {
- ret &= torture_run_tcase(context, tcase);
+ ret &= torture_run_tcase_restricted(context, tcase, restricted);
}
for (tsuite = suite->children; tsuite; tsuite = tsuite->next) {
context->results->ui_ops->progress(context, 0, TORTURE_PROGRESS_PUSH);
- ret &= torture_run_suite(context, tsuite);
+ ret &= torture_run_suite_restricted(context, tsuite, restricted);
context->results->ui_ops->progress(context, 0, TORTURE_PROGRESS_POP);
}
- 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);
return ret;
}
-bool torture_run_suite_restricted(struct torture_context *context,
- struct torture_suite *suite, const char **restricted)
-{
- /* FIXME */
- return false;
-}
-
void torture_ui_test_start(struct torture_context *context,
struct torture_tcase *tcase,
struct torture_test *test)
@@ -330,19 +321,37 @@ void torture_ui_test_result(struct torture_context *context,
context->results->returncode = false;
}
+static bool test_needs_running(const char *name, const char **restricted)
+{
+ int i;
+ if (restricted == NULL)
+ return true;
+ for (i = 0; restricted[i]; i++) {
+ if (!strcmp(name, restricted[i]))
+ return true;
+ }
+ return false;
+}
+
static bool internal_torture_run_test(struct torture_context *context,
struct torture_tcase *tcase,
struct torture_test *test,
- bool already_setup)
+ bool already_setup,
+ const char **restricted)
{
bool success;
char *old_testname = NULL;
+ char *subunit_testname = NULL;
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);
+ subunit_testname = talloc_asprintf(context, "%s.%s", tcase->name, test->name);
+ } else {
+ subunit_testname = test->name;
}
+ if (!test_needs_running(subunit_testname, restricted))
+ return true;
+
context->active_tcase = tcase;
context->active_test = test;
@@ -385,19 +394,21 @@ static bool internal_torture_run_test(struct torture_context *context,
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,
+bool torture_run_tcase(struct torture_context *context,
struct torture_tcase *tcase)
{
+ return torture_run_tcase_restricted(context, tcase, NULL);
+}
+
+bool torture_run_tcase_restricted(struct torture_context *context,
+ struct torture_tcase *tcase, const char **restricted)
+{
bool ret = true;
char *old_testname;
struct torture_test *test;
@@ -424,13 +435,10 @@ bool torture_run_tcase(struct torture_context *context,
}
}
- 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) {
if (setup_succeeded) {
ret &= internal_torture_run_test(context, tcase, test,
- tcase->fixture_persistent);
+ tcase->fixture_persistent, restricted);
} else {
context->active_tcase = tcase;
context->active_test = test;
@@ -438,8 +446,6 @@ bool torture_run_tcase(struct torture_context *context,
torture_ui_test_result(context, TORTURE_FAIL, setup_reason);
}
}
- talloc_free(context->active_testname);
- context->active_testname = old_testname;
if (setup_succeeded && tcase->fixture_persistent && tcase->teardown &&
!tcase->teardown(context, tcase->data)) {
@@ -459,7 +465,15 @@ 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);
+ return internal_torture_run_test(context, tcase, test, false, NULL);
+}
+
+bool torture_run_test_restricted(struct torture_context *context,
+ struct torture_tcase *tcase,
+ struct torture_test *test,
+ const char **restricted)
+{
+ return internal_torture_run_test(context, tcase, test, false, restricted);
}
int torture_setting_int(struct torture_context *test, const char *name,
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 6482e89..90513b7 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -84,7 +84,6 @@ struct torture_context
{
struct torture_results *results;
- char *active_testname;
struct torture_test *active_test;
struct torture_tcase *active_tcase;
@@ -93,7 +92,7 @@ struct torture_context
/** Directory used for temporary test data */
const char *outputdir;
-
+
/** Event context */
struct tevent_context *ev;
@@ -227,11 +226,19 @@ bool torture_run_suite_restricted(struct torture_context *context,
bool torture_run_tcase(struct torture_context *context,
struct torture_tcase *tcase);
+bool torture_run_tcase_restricted(struct torture_context *context,
+ struct torture_tcase *tcase, const char **restricted);
+
/* Run the specified test */
bool torture_run_test(struct torture_context *context,
struct torture_tcase *tcase,
struct torture_test *test);
+bool torture_run_test_restricted(struct torture_context *context,
+ struct torture_tcase *tcase,
+ struct torture_test *test,
+ const char **restricted);
+
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,
diff --git a/lib/util/tests/strlist.c b/lib/util/tests/strlist.c
index ce7d1e4..3a7f2a5 100644
--- a/lib/util/tests/strlist.c
+++ b/lib/util/tests/strlist.c
@@ -473,12 +473,18 @@ struct torture_suite *torture_local_util_strlist(TALLOC_CTX *mem_ctx)
int i;
for (i = 0; i < ARRAY_SIZE(test_lists_shell_strings); i++) {
- torture_suite_add_simple_tcase_const(suite, "lists_shell",
+ char *name;
+ name = talloc_asprintf(suite, "lists_shell(%s)",
+ test_lists_shell_strings[i].list_as_string);
+ torture_suite_add_simple_tcase_const(suite, name,
test_lists_shell, &test_lists_shell_strings[i]);
}
for (i = 0; i < ARRAY_SIZE(test_lists_strings); i++) {
- torture_suite_add_simple_tcase_const(suite, "list_make",
+ char *name;
+ name = talloc_asprintf(suite, "list_make(%s)",
+ test_lists_strings[i].list_as_string);
+ torture_suite_add_simple_tcase_const(suite, name,
test_list_make, &test_lists_strings[i]);
}
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 090e87b..a21ecba 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -633,8 +633,9 @@ sub read_testlist($)
open(IN, $filename) or die("Unable to open $filename: $!");
while (<IN>) {
- if (/-- TEST(-LOADLIST)? --\n/) {
+ if (/-- TEST(-LOADLIST|-IDLIST|) --\n/) {
my $supports_loadlist = (defined($1) and $1 eq "-LOADLIST");
+ my $supports_idlist = (defined($1) and $1 eq "-IDLIST");
my $name = <IN>;
$name =~ s/\n//g;
my $env = <IN>;
@@ -642,7 +643,7 @@ sub read_testlist($)
my $cmdline = <IN>;
$cmdline =~ s/\n//g;
if (should_run_test($name) == 1) {
- push (@ret, [$name, $env, $cmdline, $supports_loadlist]);
+ push (@ret, [$name, $env, $cmdline, $supports_loadlist, $supports_idlist]);
}
} else {
print;
@@ -716,8 +717,8 @@ foreach my $testsuite (@available) {
$individual_tests->{$name} = [];
$match = $r;
$restricted_used->{$r} = 1;
- } elsif (substr($r, $name, length($name)+1) eq "$name.") {
- push(@{$individual_tests->{$name}}, $1);
+ } elsif (substr($r, 0, length($name)+1) eq "$name.") {
+ push(@{$individual_tests->{$name}}, substr($r, length($name)+1));
$match = $r;
$restricted_used->{$r} = 1;
}
@@ -946,12 +947,17 @@ $envvarstr
# Generate a file with the individual tests to run, if the
# test runner for this test suite supports it.
- if ($$_[3] and $individual_tests and $individual_tests->{$name}) {
- my ($fh, $listid_file) = tempfile(UNLINK => 0);
- foreach (@{$individual_tests->{$name}}) {
- print $fh "$_\n";
+ if ($individual_tests and $individual_tests->{$name}) {
+ if ($$_[3]) {
+ my ($fh, $listid_file) = tempfile(UNLINK => 0);
+ foreach my $test (@{$individual_tests->{$name}}) {
+ print $fh "$test\n";
+ }
+ $cmd .= " --load-list=$listid_file";
+ } elsif ($$_[4]) {
+ $cmd =~ s/\s+[^\s]+\s*$//;
+ $cmd .= " " . join(' ', @{$individual_tests->{$name}});
}
- $cmd .= " --load-list=$listid_file";
}
run_testsuite($envname, $name, $cmd, $i, $suitestotal);
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 5813001..ba9770d 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -25,20 +25,15 @@
#include "libcli/util/pyerrors.h"
#include "librpc/rpc/pyrpc_util.h"
#include "librpc/ndr/libndr.h"
-#include "lib/messaging/irpc.h"
#include "lib/messaging/messaging.h"
#include "lib/events/events.h"
#include "cluster/cluster.h"
#include "param/param.h"
#include "param/pyparam.h"
-#include "librpc/gen_ndr/ndr_irpc.h"
#include "librpc/rpc/dcerpc.h"
+#include "librpc/gen_ndr/server_id.h"
PyAPI_DATA(PyTypeObject) messaging_Type;
-PyAPI_DATA(PyTypeObject) irpc_ClientConnectionType;
-
-/* FIXME: This prototype should be in py_irpc.h, or shared otherwise */
-extern const struct PyNdrRpcMethodDef py_ndr_irpc_methods[];
static bool server_id_from_py(PyObject *object, struct server_id *server_id)
{
@@ -143,7 +138,7 @@ static PyObject *py_messaging_send(PyObject *self, PyObject *args, PyObject *kwa
data.length = length;
- if (!server_id_from_py(target, &server))
+ if (!server_id_from_py(target, &server))
return NULL;
status = messaging_send(iface->msg_ctx, server, msg_type, &data);
@@ -217,44 +212,6 @@ static PyObject *py_messaging_deregister(PyObject *self, PyObject *args, PyObjec
Py_RETURN_NONE;
}
-static PyObject *py_messaging_add_name(PyObject *self, PyObject *args, PyObject *kwargs)
-{
- messaging_Object *iface = (messaging_Object *)self;
- NTSTATUS status;
- char *name;
- const char *kwnames[] = { "name", NULL };
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:add_name",
- discard_const_p(char *, kwnames), &name)) {
- return NULL;
- }
-
- status = irpc_add_name(iface->msg_ctx, name);
- if (NT_STATUS_IS_ERR(status)) {
- PyErr_SetNTSTATUS(status);
- return NULL;
- }
-
- Py_RETURN_NONE;
-}
-
-
-static PyObject *py_messaging_remove_name(PyObject *self, PyObject *args, PyObject *kwargs)
-{
- messaging_Object *iface = (messaging_Object *)self;
- char *name;
- const char *kwnames[] = { "name", NULL };
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|:remove_name",
- discard_const_p(char *, kwnames), &name)) {
- return NULL;
- }
-
- irpc_remove_name(iface->msg_ctx, name);
-
- Py_RETURN_NONE;
-}
-
static PyMethodDef py_messaging_methods[] = {
{ "send", (PyCFunction)py_messaging_send, METH_VARARGS|METH_KEYWORDS,
"S.send(target, msg_type, data) -> None\nSend a message" },
@@ -262,8 +219,6 @@ static PyMethodDef py_messaging_methods[] = {
"S.register(callback, msg_type=None) -> msg_type\nRegister a message handler" },
{ "deregister", (PyCFunction)py_messaging_deregister, METH_VARARGS|METH_KEYWORDS,
"S.deregister(callback, msg_type) -> None\nDeregister a message handler" },
- { "add_name", (PyCFunction)py_messaging_add_name, METH_VARARGS|METH_KEYWORDS, "S.add_name(name) -> None\nListen on another name" },
- { "remove_name", (PyCFunction)py_messaging_remove_name, METH_VARARGS|METH_KEYWORDS, "S.remove_name(name) -> None\nStop listening on a name" },
{ NULL, NULL, 0, NULL }
};
@@ -285,7 +240,7 @@ static PyGetSetDef py_messaging_getset[] = {
PyTypeObject messaging_Type = {
PyObject_HEAD_INIT(NULL) 0,
- .tp_name = "irpc.Messaging",
+ .tp_name = "messaging.Messaging",
.tp_basicsize = sizeof(messaging_Object),
.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
.tp_new = py_messaging_connect,
@@ -297,318 +252,17 @@ PyTypeObject messaging_Type = {
"If no path is specified, the default path from smb.conf will be used."
};
-
-/*
- state of a irpc 'connection'
-*/
-typedef struct {
- PyObject_HEAD
- TALLOC_CTX *mem_ctx;
- const char *server_name;
- struct server_id *dest_ids;
- struct messaging_context *msg_ctx;
- struct tevent_context *ev;
-} irpc_ClientConnectionObject;
-
-/*
- setup a context for talking to a irpc server
- example:
- status = irpc.connect("smb_server");
-*/
--
Samba Shared Repository
More information about the samba-cvs
mailing list