The branch, master has been updated via 5f3fcf7... s4-python: Install external included packages only if they're not present on the system. via 0e77bea... installmisc: Support DESTDIR for Python directories. via 62ed8a6... format-subunit: Hide reason if it is None. via 49d82aa... format-subunit: Don't show reason at all if it is None. via a8ac7fd... Put testtools directly under lib/ to make it easier to install from Samba 4. via e4af3af... samba_external: Simplify script to find missing external packages; include subunit and testtools as well. from 31094b0... smbtorture: Report number of available tests in a testsuite using subunit.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 5f3fcf7a7773737fd87c8ff5530fae2286e88927 Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:56:24 2010 +0200 s4-python: Install external included packages only if they're not present on the system. commit 0e77bea165d6db9ca8a138e78f5051234b069789 Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:47:10 2010 +0200 installmisc: Support DESTDIR for Python directories. commit 62ed8a68cd30037f73536c32c7293bc9a3ab88d4 Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:34:50 2010 +0200 format-subunit: Hide reason if it is None. commit 49d82aa7729c5bfa7dde313580630a5ff97fc05a Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:32:23 2010 +0200 format-subunit: Don't show reason at all if it is None. commit a8ac7fda573a924debf165d39eff3c1837240d4f Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:19:18 2010 +0200 Put testtools directly under lib/ to make it easier to install from Samba 4. commit e4af3afd7ae3e39218b42a42d39c2ec10be9a642 Author: Jelmer Vernooij <jel...@samba.org> Date: Wed Mar 31 03:15:24 2010 +0200 samba_external: Simplify script to find missing external packages; include subunit and testtools as well. ----------------------------------------------------------------------- Summary of changes: lib/subunit/update.sh | 17 ----------------- lib/{subunit/python => }/testtools/__init__.py | 0 lib/{subunit/python => }/testtools/content.py | 0 lib/{subunit/python => }/testtools/content_type.py | 0 lib/{subunit/python => }/testtools/matchers.py | 0 lib/{subunit/python => }/testtools/run.py | 0 lib/{subunit/python => }/testtools/runtest.py | 0 lib/{subunit/python => }/testtools/testcase.py | 0 .../python => }/testtools/testresult/__init__.py | 0 .../python => }/testtools/testresult/doubles.py | 0 .../python => }/testtools/testresult/real.py | 0 .../python => }/testtools/tests/__init__.py | 0 .../python => }/testtools/tests/helpers.py | 0 .../python => }/testtools/tests/test_content.py | 0 .../testtools/tests/test_content_type.py | 0 .../python => }/testtools/tests/test_matchers.py | 0 .../python => }/testtools/tests/test_runtest.py | 0 .../python => }/testtools/tests/test_testresult.py | 0 .../python => }/testtools/tests/test_testsuite.py | 0 .../python => }/testtools/tests/test_testtools.py | 0 lib/{subunit/python => }/testtools/testsuite.py | 0 lib/{subunit/python => }/testtools/utils.py | 0 lib/update-external.sh | 19 +++++++++++++++++++ selftest/format-subunit | 14 +++++++------- source4/lib/ldb/tests/python/deletetest.py | 1 + source4/lib/ldb/tests/python/urgent_replication.py | 8 +------- source4/script/installmisc.sh | 9 +++++---- source4/scripting/python/config.mk | 4 ++-- source4/scripting/python/samba_external/missing.py | 13 +++++++++---- source4/selftest/tests.sh | 14 +++++++------- 30 files changed, 51 insertions(+), 48 deletions(-) delete mode 100755 lib/subunit/update.sh rename lib/{subunit/python => }/testtools/__init__.py (100%) rename lib/{subunit/python => }/testtools/content.py (100%) rename lib/{subunit/python => }/testtools/content_type.py (100%) rename lib/{subunit/python => }/testtools/matchers.py (100%) rename lib/{subunit/python => }/testtools/run.py (100%) rename lib/{subunit/python => }/testtools/runtest.py (100%) rename lib/{subunit/python => }/testtools/testcase.py (100%) rename lib/{subunit/python => }/testtools/testresult/__init__.py (100%) rename lib/{subunit/python => }/testtools/testresult/doubles.py (100%) rename lib/{subunit/python => }/testtools/testresult/real.py (100%) rename lib/{subunit/python => }/testtools/tests/__init__.py (100%) rename lib/{subunit/python => }/testtools/tests/helpers.py (100%) rename lib/{subunit/python => }/testtools/tests/test_content.py (100%) rename lib/{subunit/python => }/testtools/tests/test_content_type.py (100%) rename lib/{subunit/python => }/testtools/tests/test_matchers.py (100%) rename lib/{subunit/python => }/testtools/tests/test_runtest.py (100%) rename lib/{subunit/python => }/testtools/tests/test_testresult.py (100%) rename lib/{subunit/python => }/testtools/tests/test_testsuite.py (100%) rename lib/{subunit/python => }/testtools/tests/test_testtools.py (100%) rename lib/{subunit/python => }/testtools/testsuite.py (100%) rename lib/{subunit/python => }/testtools/utils.py (100%) create mode 100755 lib/update-external.sh Changeset truncated at 500 lines: diff --git a/lib/subunit/update.sh b/lib/subunit/update.sh deleted file mode 100755 index 1b27ba6..0000000 --- a/lib/subunit/update.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# Pull in a new snapshot of Subunit from the upstream bzr branch - -TARGETDIR="`dirname $0`" -WORKDIR="`mktemp -d`" - -bzr export "$WORKDIR/subunit" lp:subunit -bzr export "$WORKDIR/testtools" lp:testtools - -for p in python/ filters/ perl/ -do - rsync -avz --delete "$WORKDIR/subunit/$p" "$TARGETDIR/$p" -done - -rsync -avz --delete "$WORKDIR/testtools/testtools/" "$TARGETDIR/python/testtools/" - -rm -rf "$WORKDIR" diff --git a/lib/subunit/python/testtools/__init__.py b/lib/testtools/__init__.py similarity index 100% rename from lib/subunit/python/testtools/__init__.py rename to lib/testtools/__init__.py diff --git a/lib/subunit/python/testtools/content.py b/lib/testtools/content.py similarity index 100% rename from lib/subunit/python/testtools/content.py rename to lib/testtools/content.py diff --git a/lib/subunit/python/testtools/content_type.py b/lib/testtools/content_type.py similarity index 100% rename from lib/subunit/python/testtools/content_type.py rename to lib/testtools/content_type.py diff --git a/lib/subunit/python/testtools/matchers.py b/lib/testtools/matchers.py similarity index 100% rename from lib/subunit/python/testtools/matchers.py rename to lib/testtools/matchers.py diff --git a/lib/subunit/python/testtools/run.py b/lib/testtools/run.py similarity index 100% rename from lib/subunit/python/testtools/run.py rename to lib/testtools/run.py diff --git a/lib/subunit/python/testtools/runtest.py b/lib/testtools/runtest.py similarity index 100% rename from lib/subunit/python/testtools/runtest.py rename to lib/testtools/runtest.py diff --git a/lib/subunit/python/testtools/testcase.py b/lib/testtools/testcase.py similarity index 100% rename from lib/subunit/python/testtools/testcase.py rename to lib/testtools/testcase.py diff --git a/lib/subunit/python/testtools/testresult/__init__.py b/lib/testtools/testresult/__init__.py similarity index 100% rename from lib/subunit/python/testtools/testresult/__init__.py rename to lib/testtools/testresult/__init__.py diff --git a/lib/subunit/python/testtools/testresult/doubles.py b/lib/testtools/testresult/doubles.py similarity index 100% rename from lib/subunit/python/testtools/testresult/doubles.py rename to lib/testtools/testresult/doubles.py diff --git a/lib/subunit/python/testtools/testresult/real.py b/lib/testtools/testresult/real.py similarity index 100% rename from lib/subunit/python/testtools/testresult/real.py rename to lib/testtools/testresult/real.py diff --git a/lib/subunit/python/testtools/tests/__init__.py b/lib/testtools/tests/__init__.py similarity index 100% rename from lib/subunit/python/testtools/tests/__init__.py rename to lib/testtools/tests/__init__.py diff --git a/lib/subunit/python/testtools/tests/helpers.py b/lib/testtools/tests/helpers.py similarity index 100% rename from lib/subunit/python/testtools/tests/helpers.py rename to lib/testtools/tests/helpers.py diff --git a/lib/subunit/python/testtools/tests/test_content.py b/lib/testtools/tests/test_content.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_content.py rename to lib/testtools/tests/test_content.py diff --git a/lib/subunit/python/testtools/tests/test_content_type.py b/lib/testtools/tests/test_content_type.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_content_type.py rename to lib/testtools/tests/test_content_type.py diff --git a/lib/subunit/python/testtools/tests/test_matchers.py b/lib/testtools/tests/test_matchers.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_matchers.py rename to lib/testtools/tests/test_matchers.py diff --git a/lib/subunit/python/testtools/tests/test_runtest.py b/lib/testtools/tests/test_runtest.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_runtest.py rename to lib/testtools/tests/test_runtest.py diff --git a/lib/subunit/python/testtools/tests/test_testresult.py b/lib/testtools/tests/test_testresult.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_testresult.py rename to lib/testtools/tests/test_testresult.py diff --git a/lib/subunit/python/testtools/tests/test_testsuite.py b/lib/testtools/tests/test_testsuite.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_testsuite.py rename to lib/testtools/tests/test_testsuite.py diff --git a/lib/subunit/python/testtools/tests/test_testtools.py b/lib/testtools/tests/test_testtools.py similarity index 100% rename from lib/subunit/python/testtools/tests/test_testtools.py rename to lib/testtools/tests/test_testtools.py diff --git a/lib/subunit/python/testtools/testsuite.py b/lib/testtools/testsuite.py similarity index 100% rename from lib/subunit/python/testtools/testsuite.py rename to lib/testtools/testsuite.py diff --git a/lib/subunit/python/testtools/utils.py b/lib/testtools/utils.py similarity index 100% rename from lib/subunit/python/testtools/utils.py rename to lib/testtools/utils.py diff --git a/lib/update-external.sh b/lib/update-external.sh new file mode 100755 index 0000000..7cf95f3 --- /dev/null +++ b/lib/update-external.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# Pull in a new snapshot of external projects that are included in +# our source tree for users that don't have them installed on their system + +TARGETDIR="`dirname $0`" +WORKDIR="`mktemp -d`" + +echo "Updating subunit..." +bzr export "$WORKDIR/subunit" lp:subunit +for p in python/ filters/ perl/ +do + rsync -avz --delete "$WORKDIR/subunit/$p" "$TARGETDIR/subunit/$p" +done + +echo "Updating testtools..." +bzr export "$WORKDIR/testtools" lp:testtools +rsync -avz --delete "$WORKDIR/testtools/testtools/" "$TARGETDIR/testtools/" + +rm -rf "$WORKDIR" diff --git a/selftest/format-subunit b/selftest/format-subunit index 2ca69c4..4e02f0f 100755 --- a/selftest/format-subunit +++ b/selftest/format-subunit @@ -89,7 +89,9 @@ class PlainFormatter(object): if result in ("success", "xfail"): self.suites_ok+=1 else: - self.output_msg("ERROR: Testsuite[%s]\nREASON: %s\n" % (name, reason or '')) + self.output_msg("ERROR: Testsuite[%s]\n" % name) + if reason is not None: + self.output_msg("REASON: %s\n" % (reason,)) self.suitesfailed.append(name) if self.immediate and not self.verbose: out += self.test_output[name] @@ -106,7 +108,7 @@ class PlainFormatter(object): def start_test(self, testname): pass - def end_test(self, testname, result, unexpected, reason): + def end_test(self, testname, result, unexpected, reason=None): if not unexpected: self.test_output[self.name] = "" if not self.immediate: @@ -117,11 +119,9 @@ class PlainFormatter(object): 'success': '.'}.get(result, "?(%s)" % result)) return - if reason is None: - reason = '' - reason = reason.strip() - - self.test_output[self.name] += "UNEXPECTED(%s): %s\nREASON: %s\n" % (result, testname, reason) + self.test_output[self.name] += "UNEXPECTED(%s): %s\n" % (result, testname) + if reason is not None: + self.test_output[self.name] += "REASON: %s\n" % (reason.strip(),) if self.immediate and not self.verbose: print self.test_output[self.name] diff --git a/source4/lib/ldb/tests/python/deletetest.py b/source4/lib/ldb/tests/python/deletetest.py index 13bec7e..eff92c5 100755 --- a/source4/lib/ldb/tests/python/deletetest.py +++ b/source4/lib/ldb/tests/python/deletetest.py @@ -8,6 +8,7 @@ import os sys.path.append("bin/python") sys.path.append("../lib/subunit/python") +sys.path.append("../lib/testtools") import samba.getopt as options diff --git a/source4/lib/ldb/tests/python/urgent_replication.py b/source4/lib/ldb/tests/python/urgent_replication.py index b8df072..28b3a5f 100755 --- a/source4/lib/ldb/tests/python/urgent_replication.py +++ b/source4/lib/ldb/tests/python/urgent_replication.py @@ -2,16 +2,13 @@ # -*- coding: utf-8 -*- # This is a port of the original in testprogs/ejs/ldap.js -import getopt import optparse import sys -import time -import random -import base64 import os sys.path.append("bin/python") sys.path.append("../lib/subunit/python") +sys.path.append("../lib/testtools") import samba.getopt as options @@ -26,9 +23,6 @@ from samba import glue from subunit.run import SubunitTestRunner import unittest -from samba.ndr import ndr_pack, ndr_unpack -from samba.dcerpc import security - parser = optparse.OptionParser("urgent_replication [options] <host>") sambaopts = options.SambaOptions(parser) parser.add_option_group(sambaopts) diff --git a/source4/script/installmisc.sh b/source4/script/installmisc.sh index eba5996..6a53b98 100755 --- a/source4/script/installmisc.sh +++ b/source4/script/installmisc.sh @@ -82,12 +82,13 @@ cp setup/provision.smb.conf.member $SETUPDIR || exit 1 cp setup/provision.smb.conf.standalone $SETUPDIR || exit 1 echo "Installing external python libraries" -mkdir -p $PYTHONDIR/samba_external || exit 1 +mkdir -p $DESTDIR$PYTHONDIR || exit 1 for p in $($PYTHON scripting/python/samba_external/missing.py); do - echo "Installing missing python library $p" - mkdir -p $PYTHONDIR/samba_external/$p - cp -r ../lib/$p/* $PYTHONDIR/samba_external/$p/ || exit 1 + package=`basename $p` + echo "Installing missing python package $package" + mkdir -p $DESTDIR$PYTHONDIR/$package + cp -r ../lib/$p/* $DESTDIR$PYTHONDIR/$package/ || exit 1 done echo "Installing stuff in $PRIVATEDIR" diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index d36e136..db35669 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -23,9 +23,9 @@ python_glue_OBJ_FILES = $(pyscriptsrcdir)/pyglue.o $(python_glue_OBJ_FILES): CFLAGS+=-I$(ldbsrcdir) -_PY_FILES = $(shell find $(pyscriptsrcdir)/samba ../lib/subunit/python -type f -name "*.py") +_PY_FILES = $(shell find $(pyscriptsrcdir)/samba -type f -name "*.py") -$(eval $(foreach pyfile, $(_PY_FILES),$(call python_py_module_template,$(patsubst $(pyscriptsrcdir)/%,%,$(subst ../lib/subunit/python,,$(pyfile))),$(pyfile)))) +$(eval $(foreach pyfile, $(_PY_FILES),$(call python_py_module_template,$(patsubst $(pyscriptsrcdir)/%,%,$(pyfile)),$(pyfile)))) PYDOCTOR = pydoctor PYDOCTOR_OPTIONS = --project-name Samba --project-url http://www.samba.org/ \ diff --git a/source4/scripting/python/samba_external/missing.py b/source4/scripting/python/samba_external/missing.py index 50bda65..d3dd2b9 100755 --- a/source4/scripting/python/samba_external/missing.py +++ b/source4/scripting/python/samba_external/missing.py @@ -1,12 +1,17 @@ #!/usr/bin/python # work out what python external libraries we need to install +external_libs = { + "dns.resolver": "dnspython/dns", + "subunit": "subunit/python/subunit", + "testtools": "testtools/testtools"} list = [] -try: - import dns.resolver -except: - list.append("dnspython") +for module, package in external_libs.iteritems(): + try: + __import__(module) + except ImportError: + list.append(package) print ' '.join(list) diff --git a/source4/selftest/tests.sh b/source4/selftest/tests.sh index f832b4f..bf6127f 100755 --- a/source4/selftest/tests.sh +++ b/source4/selftest/tests.sh @@ -85,7 +85,7 @@ smb4torture="$samba4bindir/smbtorture${EXEEXT}" if which tap2subunit 2>/dev/null; then TAP2SUBUNIT=tap2subunit else - TAP2SUBUNIT="PYTHONPATH=$samba4srcdir/../lib/subunit/python $PYTHON $samba4srcdir/../lib/subunit/filters/tap2subunit" + TAP2SUBUNIT="PYTHONPATH=$samba4srcdir/../lib/subunit/python:$samba4srcdir/../lib/testtools $PYTHON $samba4srcdir/../lib/subunit/filters/tap2subunit" fi $smb4torture -V @@ -466,15 +466,15 @@ plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:$samba4srcdir/dsdb/samd plantest "subunit.python" none $SUBUNITRUN subunit plantest "rpcecho.python" dc:local $SUBUNITRUN samba.tests.dcerpc.rpcecho plantest "winreg.python" dc:local $SUBUNITRUN -U\$USERNAME%\$PASSWORD samba.tests.dcerpc.registry -plantest "ldap.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN -plantest "urgent_replication.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/urgent_replication.py \$PREFIX_ABS/dc/private/sam.ldb -plantest "ldap_schema.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap_schema.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "ldap.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "urgent_replication.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/urgent_replication.py \$PREFIX_ABS/dc/private/sam.ldb +plantest "ldap_schema.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap_schema.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN plantest "ldap.possibleInferiors.python" dc $PYTHON $samba4srcdir/dsdb/samdb/ldb_modules/tests/possibleinferiors.py $CONFIGURATION ldap://\$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN -plantest "ldap.secdesc.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/sec_descriptor.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN -plantest "ldap.acl.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/acl.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "ldap.secdesc.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/sec_descriptor.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "ldap.acl.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/acl.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN plantest "xattr.python" none $SUBUNITRUN samba.tests.xattr plantest "ntacls.python" none $SUBUNITRUN samba.tests.ntacls -plantest "deletetest.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python" $PYTHON $samba4srcdir/lib/ldb/tests/python/deletetest.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN +plantest "deletetest.python" dc PYTHONPATH="$PYTHONPATH:../lib/subunit/python:../lib/testtools" $PYTHON $samba4srcdir/lib/ldb/tests/python/deletetest.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN plantest "blackbox.samba3dump" none $PYTHON $samba4srcdir/scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 rm -rf $PREFIX/upgrade plantest "blackbox.upgrade" none $PYTHON $samba4srcdir/setup/upgrade_from_s3 $CONFIGURATION --targetdir=$PREFIX/upgrade $samba4srcdir/../testdata/samba3 ../testdata/samba3/smb.conf -- Samba Shared Repository