From 63ee0fd569cbf9777f7d75a227acae6100dec97b Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 18 Jun 2013 05:38:09 +0000 Subject: [PATCH] fix svn up command in run_regression_tests.py and clean in between each revision by default --- tools/run_regression_tests.py | 31 ++++++++++++++++++++++++++++++- tools/run_tests.py | 15 ++++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/tools/run_regression_tests.py b/tools/run_regression_tests.py index 4e775e7af..c601971ff 100644 --- a/tools/run_regression_tests.py +++ b/tools/run_regression_tests.py @@ -1,5 +1,33 @@ #!/bin/python +# Copyright (c) 2013, Arvid Norberg +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the distribution. +# * Neither the name of the author nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + import run_tests import os import time @@ -34,7 +62,7 @@ def svn_fetch(last_rev): return range(last_rev + 1, revision + 1) def svn_up(revision): - os.system('svn up %d' % revision) + os.system('svn up -r %d' % revision) def print_usage(): print '''usage: run_regression_tests.py [options] toolset [toolset...] @@ -46,6 +74,7 @@ between all testsers. options: -j use n parallel processes for running tests + -i build incrementally (i.e. don't clean between checkouts) ''' diff --git a/tools/run_tests.py b/tools/run_tests.py index 66cf40ac2..60519ea88 100755 --- a/tools/run_tests.py +++ b/tools/run_tests.py @@ -78,7 +78,7 @@ def svn_info(): return (revision, author) -def run_tests(toolset, tests, features, options, test_dir, time_limit): +def run_tests(toolset, tests, features, options, test_dir, time_limit, incremental): xml_file = 'bjam_build.%d.xml' % random.randint(0, 100000) results = {} @@ -86,6 +86,11 @@ def run_tests(toolset, tests, features, options, test_dir, time_limit): os.chdir(test_dir) + if not incremental: + p = subprocess.Popen(['bjam', '--abbreviate-paths', toolset, 'clean'] + options + features.split(' '), stdout=subprocess.PIPE) + for l in p.stdout: pass + p.wait() + for t in tests: p = subprocess.Popen(['bjam', '--out-xml=%s' % xml_file, '-l%d' % time_limit, '-q', '--abbreviate-paths', toolset, t] + options + features.split(' '), stdout=subprocess.PIPE) output = '' @@ -145,6 +150,7 @@ def print_usage(): options: -j use n parallel processes -h prints this message and exits +-i build incrementally (i.e. don't clean between checkouts) ''' def main(argv): @@ -152,6 +158,7 @@ def main(argv): toolsets = [] num_processes = 4 + incremental = False for arg in argv: if arg[0] == '-': @@ -160,6 +167,8 @@ def main(argv): elif arg[1] == 'h': print_usage() sys.exit(1) + elif arg[1] == 'i': + incremental = True else: print 'unknown option: %s' % arg print_usage() @@ -250,14 +259,14 @@ def main(argv): futures = [] for features in configs: - futures.append(tester_pool.apply_async(run_tests, [toolset, tests, features, options, test_dir, time_limit])) + futures.append(tester_pool.apply_async(run_tests, [toolset, tests, features, options, test_dir, time_limit, incremental])) for future in futures: (toolset, r) = future.get() results.update(r) # for features in configs: -# (toolset, r) = run_tests(toolset, tests, features, options, test_dir, time_limit) +# (toolset, r) = run_tests(toolset, tests, features, options, test_dir, time_limit, incremental) # results.update(r) print ''