[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Fri Jun 25 03:50:00 MDT 2010
The branch, master has been updated
via 5c98ccd... s4 python: Add unit tests related to PyLong/PyInt handling
via 3fc9675... ldb: Fix a wrong changetype in unit test
via 7703b89... pidl: Finish to fix the python generated code for 64bit integers
via 0802f35... smbtorture: Fix loading of --load-list.
via 653b30f... selftest: Clarify generation of idlist option.
from 408a3aa... s4:lib/registry/ldb.c - cosmetic - fix comment
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 5c98ccd70601c475f3bcb34e6a233069c9f542f6
Author: Matthieu Patou <mat at matws.net>
Date: Tue Jun 22 00:58:48 2010 +0400
s4 python: Add unit tests related to PyLong/PyInt handling
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
commit 3fc9675e93c3bfb3381b06bce3d2b130952e9026
Author: Matthieu Patou <mat at matws.net>
Date: Tue Jun 22 19:57:22 2010 +0400
ldb: Fix a wrong changetype in unit test
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
commit 7703b89ae57d76a3246db7489c77c9de848ea832
Author: Matthieu Patou <mat at matws.net>
Date: Mon Jun 21 10:48:58 2010 +0400
pidl: Finish to fix the python generated code for 64bit integers
Signed-off-by: Jelmer Vernooij <jelmer at samba.org>
commit 0802f354ea837b8884c861d6d98f20aa746e4445
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Fri Jun 25 02:40:37 2010 +0200
smbtorture: Fix loading of --load-list.
commit 653b30f91f7f9e13f16d5d6134adaa04b0675257
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Fri Jun 25 02:35:29 2010 +0200
selftest: Clarify generation of idlist option.
-----------------------------------------------------------------------
Summary of changes:
pidl/lib/Parse/Pidl/Samba4/Python.pm | 33 ++++++++++++++++++--
selftest/selftest.pl | 2 +
source4/lib/ldb/tests/test-controls.sh | 2 +-
.../scripting/python/samba/tests/dcerpc/unix.py | 13 ++++++-
source4/selftest/tests.sh | 1 +
source4/torture/smbtorture.c | 22 +++++++------
6 files changed, 57 insertions(+), 16 deletions(-)
Changeset truncated at 500 lines:
diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm
index 4687a53..4c5cc1b 100644
--- a/pidl/lib/Parse/Pidl/Samba4/Python.pm
+++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm
@@ -820,13 +820,40 @@ sub ConvertObjectFromPythonData($$$$$$;$)
$actual_ctype = $actual_ctype->{DATA};
}
- if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP" or
- $actual_ctype->{TYPE} eq "SCALAR" and (
- expandAlias($actual_ctype->{NAME}) =~ /^(u?int[0-9]*|hyper|NTTIME|time_t|NTTIME_hyper|NTTIME_1sec|dlong|udlong|udlongr)$/)) {
+ if ($actual_ctype->{TYPE} eq "ENUM" or $actual_ctype->{TYPE} eq "BITMAP") {
$self->pidl("PY_CHECK_TYPE(&PyInt_Type, $cvar, $fail);");
$self->pidl("$target = PyInt_AsLong($cvar);");
return;
}
+ if ($actual_ctype->{TYPE} eq "SCALAR" ) {
+ if (expandAlias($actual_ctype->{NAME}) =~ /^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) {
+ $self->pidl("if (PyObject_TypeCheck($cvar, &PyLong_Type)) {");
+ $self->indent;
+ $self->pidl("$target = PyLong_AsLongLong($cvar);");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ $self->pidl("if (PyObject_TypeCheck($cvar, &PyInt_Type)) {");
+ $self->indent;
+ $self->pidl("$target = PyInt_AsLong($cvar);");
+ $self->deindent;
+ $self->pidl("} else {");
+ $self->indent;
+ $self->pidl("PyErr_Format(PyExc_TypeError, \"Expected type %s or %s\",\\");
+ $self->pidl(" PyInt_Type.tp_name, PyLong_Type.tp_name);");
+ $self->pidl($fail);
+ $self->deindent;
+ $self->pidl("}");
+ $self->deindent;
+ $self->pidl("}");
+ return;
+ }
+ if (expandAlias($actual_ctype->{NAME}) =~ /^(char|u?int[0-9]*|time_t)$/) {
+ $self->pidl("PY_CHECK_TYPE(&PyInt_Type, $cvar, $fail);");
+ $self->pidl("$target = PyInt_AsLong($cvar);");
+ return;
+ }
+ }
if ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") {
my $ctype_name = $self->use_type_variable($ctype);
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index b0296e1..7f5aa76 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -944,6 +944,8 @@ $envvarstr
next;
}
+ # 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}}) {
diff --git a/source4/lib/ldb/tests/test-controls.sh b/source4/lib/ldb/tests/test-controls.sh
index c78acbf..868e8c2 100755
--- a/source4/lib/ldb/tests/test-controls.sh
+++ b/source4/lib/ldb/tests/test-controls.sh
@@ -37,7 +37,7 @@ EOF
cat <<EOF | $VALGRIND ldbmodify --controls "relax:0" && exit 1
dn: dc=bar
-changetype: replace
+changetype: modify
replace someThing
someThing: someThingElseBetter
EOF
diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py
index bd1fd6d..4e1fe65 100644
--- a/source4/scripting/python/samba/tests/dcerpc/unix.py
+++ b/source4/scripting/python/samba/tests/dcerpc/unix.py
@@ -26,14 +26,23 @@ class UnixinfoTests(RpcInterfaceTestCase):
super(UnixinfoTests, self).setUp()
self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
- def test_getpwuid(self):
+ def test_getpwuid_int(self):
infos = self.conn.GetPWUid(range(512))
self.assertEquals(512, len(infos))
self.assertEquals("/bin/false", infos[0].shell)
self.assertTrue(isinstance(infos[0].homedir, unicode))
+ def test_getpwuid(self):
+ infos = self.conn.GetPWUid(map(long, range(512)))
+ self.assertEquals(512, len(infos))
+ self.assertEquals("/bin/false", infos[0].shell)
+ self.assertTrue(isinstance(infos[0].homedir, unicode))
+
def test_gidtosid(self):
- self.conn.GidToSid(1000)
+ self.conn.GidToSid(1000L)
def test_uidtosid(self):
self.conn.UidToSid(1000)
+
+ def test_uidtosid_fail(self):
+ self.assertRaises(TypeError, self.conn.UidToSid, "100")
diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh
index 6f53406..4181d83 100755
--- a/source4/selftest/tests.sh
+++ b/source4/selftest/tests.sh
@@ -517,3 +517,4 @@ plantestsuite "blackbox.upgradeprovision.py" none PYTHON="$PYTHON" $samba4srcdir
plantestsuite "blackbox.setpassword.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_setpassword.sh "$PREFIX/provision"
plantestsuite "blackbox.newuser.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_newuser.sh "$PREFIX/provision"
plantestsuite "blackbox.group.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_group.sh "$PREFIX/provision"
+plantestsuite_loadlist "blaat" none PYTHON="$PYTHON" "$samba4srcdir/record.py"
diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c
index 14eeff9..9786599 100644
--- a/source4/torture/smbtorture.c
+++ b/source4/torture/smbtorture.c
@@ -410,9 +410,10 @@ int main(int argc,char *argv[])
int num_extra_users = 0;
char **restricted = NULL;
int num_restricted = -1;
+ const char *load_list = NULL;
enum {OPT_LOADFILE=1000,OPT_UNCLIST,OPT_TIMELIMIT,OPT_DNS, OPT_LIST,
OPT_DANGEROUS,OPT_SMB_PORTS,OPT_ASYNC,OPT_NUMPROGS,
- OPT_EXTRA_USER,OPT_LOAD_LIST,};
+ OPT_EXTRA_USER,};
struct poptOption long_options[] = {
POPT_AUTOHELP
@@ -442,7 +443,7 @@ int main(int argc,char *argv[])
"set maximum time for smbtorture to live", "seconds"},
{"extra-user", 0, POPT_ARG_STRING, NULL, OPT_EXTRA_USER,
"extra user credentials", NULL},
- {"load-list", 0, POPT_ARG_STRING, NULL, OPT_LOAD_LIST,
+ {"load-list", 0, POPT_ARG_STRING, &load_list, 0,
"load a test id list from a text file", NULL},
POPT_COMMON_SAMBA
POPT_COMMON_CONNECTION
@@ -496,14 +497,6 @@ int main(int argc,char *argv[])
talloc_free(option);
}
break;
- case OPT_LOAD_LIST:
- restricted = file_lines_load(optarg, &num_restricted, 0,
- talloc_autofree_context());
- if (restricted == NULL) {
- printf("Unable to read load list file '%s'\n", optarg);
- exit(1);
- }
- break;
default:
if (opt < 0) {
printf("bad command line option %d\n", opt);
@@ -512,6 +505,15 @@ int main(int argc,char *argv[])
}
}
+ if (load_list != NULL) {
+ restricted = file_lines_load(load_list, &num_restricted, 0,
+ talloc_autofree_context());
+ if (restricted == NULL) {
+ printf("Unable to read load list file '%s'\n", load_list);
+ exit(1);
+ }
+ }
+
if (strcmp(target, "samba3") == 0) {
lp_set_cmdline(cmdline_lp_ctx, "torture:samba3", "true");
lp_set_cmdline(cmdline_lp_ctx, "torture:resume_key_support", "false");
--
Samba Shared Repository
More information about the samba-cvs
mailing list