The branch, master has been updated via 9cdebd0 autobuild: Avoid unnecessary chdir() calls. via c4ab2b3 autobuild: Output test results in subunit. via 21475df s3-selftest: fix prefix in subunit output. via f70a986 s3: Add subunit-test target. via 9af570a s3-configure: Require at least version 1.2.6 of external TDB, which has TDB_INCOMPATIBLE_HASH. via e5dfc64 s4: Add 'subunit-test' make target. via 3dfbf3c autobuild: Provide more information about build sequence, stage name and output mime type (all plain text for now). via 7210c95 autobuild: Add --always-email option. from 0866e2d autobuild-remote: Support autobuild.py rather than land.py.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 9cdebd0ebcbf9b890679fa77ce6d8e0127fce28e Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 17:45:47 2010 +0200 autobuild: Avoid unnecessary chdir() calls. commit c4ab2b38af122c7e9173bd5af10f1f9584aa1310 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 14:25:55 2010 +0200 autobuild: Output test results in subunit. commit 21475df35d7f28ab031c6b541e6002c27db07651 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 13:39:28 2010 +0200 s3-selftest: fix prefix in subunit output. commit f70a98605eb620882073483fedf25d6aa4aca74e Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 13:30:01 2010 +0200 s3: Add subunit-test target. commit 9af570a2ef2313c309904ad291a8a0858d61eb68 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 13:17:58 2010 +0200 s3-configure: Require at least version 1.2.6 of external TDB, which has TDB_INCOMPATIBLE_HASH. commit e5dfc64e9c7ef38f77fed1ffc41aad6cf1876766 Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 12:59:40 2010 +0200 s4: Add 'subunit-test' make target. commit 3dfbf3ce036987b14bbbeab3c35b58960a4fa75f Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 12:19:56 2010 +0200 autobuild: Provide more information about build sequence, stage name and output mime type (all plain text for now). commit 7210c95e600a27bbf8a31b50d45214dc372a1ecc Author: Jelmer Vernooij <jel...@samba.org> Date: Fri Oct 1 11:28:48 2010 +0200 autobuild: Add --always-email option. ----------------------------------------------------------------------- Summary of changes: script/autobuild.py | 162 +++++++++++++++++++++++--------------- source3/Makefile.in | 4 + source3/configure.in | 2 +- source3/selftest/s3-selftest.sh | 4 +- source3/selftest/tests.sh | 6 +- source4/Makefile | 3 + 6 files changed, 112 insertions(+), 69 deletions(-) Changeset truncated at 500 lines: diff --git a/script/autobuild.py b/script/autobuild.py index 4063543..be8006c 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -3,8 +3,8 @@ # Copyright Andrew Tridgell 2010 # released under GNU GPL v3 or later -from subprocess import Popen, PIPE -import os, signal, tarfile, sys, time +from subprocess import call, check_call,Popen, PIPE +import os, tarfile, sys, time from optparse import OptionParser import smtplib from email.mime.text import MIMEText @@ -17,45 +17,45 @@ cleanup_list = [] os.putenv('CC', "ccache gcc") tasks = { - "source3" : [ "./autogen.sh", - "./configure.developer ${PREFIX}", - "make basics", - "make -j 4 everything", # don't use too many processes - "make install", - "TDB_NO_FSYNC=1 make test FAIL_IMMEDIATELY=1" ], - - "source4" : [ "./configure.developer ${PREFIX}", - "make -j", - "make install", - "TDB_NO_FSYNC=1 make test FAIL_IMMEDIATELY=1" ], - - "source4/lib/ldb" : [ "./configure --enable-developer -C ${PREFIX}", - "make -j", - "make install", - "make test" ], - - "lib/tdb" : [ "./autogen-waf.sh", - "./configure --enable-developer -C ${PREFIX}", - "make -j", - "make install", - "make test" ], - - "lib/talloc" : [ "./autogen-waf.sh", - "./configure --enable-developer -C ${PREFIX}", - "make -j", - "make install", - "make test" ], - - "lib/replace" : [ "./autogen-waf.sh", - "./configure --enable-developer -C ${PREFIX}", - "make -j", - "make install", - "make test" ], - - "lib/tevent" : [ "./configure --enable-developer -C ${PREFIX}", - "make -j", - "make install", - "make test" ], + "source3" : [ ("autogen", "./autogen.sh", "text/plain"), + ("configure", "./configure.developer ${PREFIX}", "text/plain"), + ("make basics", "make basics", "text/plain"), + ("make", "make -j 4 everything", "text/plain"), # don't use too many processes + ("install", "make install", "text/plain"), + ("test", "TDB_NO_FSYNC=1 make subunit-test FAIL_IMMEDIATELY=1", "text/x-subunit") ], + + "source4" : [ ("configure", "./configure.developer ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "TDB_NO_FSYNC=1 make subunit-test FAIL_IMMEDIATELY=1", "text/x-subunit") ], + + "source4/lib/ldb" : [ ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "make test", "text/plain") ], + + "lib/tdb" : [ ("autogen", "./autogen-waf.sh", "text/plain"), + ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "make test", "text/plain") ], + + "lib/talloc" : [ ("autogen", "./autogen-waf.sh", "text/plain"), + ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "make test", "text/plain"), ], + + "lib/replace" : [ ("autogen", "./autogen-waf.sh", "text/plain"), + ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "make test", "text/plain"), ], + + "lib/tevent" : [ ("configure", "./configure --enable-developer -C ${PREFIX}", "text/plain"), + ("make", "make -j", "text/plain"), + ("install", "make install", "text/plain"), + ("test", "make test", "text/plain"), ], } retry_task = [ '''set -e @@ -71,24 +71,21 @@ retry_task = [ '''set -e ''' % samba_master] def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True): - cwd = os.getcwd() - os.chdir(dir) if show is None: show = options.verbose if show: print("Running: '%s' in '%s'" % (cmd, dir)) if output: - ret = Popen([cmd], shell=True, stdout=PIPE).communicate()[0] - os.chdir(cwd) - return ret - ret = os.system(cmd) - os.chdir(cwd) - if checkfail and ret != 0: - raise Exception("FAILED %s: %d" % (cmd, ret)) - return ret - -class builder: + return Popen([cmd], shell=True, stdout=PIPE, cwd=dir).communicate()[0] + elif checkfail: + return check_call(cmd, shell=True) + else: + return call(cmd, shell=True) + + +class builder(object): '''handle build of one directory''' + def __init__(self, name, sequence): self.name = name @@ -124,8 +121,11 @@ class builder: print '%s: Completed OK' % self.name self.done = True return - self.cmd = self.sequence[self.next].replace("${PREFIX}", "--prefix=%s" % self.prefix) - print '%s: Running %s' % (self.name, self.cmd) + (self.stage, self.cmd, self.output_mime_type) = self.sequence[self.next] + self.cmd = self.cmd.replace("${PREFIX}", "--prefix=%s" % self.prefix) + if self.output_mime_type == "text/x-subunit": + self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit")) + print '%s: [%s] Running %s' % (self.name, self.stage, self.cmd) cwd = os.getcwd() os.chdir("%s/%s" % (self.sdir, self.dir)) self.proc = Popen(self.cmd, shell=True, @@ -134,17 +134,18 @@ class builder: self.next += 1 -class buildlist: +class buildlist(object): '''handle build of multiple directories''' + def __init__(self, tasklist, tasknames): global tasks self.tlist = [] self.tail_proc = None self.retry = None if tasknames == ['pass']: - tasks = { 'pass' : [ '/bin/true' ]} + tasks = { 'pass' : [ ("pass", '/bin/true', "text/plain") ]} if tasknames == ['fail']: - tasks = { 'fail' : [ '/bin/false' ]} + tasks = { 'fail' : [ ("fail", '/bin/false', "text/plain") ]} if tasknames == []: tasknames = tasklist for n in tasknames: @@ -203,10 +204,10 @@ class buildlist: break if os.WIFSIGNALED(b.status) or os.WEXITSTATUS(b.status) != 0: self.kill_kids() - return (b.status, b.name, b.tag, "%s: failed '%s' with status %d" % (b.name, b.cmd, b.status)) + return (b.status, b.name, b.stage, b.tag, "%s: [%s] failed '%s' with status %d" % (b.name, b.stage, b.cmd, b.status)) b.start_next() self.kill_kids() - return (0, None, None, "All OK") + return (0, None, None, None, "All OK") def tarlogs(self, fname): tar = tarfile.open(fname, "w:gz") @@ -319,11 +320,13 @@ parser.add_option("", "--retry", help="automatically retry if master changes", default=False, action="store_true") parser.add_option("", "--email", help="send email to the given address on failure", type='str', default=None) +parser.add_option("", "--always-email", help="always send email, even on success", + action="store_true") parser.add_option("", "--daemon", help="daemonize after initial setup", action="store_true") -def email_failure(status, failed_task, failed_tag, errstr): +def email_failure(status, failed_task, failed_stage, failed_tag, errstr): '''send an email to options.email about the failure''' user = os.getenv("USER") text = ''' @@ -345,7 +348,35 @@ or you can get full logs of all tasks in this job here: ''' % (failed_task, errstr, user, failed_tag, user, failed_tag, user) msg = MIMEText(text) - msg['Subject'] = 'autobuild failure for task %s' % failed_task + msg['Subject'] = 'autobuild failure for task %s during %s' % (failed_task, failed_stage) + msg['From'] = 'autobu...@samba.org' + msg['To'] = options.email + + s = smtplib.SMTP() + s.connect() + s.sendmail(msg['From'], [msg['To']], msg.as_string()) + s.quit() + +def email_success(): + '''send an email to options.email about a successful build''' + user = os.getenv("USER") + text = ''' +Dear Developer, + +Your autobuild has succeeded. + +''' + + if options.keeplogs: + text += ''' + +you can get full logs of all tasks in this job here: + + http://git.samba.org/%s/samba-autobuild/logs.tar.gz + +''' % (user,) + msg = MIMEText(text) + msg['Subject'] = 'autobuild success' msg['From'] = 'autobu...@samba.org' msg['To'] = options.email @@ -354,6 +385,7 @@ or you can get full logs of all tasks in this job here: s.sendmail(msg['From'], [msg['To']], msg.as_string()) s.quit() + (options, args) = parser.parse_args() if options.retry: @@ -395,7 +427,7 @@ while True: blist = buildlist(tasks, args) if options.tail: blist.start_tail() - (status, failed_task, failed_tag, errstr) = blist.run() + (status, failed_task, failed_stage, failed_tag, errstr) = blist.run() if status != 0 or errstr != "retry": break cleanup() @@ -420,6 +452,8 @@ if status == 0: if options.keeplogs: blist.tarlogs("logs.tar.gz") print("Logs in logs.tar.gz") + if options.always_email: + email_success() blist.remove_logs() cleanup() print(errstr) @@ -429,7 +463,7 @@ if status == 0: blist.tarlogs("logs.tar.gz") if options.email is not None: - email_failure(status, failed_task, failed_tag, errstr) + email_failure(status, failed_task, failed_stage, failed_tag, errstr) cleanup() print(errstr) diff --git a/source3/Makefile.in b/source3/Makefile.in index 79e394a..8a0364d 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -3400,6 +3400,7 @@ test:: all torture timelimit SELFTESTDIR="$(selftestdir)" SELFTESTPREFIX="$(selftest_prefix)" \ SOURCEDIR="$(srcdir)" \ RUN_FROM_BUILD_FARM="$(RUN_FROM_BUILD_FARM)" \ + SUBUNIT_FORMATTER="$(SUBUNIT_FORMATTER)" \ PERL="$(PERL)" PYTHON="$(PYTHON)" \ $(srcdir)/selftest/s3-selftest.sh @@ -3409,6 +3410,9 @@ test-%: buildfarm-test: $(MAKE) test RUN_FROM_BUILD_FARM=yes +subunit-test: + $(MAKE) test SUBUNIT_FORMATTER=cat + SELFTEST_TESTENV = dc testenv: diff --git a/source3/configure.in b/source3/configure.in index 9868dc0..630c854 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -2122,7 +2122,7 @@ AC_ARG_ENABLE(external_libtdb, if test "x$enable_external_libtdb" != xno then - PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.2, + PKG_CHECK_MODULES(LIBTDB, tdb >= 1.2.6, [ enable_external_libtdb=yes ], [ if test x$enable_external_libtdb = xyes; then diff --git a/source3/selftest/s3-selftest.sh b/source3/selftest/s3-selftest.sh index 86e4b75..6105ff4 100755 --- a/source3/selftest/s3-selftest.sh +++ b/source3/selftest/s3-selftest.sh @@ -1,7 +1,9 @@ #!/bin/sh FILTER_XFAIL="${PYTHON} -u ${SELFTESTDIR}/filter-subunit --expected-failures=${SOURCEDIR}/selftest/knownfail" -SUBUNIT_FORMATTER="${PYTHON} -u ${SELFTESTDIR}/format-subunit --prefix=${SELFTESTPREFIX} --immediate" +if [ "x${SUBUNIT_FORMATTER}" = x"" ]; then + SUBUNIT_FORMATTER="${PYTHON} -u ${SELFTESTDIR}/format-subunit --prefix=${SELFTESTPREFIX} --immediate" +fi cleanup_and_exit() { if test "$1" = 0 -o -z "$1"; then diff --git a/source3/selftest/tests.sh b/source3/selftest/tests.sh index 39c1a26..4233cfb 100755 --- a/source3/selftest/tests.sh +++ b/source3/selftest/tests.sh @@ -30,11 +30,11 @@ plantest() { cmdline="$*" echo "-- TEST --" if [ "$env" = "none" ]; then - fulltest="samba3.$name" + fullname="samba3.$name" else - fulltest="samba3.$name ($env)" + fullname="samba3.$name ($env)" fi - echo $fulltest + echo $fullname echo $env echo $cmdline "2>&1" "| ../selftest/filter-subunit --prefix \"$fullname.\"" } diff --git a/source4/Makefile b/source4/Makefile index b490240..e1e53cd 100644 --- a/source4/Makefile +++ b/source4/Makefile @@ -14,6 +14,9 @@ uninstall: test: $(WAF) test $(TEST_OPTIONS) +subunit-test: + $(WAF) test --filtered-subunit $(TEST_OPTIONS) + testenv: $(WAF) test --testenv $(TEST_OPTIONS) -- Samba Shared Repository