[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Wed Sep 22 23:28:56 MDT 2010
The branch, master has been updated
via 7378b6d s4-selftest: Move credentials tests to standard python directory.
via cc5b673 s4-selftest: Move samba3sam test to standard python directory.
via 5651f8a s4-selftest: Fix prefixes for ldb tests - they're samba4 specific.
via 136aa0d smbtorture: Report times.
via a15a33a torture: Use system subunit library if available.
via 029add7 smbtorture: Use subunit C library.
via 20c95cf selftest: Fix testsuite counts when running only a limited number of testsuites.
via 3d0e6db selftest: Fix idlist running.
via f9ed11c s4-selftest: For idlist tests, leave out environment name.
via 0dde34f s4-selftest: Add environment name to test suite manually, so we can leave it out if we want to.
via 9bce783 selftest: Fix use of --load-list.
via cd8d780 s4-selftest: Cleanup formatting.
via a171816 selftest: Add prefix on a higher level, so it can be more easily excluded.
from 7170b87 Thank goodness for code reviews. Volker caught - this should be lp_posix_pathnames() not lp_unix_extensions().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 7378b6d2a20a8ff0678891b6ef1d72afbfe8c1e0
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 22:08:04 2010 -0700
s4-selftest: Move credentials tests to standard python directory.
commit cc5b673e18246f35a908152b7c4a8cb0dc3a89f2
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 22:05:55 2010 -0700
s4-selftest: Move samba3sam test to standard python directory.
commit 5651f8a9a77c09f585f4ba8ab04fe9968a5432cb
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 22:02:39 2010 -0700
s4-selftest: Fix prefixes for ldb tests - they're samba4 specific.
commit 136aa0d5ac8d3105cdebb579edf4a8043b5cc83f
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 21:03:05 2010 -0700
smbtorture: Report times.
commit a15a33a9a8806426955fb3cab6b798ab4173cc67
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 20:18:45 2010 -0700
torture: Use system subunit library if available.
commit 029add7e079cc9532016b49c323b52eadef25695
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:55:58 2010 -0700
smbtorture: Use subunit C library.
commit 20c95cf6856b7d18784e8429d1ba31443a883d49
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:28:02 2010 -0700
selftest: Fix testsuite counts when running only a limited number of
testsuites.
commit 3d0e6db9dc68aace8b2993faa45f48b3f5f4e855
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:21:58 2010 -0700
selftest: Fix idlist running.
commit f9ed11c7562d1ff2cf23de0057df6ff80927c9fc
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:14:33 2010 -0700
s4-selftest: For idlist tests, leave out environment name.
commit 0dde34ffc7bab04c9dd320d98ad543fac98b12e5
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:13:16 2010 -0700
s4-selftest: Add environment name to test suite manually, so we can
leave it out if we want to.
commit 9bce7838788db26c9846b619e3ac7edc46a65beb
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 19:08:37 2010 -0700
selftest: Fix use of --load-list.
commit cd8d7804208c9674be07b239e22fd4f612fb9952
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 18:53:52 2010 -0700
s4-selftest: Cleanup formatting.
commit a171816672b4ffca18c3a3b9a0f4d8fb6f0487ee
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Wed Sep 22 18:30:27 2010 -0700
selftest: Add prefix on a higher level, so it can be more easily
excluded.
-----------------------------------------------------------------------
Summary of changes:
lib/subunit/c/wscript | 14 +
lib/torture/subunit.c | 79 ++++--
lib/torture/torture.c | 10 +-
lib/torture/torture.h | 3 +
lib/torture/wscript_build | 2 +-
selftest/selftest.pl | 29 ++-
source4/scripting/python/samba/tests/__init__.py | 41 ---
source4/scripting/python/samba/tests/core.py | 65 +++++
.../python/samba/tests/credentials.py} | 0
.../python/samba}/tests/samba3sam.py | 0
source4/selftest/knownfail | 2 +-
source4/selftest/tests.sh | 298 +++++++++----------
source4/torture/smbtorture.c | 2 +
source4/wscript | 1 +
14 files changed, 305 insertions(+), 241 deletions(-)
create mode 100644 lib/subunit/c/wscript
create mode 100644 source4/scripting/python/samba/tests/core.py
rename source4/{auth/credentials/tests/bindings.py => scripting/python/samba/tests/credentials.py} (100%)
rename source4/{dsdb/samdb/ldb_modules => scripting/python/samba}/tests/samba3sam.py (100%)
Changeset truncated at 500 lines:
diff --git a/lib/subunit/c/wscript b/lib/subunit/c/wscript
new file mode 100644
index 0000000..7544912
--- /dev/null
+++ b/lib/subunit/c/wscript
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+import Options
+
+def configure(conf):
+ if conf.CHECK_BUNDLED_SYSTEM('subunit', checkfunctions='subunit_test_start', headers='subunit/child.h'):
+ conf.define('USING_SYSTEM_SUBUNIT', 1)
+
+def build(bld):
+ if bld.CONFIG_SET('USING_SYSTEM_SUBUNIT'):
+ return
+
+ bld.SAMBA_LIBRARY('subunit', source='lib/child.c', is_bundled=True,
+ includes='include')
diff --git a/lib/torture/subunit.c b/lib/torture/subunit.c
index 6c58cfe..a190975 100644
--- a/lib/torture/subunit.c
+++ b/lib/torture/subunit.c
@@ -19,69 +19,93 @@
#include "includes.h"
#include "lib/torture/torture.h"
+#include <subunit/child.h>
-static void subunit_suite_start(struct torture_context *ctx,
+static void torture_subunit_suite_start(struct torture_context *ctx,
struct torture_suite *suite)
{
}
-static void subunit_print_testname(struct torture_context *ctx,
+static char *torture_subunit_test_name(struct torture_context *ctx,
struct torture_tcase *tcase,
struct torture_test *test)
{
if (!strcmp(tcase->name, test->name)) {
- printf("%s", test->name);
+ return talloc_strdup(ctx, test->name);
} else {
- printf("%s.%s", tcase->name, test->name);
+ return talloc_asprintf(ctx, "%s.%s", tcase->name, test->name);
}
}
-static void subunit_test_start(struct torture_context *ctx,
+static void torture_subunit_report_time(struct torture_context *tctx)
+{
+ struct timespec tp;
+ struct tm *tmp;
+ char timestr[200];
+ if (clock_gettime(CLOCK_REALTIME, &tp) != 0) {
+ perror("clock_gettime");
+ return;
+ }
+
+ tmp = localtime(&tp.tv_sec);
+ if (!tmp) {
+ perror("localtime");
+ return;
+ }
+
+ if (strftime(timestr, sizeof(timestr), "%Y-%m-%d %H:%M:%S", tmp) <= 0) {
+ perror("strftime");
+ return;
+ }
+
+ printf("time: %s.%06ld\n", timestr, tp.tv_nsec / 1000);
+}
+
+static void torture_subunit_test_start(struct torture_context *context,
struct torture_tcase *tcase,
struct torture_test *test)
{
- printf("test: ");
- subunit_print_testname(ctx, tcase, test);
- printf("\n");
+ char *fullname = torture_subunit_test_name(context, context->active_tcase, context->active_test);
+ subunit_test_start(fullname);
+ torture_subunit_report_time(context);
+ talloc_free(fullname);
}
-static void subunit_test_result(struct torture_context *context,
+static void torture_subunit_test_result(struct torture_context *context,
enum torture_result res, const char *reason)
{
+ char *fullname = torture_subunit_test_name(context, context->active_tcase, context->active_test);
+ torture_subunit_report_time(context);
switch (res) {
case TORTURE_OK:
- printf("success: ");
+ subunit_test_pass(fullname);
break;
case TORTURE_FAIL:
- printf("failure: ");
+ subunit_test_fail(fullname, reason);
break;
case TORTURE_ERROR:
- printf("error: ");
+ subunit_test_error(fullname, reason);
break;
case TORTURE_SKIP:
- printf("skip: ");
+ subunit_test_skip(fullname, reason);
break;
}
- subunit_print_testname(context, context->active_tcase, context->active_test);
-
- if (reason)
- printf(" [\n%s\n]", reason);
- printf("\n");
+ talloc_free(fullname);
}
-static void subunit_comment(struct torture_context *test,
+static void torture_subunit_comment(struct torture_context *test,
const char *comment)
{
fprintf(stderr, "%s", comment);
}
-static void subunit_warning(struct torture_context *test,
+static void torture_subunit_warning(struct torture_context *test,
const char *comment)
{
fprintf(stderr, "WARNING!: %s\n", comment);
}
-static void subunit_progress(struct torture_context *tctx, int offset, enum torture_progress_whence whence)
+static void torture_subunit_progress(struct torture_context *tctx, int offset, enum torture_progress_whence whence)
{
switch (whence) {
case TORTURE_PROGRESS_SET:
@@ -103,10 +127,11 @@ static void subunit_progress(struct torture_context *tctx, int offset, enum tort
}
const struct torture_ui_ops torture_subunit_ui_ops = {
- .comment = subunit_comment,
- .warning = subunit_warning,
- .test_start = subunit_test_start,
- .test_result = subunit_test_result,
- .suite_start = subunit_suite_start,
- .progress = subunit_progress,
+ .comment = torture_subunit_comment,
+ .warning = torture_subunit_warning,
+ .test_start = torture_subunit_test_start,
+ .test_result = torture_subunit_test_result,
+ .suite_start = torture_subunit_suite_start,
+ .progress = torture_subunit_progress,
+ .report_time = torture_subunit_report_time,
};
diff --git a/lib/torture/torture.c b/lib/torture/torture.c
index d6f893e..379f1dd 100644
--- a/lib/torture/torture.c
+++ b/lib/torture/torture.c
@@ -277,7 +277,6 @@ bool torture_run_suite_restricted(struct torture_context *context,
bool ret = true;
struct torture_tcase *tcase;
struct torture_suite *tsuite;
- char *old_testname;
if (context->results->ui_ops->suite_start)
context->results->ui_ops->suite_start(context, suite);
@@ -346,7 +345,7 @@ static bool internal_torture_run_test(struct torture_context *context,
if (tcase == NULL || strcmp(test->name, tcase->name) != 0) {
subunit_testname = talloc_asprintf(context, "%s.%s", tcase->name, test->name);
} else {
- subunit_testname = test->name;
+ subunit_testname = talloc_strdup(context, test->name);
}
if (!test_needs_running(subunit_testname, restricted))
@@ -410,7 +409,6 @@ 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;
bool setup_succeeded = true;
const char * setup_reason = "Setup failed";
@@ -684,3 +682,9 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
return test;
}
+
+void torture_ui_report_time(struct torture_context *context)
+{
+ if (context->results->ui_ops->report_time)
+ context->results->ui_ops->report_time(context);
+}
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 90513b7..01947e7 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -60,6 +60,7 @@ struct torture_ui_ops
void (*test_result) (struct torture_context *,
enum torture_result, const char *reason);
void (*progress) (struct torture_context *, int offset, enum torture_progress_whence whence);
+ void (*report_time) (struct torture_context *);
};
void torture_ui_test_start(struct torture_context *context,
@@ -70,6 +71,8 @@ void torture_ui_test_result(struct torture_context *context,
enum torture_result result,
const char *comment);
+void torture_ui_report_time(struct torture_context *context);
+
/*
* Holds information about a specific run of the testsuite.
* The data in this structure should be considered private to
diff --git a/lib/torture/wscript_build b/lib/torture/wscript_build
index 6866624..7830b3a 100644
--- a/lib/torture/wscript_build
+++ b/lib/torture/wscript_build
@@ -2,7 +2,7 @@
bld.SAMBA_LIBRARY('torture',
- source='torture.c subunit.c',
+ source='torture.c subunit.c ../subunit/c/lib/child.c',
vnum='0.0.1',
pc_files='torture.pc',
public_deps='LIBSAMBA-HOSTCONFIG LIBSAMBA-UTIL LIBSAMBA-ERRORS talloc tevent',
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index f973ae5..4ed168c 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -686,18 +686,13 @@ if ($opt_load_list) {
close(LOAD_LIST);
}
-Subunit::progress($#available+1);
-Subunit::report_time(time());
-
my $individual_tests = undef;
$individual_tests = {};
foreach my $testsuite (@available) {
my $name = $$testsuite[0];
my $skipreason = skip($name);
- if (defined($skipreason)) {
- Subunit::skip_testsuite($name, $skipreason);
- } elsif (defined($restricted)) {
+ if (defined($restricted)) {
# Find the testsuite for this test
my $match = undef;
foreach my $r (@$restricted) {
@@ -706,14 +701,22 @@ foreach my $testsuite (@available) {
$match = $r;
$restricted_used->{$r} = 1;
} elsif (substr($r, 0, length($name)+1) eq "$name.") {
- push(@{$individual_tests->{$name}}, substr($r, length($name)+1));
+ push(@{$individual_tests->{$name}}, $r);
$match = $r;
$restricted_used->{$r} = 1;
}
}
- push(@todo, $testsuite) if ($match);
+ if ($match) {
+ if (defined($skipreason)) {
+ Subunit::skip_testsuite($name, $skipreason);
+ } else {
+ push(@todo, $testsuite);
+ }
+ }
+ } elsif (defined($skipreason)) {
+ Subunit::skip_testsuite($name, $skipreason);
} else {
- push(@todo, $testsuite);
+ push(@todo, $testsuite);
}
}
@@ -729,6 +732,10 @@ if (defined($restricted)) {
}
my $suitestotal = $#todo + 1;
+
+Subunit::progress($suitestotal);
+Subunit::report_time(time());
+
my $i = 0;
$| = 1;
@@ -938,9 +945,9 @@ $envvarstr
if ($$_[3]) {
my ($fh, $listid_file) = tempfile(UNLINK => 0);
foreach my $test (@{$individual_tests->{$name}}) {
- print $fh "$test\n";
+ print $fh substr($test, length($name)+1) . "\n";
}
- $cmd .= " --load-list=$listid_file";
+ $cmd =~ s/\$LOADLIST/--load-list=$listid_file/g;
} elsif ($$_[4]) {
$cmd =~ s/\s+[^\s]+\s*$//;
$cmd .= " " . join(' ', @{$individual_tests->{$name}});
diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py
index 9644bad..f2c2fbf 100644
--- a/source4/scripting/python/samba/tests/__init__.py
+++ b/source4/scripting/python/samba/tests/__init__.py
@@ -59,47 +59,6 @@ class TestCaseInTempDir(TestCase):
os.rmdir(self.tempdir)
-class SubstituteVarTestCase(TestCase):
-
- def test_empty(self):
- self.assertEquals("", samba.substitute_var("", {}))
-
- def test_nothing(self):
- self.assertEquals("foo bar",
- samba.substitute_var("foo bar", {"bar": "bla"}))
-
- def test_replace(self):
- self.assertEquals("foo bla",
- samba.substitute_var("foo ${bar}", {"bar": "bla"}))
-
- def test_broken(self):
- self.assertEquals("foo ${bdkjfhsdkfh sdkfh ",
- samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
-
- def test_unknown_var(self):
- self.assertEquals("foo ${bla} gsff",
- samba.substitute_var("foo ${bla} gsff", {"bar": "bla"}))
-
- def test_check_all_substituted(self):
- samba.check_all_substituted("nothing to see here")
- self.assertRaises(Exception, samba.check_all_substituted,
- "Not subsituted: ${FOOBAR}")
-
-
-class LdbExtensionTests(TestCaseInTempDir):
-
- def test_searchone(self):
- path = self.tempdir + "/searchone.ldb"
- l = samba.Ldb(path)
- try:
- l.add({"dn": "foo=dc", "bar": "bla"})
- self.assertEquals("bla",
- l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
- finally:
- del l
- os.unlink(path)
-
-
def env_loadparm():
lp = param.LoadParm()
try:
diff --git a/source4/scripting/python/samba/tests/core.py b/source4/scripting/python/samba/tests/core.py
new file mode 100644
index 0000000..1c3d7db
--- /dev/null
+++ b/source4/scripting/python/samba/tests/core.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Unix SMB/CIFS implementation.
+# Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007-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/>.
+#
+
+"""Samba Python tests."""
+
+import ldb
+import os
+import samba
+from samba.tests import TestCase, TestCaseInTempDir
+
+class SubstituteVarTestCase(TestCase):
+
+ def test_empty(self):
+ self.assertEquals("", samba.substitute_var("", {}))
+
+ def test_nothing(self):
+ self.assertEquals("foo bar",
+ samba.substitute_var("foo bar", {"bar": "bla"}))
+
+ def test_replace(self):
+ self.assertEquals("foo bla",
+ samba.substitute_var("foo ${bar}", {"bar": "bla"}))
+
+ def test_broken(self):
+ self.assertEquals("foo ${bdkjfhsdkfh sdkfh ",
+ samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"}))
+
+ def test_unknown_var(self):
+ self.assertEquals("foo ${bla} gsff",
+ samba.substitute_var("foo ${bla} gsff", {"bar": "bla"}))
+
+ def test_check_all_substituted(self):
+ samba.check_all_substituted("nothing to see here")
+ self.assertRaises(Exception, samba.check_all_substituted,
+ "Not subsituted: ${FOOBAR}")
+
+
+class LdbExtensionTests(TestCaseInTempDir):
+
+ def test_searchone(self):
+ path = self.tempdir + "/searchone.ldb"
+ l = samba.Ldb(path)
+ try:
+ l.add({"dn": "foo=dc", "bar": "bla"})
+ self.assertEquals("bla",
+ l.searchone(basedn=ldb.Dn(l, "foo=dc"), attribute="bar"))
+ finally:
+ del l
+ os.unlink(path)
diff --git a/source4/auth/credentials/tests/bindings.py b/source4/scripting/python/samba/tests/credentials.py
similarity index 100%
rename from source4/auth/credentials/tests/bindings.py
rename to source4/scripting/python/samba/tests/credentials.py
diff --git a/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py b/source4/scripting/python/samba/tests/samba3sam.py
similarity index 100%
rename from source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
rename to source4/scripting/python/samba/tests/samba3sam.py
diff --git a/source4/selftest/knownfail b/source4/selftest/knownfail
index 674501f..caff2f5 100644
--- a/source4/selftest/knownfail
+++ b/source4/selftest/knownfail
@@ -55,7 +55,7 @@ samba4.*base.delaywrite.*update of write time using SET_END_OF_FILE$
samba4.*base.delaywrite.*update of write time using SET_ALLOCATION_SIZE$
samba4.ldap.python \(dc\).Test add_ldif\(\) with BASE64 security descriptor input using WRONG domain SID$
# some operations don't work over the CIFS NTVFS backend yet (eg. root_fid)
-samba4.ntvfs.cifs.base.createx_access
+samba4.ntvfs.cifs.base.createx_access
samba4.ntvfs.cifs.base.createx_sharemodes_dir
samba4.ntvfs.cifs.base.maximum_allowed
samba4.base.createx_access # this test is broken for non-administrator users
diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh
index b4f893e..326e52f 100755
--- a/source4/selftest/tests.sh
+++ b/source4/selftest/tests.sh
@@ -34,14 +34,9 @@ plantestsuite() {
shift 2
cmdline="$*"
echo "-- TEST --"
- if [ "$env" = "none" ]; then
- fullname="samba4.$name"
- else
- fullname="samba4.$name ($env)"
- fi
- echo $fullname
+ echo $name
echo $env
- echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\""
+ echo "$cmdline 2>&1 | ../selftest/filter-subunit --prefix=\"$name.\""
}
plantestsuite_loadlist() {
@@ -51,13 +46,13 @@ plantestsuite_loadlist() {
cmdline="$*"
echo "-- TEST-LOADLIST --"
if [ "$env" = "none" ]; then
- fullname="samba4.$name"
+ fullname="$name"
else
- fullname="samba4.$name ($env)"
+ fullname="$name ($env)"
fi
echo $fullname
echo $env
- echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\""
+ echo "$cmdline \$LOADLIST 2>&1 | ../selftest/filter-subunit --prefix=\"$fullname.\""
}
plantestsuite_idlist() {
@@ -66,14 +61,9 @@ plantestsuite_idlist() {
shift 2
cmdline="$*"
echo "-- TEST-IDLIST --"
- if [ "$env" = "none" ]; then
- fullname="$name"
- else
- fullname="$name ($env)"
- fi
- echo $fullname
+ echo $name
echo $env
- echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\""
+ echo $cmdline
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list