summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-25 16:36:53 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-26 11:57:08 -0600
commit43a03b0fb48ceb528539a16b0023fb5b30b7a79e (patch)
tree70102e3e78475c0f3845157b2d720503cca350c8
parent327847b98765e29a10f70e2b7512bd9acd6a0570 (diff)
downloadsamba-43a03b0fb48ceb528539a16b0023fb5b30b7a79e.tar.gz
samba-43a03b0fb48ceb528539a16b0023fb5b30b7a79e.tar.bz2
samba-43a03b0fb48ceb528539a16b0023fb5b30b7a79e.zip
r26598: Simplify the way Python tests are run.
(This used to be commit d649f73431fc993e31522e7fc8e1e35e0a4421d8)
-rw-r--r--source4/dsdb/samdb/ldb_modules/tests/samba3sam.py6
-rw-r--r--source4/samba4-skip1
-rwxr-xr-xsource4/scripting/bin/subunitrun3
-rwxr-xr-xsource4/selftest/samba4_tests.sh29
-rwxr-xr-xsource4/setup/provision.py2
-rwxr-xr-xsource4/setup/upgrade.py2
6 files changed, 23 insertions, 20 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py b/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
index 8ca92e152e..b083b68da6 100644
--- a/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
+++ b/source4/dsdb/samdb/ldb_modules/tests/samba3sam.py
@@ -1034,18 +1034,18 @@ revision: 2
self.samba4.connect()
def tearDown(self):
- super(Samba3SamTestCase, self).tearDown()
os.unlink(self.ldbfile)
os.unlink(self.samba3.file)
os.unlink(self.templates.file)
os.unlink(self.samba4.file)
+ super(Samba3SamTestCase, self).tearDown()
def test_s3sam(self):
ldb = Ldb(self.ldburl)
self.setup_data(self.samba3, open(os.path.join(datadir, "samba3.ldif"), 'r').read())
self.setup_data(self.templates, open(os.path.join(datadir, "provision_samba3sam_templates.ldif"), 'r').read())
ldif = open(os.path.join(datadir, "provision_samba3sam.ldif"), 'r').read()
- ldb.add_ldif(substitute_var(ldif, s4.substvars))
+ ldb.add_ldif(substitute_var(ldif, self.samba4.substvars))
self.setup_modules(ldb, self.samba3, self.samba4)
ldb = Ldb(self.ldburl)
@@ -1057,7 +1057,7 @@ revision: 2
ldb = Ldb(self.ldburl)
self.setup_data(self.templates, open(os.path.join(datadir, "provision_samba3sam_templates.ldif"), 'r').read())
ldif = open(os.path.join(datadir, "provision_samba3sam.ldif"), 'r').read()
- ldb.add_ldif(substitute_var(ldif, s4.substvars))
+ ldb.add_ldif(substitute_var(ldif, self.samba4.substvars))
self.setup_modules(ldb, self.samba3, self.samba4)
ldb = Ldb(self.ldburl)
diff --git a/source4/samba4-skip b/source4/samba4-skip
index 6115b28ec8..99c1799a7a 100644
--- a/source4/samba4-skip
+++ b/source4/samba4-skip
@@ -50,3 +50,4 @@ RPC-FRSAPI # Not provided by Samba 4
WINBIND # FIXME: This should not be skipped
NSS-TEST # Fails
samba4.ldap.python # Conversion from EJS not yet finished
+samba4.samba3sam.python # Conversion from EJS not yet finished
diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index add2b91a44..7142abed85 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -21,5 +21,6 @@ from subunit import SubunitTestRunner
import sys
from unittest import TestProgram
-program = TestProgram(module=None, argv=sys.argv, testRunner=SubunitTestRunner())
+program = TestProgram(module=None, argv=sys.argv,
+ testRunner=SubunitTestRunner())
program.runTests()
diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh
index 309b2c067e..065a827e5b 100755
--- a/source4/selftest/samba4_tests.sh
+++ b/source4/selftest/samba4_tests.sh
@@ -284,24 +284,21 @@ fi
if test -f $samba4bindir/smbpython
then
PYTHON=bin/smbpython
- plantest "ldb.python" none PYTHONPATH=bin/python:scripting/python:lib/ldb/tests/python/ $PYTHON scripting/bin/subunitrun api
- plantest "credentials.python" none PYTHONPATH=bin/python:scripting/python:auth/credentials/tests $PYTHON scripting/bin/subunitrun bindings
- plantest "registry.python" none PYTHONPATH=bin/python:scripting/python:lib/registry/tests/ $PYTHON scripting/bin/subunitrun bindings
- plantest "tdb.python" none PYTHONPATH=bin/python:scripting/python:lib/tdb/python/tests $PYTHON scripting/bin/subunitrun simple
- plantest "auth.python" none PYTHONPATH=bin/python:scripting/python:auth/tests/ $PYTHON scripting/bin/subunitrun bindings
- plantest "security.python" none PYTHONPATH=bin/python:scripting/python:libcli/security/tests/ $PYTHON scripting/bin/subunitrun bindings
- plantest "param.python" none PYTHONPATH=bin/python:scripting/python:param/tests $PYTHON scripting/bin/subunitrun bindings
- plantest "upgrade.python" none PYTHONPATH=bin/python:scripting/python $PYTHON scripting/bin/subunitrun samba.tests.upgrade
- plantest "samba.python" none PYTHONPATH=bin/python:scripting/python $PYTHON scripting/bin/subunitrun samba.tests
- plantest "provision.python" none PYTHONPATH=bin/python:scripting/python $PYTHON scripting/bin/subunitrun samba.tests.provision
- plantest "samba3.python" none PYTHONPATH=bin/python:scripting/python $PYTHON scripting/bin/subunitrun samba.tests.samba3
- plantest "samba3sam.python" none PYTHONPATH=bin/python:scripting/python $PYTHON dsdb/samdb/ldb_modules/tests/samba3sam.py `pwd` $DATADIR/samba3/
+ SUBUNITRUN="$PYTHON ./scripting/bin/subunitrun"
+ plantest "ldb.python" none PYTHONPATH="$PYTHONPATH:lib/ldb/tests/python/" $SUBUNITRUN api
+ plantest "credentials.python" none PYTHONPATH="$PYTHONPATH:auth/credentials/tests" $SUBUNITRUN bindings
+ plantest "registry.python" none PYTHONPATH="$PYTHONPATH:lib/registry/tests/" $SUBUNITRUN bindings
+ plantest "tdb.python" none PYTHONPATH="$PYTHONPATH:lib/tdb/python/tests" $SUBUNITRUN simple
+ plantest "auth.python" none PYTHONPATH="$PYTHONPATH:auth/tests/" $SUBUNITRUN bindings
+ plantest "security.python" none PYTHONPATH="$PYTHONPATH:libcli/security/tests" $SUBUNITRUN bindings
+ plantest "param.python" none PYTHONPATH="$PYTHONPATH:param/tests" $SUBUNITRUN bindings
+ plantest "upgrade.python" none $SUBUNITRUN samba.tests.upgrade
+ plantest "samba.python" none $SUBUNITRUN samba.tests
+ plantest "provision.python" none $SUBUNITRUN samba.tests.provision
+ plantest "samba3.python" none $SUBUNITRUN samba.tests.samba3
+ plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py \$SERVER -U\$USERNAME%\$PASSWORD
plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
- rm -rf $PREFIX/upgrade
- mkdir -p $PREFIX/upgrade
plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX ../testdata/samba3 ../testdata/samba3/smb.conf
- rm -rf $PREFIX/provision
- mkdir -p $PREFIX/provision
plantest "blackbox.provision.py" none $PYTHON ./setup/provision.py $CONFIGURATION --domain=FOO --realm=foo --targetdir=$PREFIX/provision
fi
diff --git a/source4/setup/provision.py b/source4/setup/provision.py
index f6f032da70..94560fc042 100755
--- a/source4/setup/provision.py
+++ b/source4/setup/provision.py
@@ -116,6 +116,8 @@ lp = param.LoadParm()
if opts.configfile:
lp.load(opts.configfile)
if opts.targetdir is not None:
+ if not os.path.exists(opts.targetdir):
+ os.mkdir(opts.targetdir)
lp.set("private dir", os.path.abspath(opts.targetdir))
lp.set("lock dir", os.path.abspath(opts.targetdir))
lp.set("realm", opts.realm)
diff --git a/source4/setup/upgrade.py b/source4/setup/upgrade.py
index c531e28ed5..ea6f83d7de 100755
--- a/source4/setup/upgrade.py
+++ b/source4/setup/upgrade.py
@@ -63,6 +63,8 @@ lp = param.LoadParm()
if opts.configfile:
lp.load(opts.configfile)
if opts.targetdir is not None:
+ if not os.path.exists(opts.targetdir):
+ os.mkdir(opts.targetdir)
lp.set("private dir", os.path.abspath(opts.targetdir))
lp.set("lock dir", os.path.abspath(opts.targetdir))
paths = provision_paths_from_lp(lp, "")