>From 2d2c57631e230172cef828a967fdd13d479e607f Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 27 Jul 2016 14:09:08 +1200 Subject: [PATCH 1/2] autobuild: remove unused argument The "tasklist" parameter is the same as the global "tasks" variable, but only the latter is used. Signed-off-by: Douglas Bagnall --- script/autobuild.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/autobuild.py b/script/autobuild.py index 419fe1a..b0695d0 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -292,7 +292,7 @@ class builder(object): class buildlist(object): '''handle build of multiple directories''' - def __init__(self, tasklist, tasknames, rebase_url, rebase_branch="master"): + def __init__(self, tasknames, rebase_url, rebase_branch="master"): global tasks self.tlist = [] self.tail_proc = None @@ -718,7 +718,7 @@ while True: 'rebase on %s failed' % options.branch, elapsed_time, log_base=options.log_base) sys.exit(1) - blist = buildlist(tasks, args, options.rebase, rebase_branch=options.branch) + blist = buildlist(args, options.rebase, rebase_branch=options.branch) if options.tail: blist.start_tail() (status, failed_task, failed_stage, failed_tag, errstr) = blist.run() -- 2.7.4 >From 41b5e180ffc0a6895a47bfa18b54a67dc907bbf6 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Wed, 27 Jul 2016 14:28:04 +1200 Subject: [PATCH 2/2] autobuild --restrict-tests to test a restricted set This allows autobuild to be used as a test framework for running particular Samba tests in a cloud environment. Signed-off-by: Douglas Bagnall --- script/autobuild.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/script/autobuild.py b/script/autobuild.py index b0695d0..e6970bb 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -28,6 +28,7 @@ builddirs = { "samba-ctdb" : ".", "samba-libs" : ".", "samba-static" : ".", + "samba-test-only" : ".", "ldb" : "lib/ldb", "tdb" : "lib/tdb", "talloc" : "lib/talloc", @@ -75,6 +76,10 @@ tasks = { ("check-clean-tree", "script/clean-source-tree.sh", "text/plain"), ("clean", "make clean", "text/plain") ], + "samba-test-only" : [ ("configure", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), + ("make", "make -j", "text/plain"), + ("test", "make test FAIL_IMMEDIATELY=1 TESTS=${TESTS}", "text/plain") ], + # Test cross-compile infrastructure "samba-xc" : [ ("configure-native", "./configure.developer --with-selftest-prefix=./bin/ab" + samba_configure_params, "text/plain"), ("configure-cross-execute", "./configure.developer -b ./bin-xe --cross-compile --cross-execute=script/identity_cc.sh" \ @@ -278,6 +283,7 @@ class builder(object): self.cmd = self.cmd.replace("${PREFIX}", "--prefix=%s" % self.prefix) self.cmd = self.cmd.replace("${EXTRA_PYTHON}", "%s" % extra_python) self.cmd = self.cmd.replace("${PREFIX_DIR}", "%s" % self.prefix) + self.cmd = self.cmd.replace("${TESTS}", options.restrict_tests) # 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) @@ -298,7 +304,10 @@ class buildlist(object): self.tail_proc = None self.retry = None if tasknames == []: - tasknames = defaulttasks + if options.restrict_tests: + tasknames = ["samba-test-only"] + else: + tasknames = defaulttasks else: # If we are only running one test, # do not sleep randomly to wait for it to start @@ -555,6 +564,8 @@ parser.add_option("", "--log-base", help="location where the logs can be found ( default=gitroot, type='str') parser.add_option("", "--attach-logs", help="Attach logs to mails sent on success/failure?", default=False, action="store_true") +parser.add_option("", "--restrict-tests", help="run as make test with this TESTS= regex", + default='') def send_email(subject, text, log_tar): outer = MIMEMultipart() @@ -599,6 +610,10 @@ A summary of the autobuild process is here: %s/autobuild.log ''' % (platform.node(), elapsed_minutes, failed_task, errstr, log_base) + if options.restrict_tests: + text += """ +The build was restricted to tests matching %s\n""" % options.restrict_tests + if failed_task != 'rebase': text += ''' You can see logs of the failed task here: @@ -650,6 +665,10 @@ Your autobuild on %s has succeeded after %.1f minutes. ''' % (platform.node(), elapsed_time / 60.) + if options.restrict_tests: + text += """ +The build was restricted to tests matching %s\n""" % options.restrict_tests + if options.keeplogs: text += ''' -- 2.7.4