diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index 01b640639..46e2c0ad7 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -157,26 +157,6 @@ def glob_remove(sequence, pattern): sequence.remove(r) -# -# FIXME: this is copy-pasted from TestSCons.py -# Should be moved to TestCmd.py? -# -if os.name == 'posix': - def _failed(self, status=0): - if self.status is None: - return None - return _status(self) != status - def _status(self): - if os.WIFEXITED(self.status): - return os.WEXITSTATUS(self.status) - return -1 -elif os.name == 'nt': - def _failed(self, status=0): - return not self.status is None and self.status != status - def _status(self): - return self.status - - class Tester(TestCmd.TestCmd): """Main tester class for Boost Build. @@ -222,11 +202,12 @@ class Tester(TestCmd.TestCmd): system output like the --verbose command line option does. """ - def __init__(self, arguments="", executable="bjam", + def __init__(self, arguments=None, executable="bjam", match=TestCmd.match_exact, boost_build_path=None, translate_suffixes=True, pass_toolset=True, use_test_config=True, ignore_toolset_requirements=True, workdir="", pass_d0=True, **keywords): + assert arguments.__class__ is not str self.original_workdir = os.getcwd() if workdir and not os.path.isabs(workdir): raise ("Parameter workdir <%s> must point to an absolute " @@ -315,7 +296,7 @@ class Tester(TestCmd.TestCmd): if verbosity: program_list += verbosity if arguments: - program_list += arguments.split(" ") + program_list += arguments TestCmd.TestCmd.__init__(self, program=program_list, match=match, workdir=workdir, inpath=use_default_bjam, **keywords) @@ -439,11 +420,12 @@ class Tester(TestCmd.TestCmd): # # FIXME: Large portion copied from TestSCons.py, should be moved? # - def run_build_system(self, extra_args="", subdir="", stdout=None, + def run_build_system(self, extra_args=None, subdir="", stdout=None, stderr="", status=0, match=None, pass_toolset=None, use_test_config=None, ignore_toolset_requirements=None, expected_duration=None, **kw): + assert extra_args.__class__ is not str build_time_start = time.time() try: @@ -470,7 +452,7 @@ class Tester(TestCmd.TestCmd): kw['program'] = [] kw['program'] += self.program if extra_args: - kw['program'] += extra_args.split(" ") + kw['program'] += extra_args if pass_toolset: kw['program'].append("toolset=" + self.toolset) if use_test_config: @@ -490,13 +472,13 @@ class Tester(TestCmd.TestCmd): old_last_build_time_finish = self.last_build_time_finish self.last_build_time_finish = time.time() - if status is not None and _failed(self, status): + if (status and self.status) is not None and self.status != status: expect = '' if status != 0: expect = " (expected %d)" % status annotation("failure", '"%s" returned %d%s' % (kw['program'], - _status(self), expect)) + self.status, expect)) annotation("reason", "unexpected status returned by bjam") self.fail_test(1) diff --git a/v2/test/TestCmd.py b/v2/test/TestCmd.py index 76e62f556..7b11996d9 100644 --- a/v2/test/TestCmd.py +++ b/v2/test/TestCmd.py @@ -58,10 +58,10 @@ from types import * import os import os.path -import popen2 import re import shutil import stat +import subprocess import sys import tempfile import traceback @@ -374,20 +374,26 @@ class TestCmd: raise ValueError, "mode must begin with 'r'" return open(file, mode).read() - def run(self, program=None, arguments=None, chdir=None, stdin=None): + def run(self, program=None, arguments=None, chdir=None, stdin=None, + universal_newlines=True): """ Runs a test of the program or script for the test environment. Standard output and error output are saved for future retrieval via the stdout() and stderr() methods. + 'universal_newlines' parameter controls how the child process + input/output streams are opened as defined for the same named Python + subprocess.POpen constructor parameter. + """ if chdir: - oldcwd = os.getcwd() if not os.path.isabs(chdir): chdir = os.path.join(self.workpath(chdir)) if self.verbose: sys.stderr.write("chdir(" + chdir + ")\n") - os.chdir(chdir) + else: + chdir = self.workdir + cmd = [] if program and program[0]: if program[0] != self.program[0] and not os.path.isabs(program[0]): @@ -400,86 +406,9 @@ class TestCmd: if self.verbose: sys.stderr.write(join(cmd, " ") + "\n") try: - p = popen2.Popen3(cmd, 1) - except AttributeError: - # We end up here in case the popen2.Popen3 class is not available - # (e.g. on Windows). We will be using the os.popen3() Python API - # which takes a string parameter and so needs its executable quoted - # in case its name contains spaces. - for i in xrange(len(cmd)): - if not cmd[i] or '"' in cmd[i]: - pass - elif cmd[i][-1] == '\\': - cmd[i] = '"' + cmd[i] + '\\"' - else: - cmd[i] = '"' + cmd[i] + '"' - command_string = join(cmd, " ") - if ( os.name == 'nt' ): - # This is a workaround for a longstanding Python bug on Windows - # when using os.popen(), os.system() and similar functions to - # execute a command containing quote characters. The bug seems - # to be related to the quote stripping functionality used by - # the Windows cmd.exe interpreter when its /S is not specified. - # - # Cleaned up quote from the cmd.exe help screen as displayed on - # Windows XP SP2: - # - # 1. If all of the following conditions are met, then quote - # characters on the command line are preserved: - # - # - no /S switch - # - exactly two quote characters - # - no special characters between the two quote - # characters, where special is one of: &<>()@^| - # - there are one or more whitespace characters between - # the two quote characters - # - the string between the two quote characters is the - # name of an executable file. - # - # 2. Otherwise, old behavior is to see if the first character - # is a quote character and if so, strip the leading - # character and remove the last quote character on the - # command line, preserving any text after the last quote - # character. - # - # This causes some commands containing quotes not to be - # executed correctly. For example: - # - # "\Long folder name\aaa.exe" --name="Foo" --no-surname - # - # would get its outermost quotes stripped and would be executed - # as: - # - # \Long folder name\aaa.exe" --name="Foo --no-surname - # - # which would report an error about '\Long' not being a valid - # command. - # - # cmd.exe help seems to indicate it would be enough to add an - # extra space character in front of the command to avoid this - # but this does not work, most likely due to the shell first - # stripping all leading whitespace characters from the command. - # - # Solution implemented here is to quote the whole command in - # case it contains any quote characters. Note thought this will - # not work correctly should Python ever fix this bug. - # (01.05.2008.) (Jurko) - if command_string.find('"') != -1: - command_string = '"%s"' % command_string - tochild, fromchild, childerr = os.popen3(command_string) - if stdin: - if type(stdin) is ListType: - for line in stdin: - tochild.write(line) - else: - tochild.write(stdin) - tochild.close() - self._stdout.append(fromchild.read()) - self._stderr.append(childerr.read()) - fromchild.close() - self.status = childerr.close() - if not self.status: - self.status = 0 + p = subprocess.Popen(cmd, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=chdir, + universal_newlines=universal_newlines) except: raise else: @@ -489,18 +418,15 @@ class TestCmd: p.tochild.write(line) else: p.tochild.write(stdin) - p.tochild.close() - self._stdout.append(p.fromchild.read()) - self._stderr.append(p.childerr.read()) - self.status = p.wait() + out, err = p.communicate() + self._stdout.append(out) + self._stderr.append(err) + self.status = p.returncode if self.verbose: sys.stdout.write(self._stdout[-1]) sys.stderr.write(self._stderr[-1]) - if chdir: - os.chdir(oldcwd) - def stderr(self, run=None): """ Returns the error output from the specified run number. If there is diff --git a/v2/test/alias.py b/v2/test/alias.py index 413982751..b996b4d09 100644 --- a/v2/test/alias.py +++ b/v2/test/alias.py @@ -37,12 +37,12 @@ exe hello : hello.cpp src ; t.write("s.cpp", "") # Check that targets to which "bin1" refers are updated, and only those. - t.run_build_system("bin1") + t.run_build_system(["bin1"]) t.expect_addition(BoostBuild.List("bin/$toolset/debug/") * "a.exe a.obj") t.expect_nothing_more() # Try again with "bin2" - t.run_build_system("bin2") + t.run_build_system(["bin2"]) t.expect_addition(BoostBuild.List("bin/$toolset/debug/") * "b.exe b.obj") t.expect_nothing_more() diff --git a/v2/test/alternatives.py b/v2/test/alternatives.py index f63d69954..d035a9dfd 100644 --- a/v2/test/alternatives.py +++ b/v2/test/alternatives.py @@ -24,7 +24,7 @@ t.write("a_empty.cpp", "") t.write("a.cpp", "int main() {}\n") -t.run_build_system("release") +t.run_build_system(["release"]) t.expect_addition("bin/$toolset/release/a.exe") @@ -45,7 +45,7 @@ t.rm("bin") t.run_build_system() t.expect_addition("bin/$toolset/debug/b.obj") -t.run_build_system("X=on") +t.run_build_system(["X=on"]) t.expect_addition("bin/$toolset/debug/X-on/a.obj") t.rm("bin") @@ -67,7 +67,7 @@ exe a : a_empty.cpp : debug ; exe a : a.cpp : release ; """) -t.run_build_system("release") +t.run_build_system(["release"]) t.expect_addition("bin/$toolset/release/a.exe") # Test that free properties do not matter. We really do not want @@ -78,7 +78,7 @@ exe a : a.cpp : release ; """) t.rm("bin/$toolset/release/a.exe") -t.run_build_system("release define=FOO") +t.run_build_system(["release", "define=FOO"]) t.expect_addition("bin/$toolset/release/a.exe") # Test that ambiguity is reported correctly. @@ -86,7 +86,7 @@ t.write("jamfile.jam", """\ exe a : a_empty.cpp ; exe a : a.cpp ; """) -t.run_build_system("--no-error-backtrace", status=None) +t.run_build_system(["--no-error-backtrace"], status=None) t.fail_test(string.find(t.stdout(), "No best alternative") == -1) # Another ambiguity test: two matches properties in one alternative are neither @@ -96,7 +96,7 @@ exe a : a_empty.cpp : off off ; exe a : a.cpp : on ; """) -t.run_build_system("--no-error-backtrace", status=None) +t.run_build_system(["--no-error-backtrace"], status=None) t.fail_test(string.find(t.stdout(), "No best alternative") == -1) # Test that we can have alternative without sources. diff --git a/v2/test/build_dir.py b/v2/test/build_dir.py index 076fa1f8b..2a06ca4b9 100644 --- a/v2/test/build_dir.py +++ b/v2/test/build_dir.py @@ -59,7 +59,7 @@ t.rm(".") t.write("jamroot.jam", "") # Test that we get an error when no project id is specified. -t.run_build_system("--build-dir=foo") +t.run_build_system(["--build-dir=foo"]) t.fail_test(string.find(t.stdout(), "warning: the --build-dir option will be ignored") == -1) @@ -72,7 +72,7 @@ t.write("a.cpp", "int main() {}\n") t.write("sub/jamfile.jam", "exe b : b.cpp ;\n") t.write("sub/b.cpp", "int main() {}\n") -t.run_build_system("--build-dir=build") +t.run_build_system(["--build-dir=build"]) t.expect_addition(["build/foo/$toolset/debug/a.exe", "build/foo/sub/$toolset/debug/b.exe"]) @@ -82,7 +82,7 @@ exe a : a.cpp ; build-project sub ; """) -t.run_build_system("--build-dir=build") +t.run_build_system(["--build-dir=build"]) t.expect_addition(["build/foo/bin.v2/$toolset/debug/a.exe", "build/foo/bin.v2/sub/$toolset/debug/b.exe"]) @@ -90,7 +90,7 @@ t.expect_addition(["build/foo/bin.v2/$toolset/debug/a.exe", # 'sub/build'. Today, I am not sure if this is what the user expects, but let # it be. t.rm('build') -t.run_build_system("--build-dir=build", subdir="sub") +t.run_build_system(["--build-dir=build"], subdir="sub") t.expect_addition(["sub/build/foo/bin.v2/sub/$toolset/debug/b.exe"]) t.write("jamroot.jam", """\ @@ -99,7 +99,7 @@ exe a : a.cpp ; build-project sub ; """ % string.replace(os.getcwd(), '\\', '\\\\')) -t.run_build_system("--build-dir=build", status=1) +t.run_build_system(["--build-dir=build"], status=1) t.fail_test(string.find(t.stdout(), "Absolute directory specified via 'build-dir' project attribute") == -1) diff --git a/v2/test/build_file.py b/v2/test/build_file.py index bc8b4f075..bb72e28f9 100644 --- a/v2/test/build_file.py +++ b/v2/test/build_file.py @@ -35,7 +35,7 @@ exe sub : hello.cpp ; """) t.write("sub/hello.cpp", "int main() {}\n") - t.run_build_system("sub " + t.adjust_suffix("hello.obj")) + t.run_build_system(["sub", t.adjust_suffix("hello.obj")]) t.expect_output_line("*depends on itself*", False) t.expect_addition("sub/bin/$toolset/debug/hello.obj") t.expect_nothing_more() @@ -62,7 +62,7 @@ exe hello3 : hello3.cpp ; t.write("hello2.cpp", "int main() {}\n") t.write("hello3.cpp", "int main() {}\n") - t.run_build_system("hello1 " + t.adjust_suffix("hello1.obj")) + t.run_build_system(["hello1", t.adjust_suffix("hello1.obj")]) t.expect_addition("bin/$toolset/debug/hello1.obj") t.expect_nothing_more() @@ -89,7 +89,7 @@ exe hello3 : hello3.cpp ; t.write("hello3.cpp", "int main() {}\n") obj = t.adjust_suffix("hello2.obj") - t.run_build_system("hello1 " + obj, status=1) + t.run_build_system(["hello1", obj], status=1) t.expect_output_line("don't know how to make*" + obj) t.expect_nothing_more() @@ -115,8 +115,8 @@ exe hello3 : hello3.cpp ; t.write("hello2.cpp", "int main() {}\n") t.write("hello3.cpp", "int main() {}\n") - t.run_build_system(t.adjust_suffix("hello1.obj") + " " + t.adjust_suffix( - "hello2.obj")) + t.run_build_system([t.adjust_suffix("hello1.obj"), t.adjust_suffix( + "hello2.obj")]) t.expect_addition("bin/$toolset/debug/hello1.obj") t.expect_addition("bin/$toolset/debug/hello2.obj") t.expect_nothing_more() @@ -147,7 +147,7 @@ exe sub : hello.cpp ; """) t.write("sub/hello.cpp", "int main() {}\n") - t.run_build_system(t.adjust_suffix("hello.obj")) + t.run_build_system([t.adjust_suffix("hello.obj")]) t.expect_output_line("*depends on itself*", False) t.expect_addition("bin/$toolset/debug/hello.obj") t.expect_addition("sub/bin/$toolset/debug/hello.obj") diff --git a/v2/test/build_no.py b/v2/test/build_no.py index d69a8422a..76675de63 100644 --- a/v2/test/build_no.py +++ b/v2/test/build_no.py @@ -17,7 +17,7 @@ t.write("hello.cpp", "int main() {}\n") t.run_build_system() t.expect_nothing_more() -t.run_build_system("release") +t.run_build_system(["release"]) t.expect_addition("bin/$toolset/release/hello.exe") t.cleanup() diff --git a/v2/test/builtin_echo.py b/v2/test/builtin_echo.py index b2364bd4a..309236173 100755 --- a/v2/test/builtin_echo.py +++ b/v2/test/builtin_echo.py @@ -9,7 +9,7 @@ import BoostBuild def test_echo(name): - t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) + t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", """\ %s ; diff --git a/v2/test/builtin_exit.py b/v2/test/builtin_exit.py index 0b0f1b0ae..1db869366 100755 --- a/v2/test/builtin_exit.py +++ b/v2/test/builtin_exit.py @@ -9,7 +9,7 @@ import BoostBuild def test_exit(name): - t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) + t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", "%s ;" % name) t.run_build_system(status=1, stdout="\n") diff --git a/v2/test/builtin_split_by_characters.py b/v2/test/builtin_split_by_characters.py index aa53a1a10..fd87d024b 100755 --- a/v2/test/builtin_split_by_characters.py +++ b/v2/test/builtin_split_by_characters.py @@ -11,7 +11,7 @@ import BoostBuild def test_invalid(params, expected_error_line): t = BoostBuild.Tester(pass_toolset=0) t.write("file.jam", "SPLIT_BY_CHARACTERS %s ;" % params) - t.run_build_system("-ffile.jam", status=1) + t.run_build_system(["-ffile.jam"], status=1) t.expect_output_line("[*] %s" % expected_error_line) t.cleanup() diff --git a/v2/test/clean.py b/v2/test/clean.py index 35f52405c..bf157c00f 100644 --- a/v2/test/clean.py +++ b/v2/test/clean.py @@ -48,7 +48,7 @@ void sub3() {} # 'clean' should not remove files under separate jamroot.jam. t.run_build_system() -t.run_build_system("--clean") +t.run_build_system(["--clean"]) t.expect_removal("bin/$toolset/debug/a.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj") @@ -57,7 +57,7 @@ t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj") # 'clean-all' removes everything it can reach. t.run_build_system() -t.run_build_system("--clean-all") +t.run_build_system(["--clean-all"]) t.expect_removal("bin/$toolset/debug/a.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj") @@ -66,7 +66,7 @@ t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj") # 'clean' together with project target removes only under that project. t.run_build_system() -t.run_build_system("sub1 --clean") +t.run_build_system(["sub1", "--clean"]) t.expect_nothing("bin/$toolset/debug/a.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj") @@ -75,7 +75,7 @@ t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj") # 'clean-all' removes everything. t.run_build_system() -t.run_build_system("sub1 --clean-all") +t.run_build_system(["sub1", "--clean-all"]) t.expect_nothing("bin/$toolset/debug/a.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1.obj") t.expect_removal("sub1/bin/$toolset/debug/sub1_2.obj") @@ -85,7 +85,7 @@ t.expect_nothing("sub3/bin/$toolset/debug/sub3.obj") # If main target is explicitly named, we should not remove files from other # targets. t.run_build_system() -t.run_build_system("sub1//sub1 --clean") +t.run_build_system(["sub1//sub1", "--clean"]) t.expect_removal("sub1/bin/$toolset/debug/sub1.obj") t.expect_nothing("sub1/bin/$toolset/debug/sub1_2.obj") t.expect_nothing("sub2/bin/$toolset/debug/sub2.obj") @@ -98,7 +98,7 @@ import cast ; cast a cpp : a.h ; """) t.write("a.h", "") -t.run_build_system("--clean") +t.run_build_system(["--clean"]) t.expect_nothing("a.h") t.cleanup() diff --git a/v2/test/collect_debug_info.py b/v2/test/collect_debug_info.py index f6be2aa03..e2421e1ef 100755 --- a/v2/test/collect_debug_info.py +++ b/v2/test/collect_debug_info.py @@ -223,7 +223,7 @@ def _collectDebugInfo_environ(t): def _getExternalValues(t, *args): - t.run_build_system(" ".join("---var-name=%s" % x for x in args)) + t.run_build_system(["---var-name=%s" % x for x in args]) result = dict() for x in args: m = re.search(r"^\*\*\*ENV\*\*\* %s: '(.*)' \*\*\*$" % x, t.stdout(), @@ -239,7 +239,7 @@ def _getJamVersionInfo(t): result = [] # JAM version variables. - t.run_build_system("---version") + t.run_build_system(["---version"]) for m in re.finditer(r"^\*\*\*VAR\*\*\* ([^:]*): (.*)\*\*\*$", t.stdout(), re.MULTILINE): name = m.group(1) @@ -254,12 +254,12 @@ def _getJamVersionInfo(t): result.append("") # bjam -v output. - t.run_build_system("-v") + t.run_build_system(["-v"]) result.append("--- output for 'bjam -v' ---") result.append(t.stdout()) # bjam --version output. - t.run_build_system("--version", status=1) + t.run_build_system(["--version"], status=1) result.append("--- output for 'bjam --version' ---") result.append(t.stdout()) @@ -269,7 +269,7 @@ def _getJamVersionInfo(t): def _init(): toolsetName = "__myDummyToolset__" - t = BoostBuild.Tester("toolset=%s" % toolsetName, pass_toolset=False, + t = BoostBuild.Tester(["toolset=%s" % toolsetName], pass_toolset=False, use_test_config=False) # Prepare a dummy toolset so we do not get errors in case the default one diff --git a/v2/test/conditionals.py b/v2/test/conditionals.py index 67e333be2..7cc16abba 100644 --- a/v2/test/conditionals.py +++ b/v2/test/conditionals.py @@ -21,7 +21,7 @@ int main() {} # Test conditionals in target requirements. t.write("jamroot.jam", "exe a : a.cpp : static:STATIC ;") -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/a.exe") t.rm("bin") @@ -30,7 +30,7 @@ t.write("jamroot.jam", """ project : requirements static:STATIC ; exe a : a.cpp ; """) -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/a.exe") t.rm("bin") @@ -41,7 +41,7 @@ lib l : l.cpp : : : static:STATIC ; exe a : a.cpp l ; """) t.write("l.cpp", "int i;") -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/a.exe") t.cleanup() diff --git a/v2/test/conditionals_multiple.py b/v2/test/conditionals_multiple.py index baf446950..873ad869b 100755 --- a/v2/test/conditionals_multiple.py +++ b/v2/test/conditionals_multiple.py @@ -20,8 +20,8 @@ import BoostBuild def test_multiple_conditions(): """Basic tests for properties conditioned on multiple other properties.""" - t = BoostBuild.Tester("--user-config= --ignore-site-config " - "toolset=testToolset", pass_toolset=False, use_test_config=False) + t = BoostBuild.Tester(["--user-config=", "--ignore-site-config", + "toolset=testToolset"], pass_toolset=False, use_test_config=False) t.write("testToolset.jam", """\ import feature ; @@ -69,7 +69,7 @@ notfile testTarget1 : @buildRule : : 1,1,1:a1-b1-c1 ; """) - t.run_build_system("aaa=1 bbb=1 ccc=1") + t.run_build_system(["aaa=1", "bbb=1", "ccc=1"]) t.expect_output_line("description: /d/" ) t.expect_output_line("description: /a0/" , False) t.expect_output_line("description: /a1/" ) @@ -84,7 +84,7 @@ notfile testTarget1 : @buildRule : : t.expect_output_line("description: /a1-b1-c0/", False) t.expect_output_line("description: /a1-b1-c1/" ) - t.run_build_system("aaa=0 bbb=0 ccc=1") + t.run_build_system(["aaa=0", "bbb=0", "ccc=1"]) t.expect_output_line("description: /d/" ) t.expect_output_line("description: /a0/" ) t.expect_output_line("description: /a1/" , False) @@ -99,7 +99,7 @@ notfile testTarget1 : @buildRule : : t.expect_output_line("description: /a1-b1-c0/", False) t.expect_output_line("description: /a1-b1-c1/", False) - t.run_build_system("aaa=0 bbb=0 ccc=0") + t.run_build_system(["aaa=0", "bbb=0", "ccc=0"]) t.expect_output_line("description: /d/" ) t.expect_output_line("description: /a0/" ) t.expect_output_line("description: /a1/" , False) @@ -132,7 +132,7 @@ def test_multiple_conditions_with_toolset_version(): """ toolset = "testToolset" ; - t = BoostBuild.Tester("--user-config= --ignore-site-config", + t = BoostBuild.Tester(["--user-config=", "--ignore-site-config"], pass_toolset=False, use_test_config=False) t.write(toolset + ".jam", """\ @@ -221,7 +221,7 @@ notfile testTarget1 : @buildRule : : 1,1,testToolset-1:b1-a1-t1 ; """) - t.run_build_system("aaa=1 bbb=1 ccc=1 toolset=%s-0" % toolset) + t.run_build_system(["aaa=1", "bbb=1", "ccc=1", "toolset=%s-0" % toolset]) t.expect_output_line("description: /t-a0/" , False) t.expect_output_line("description: /t-a1/" ) t.expect_output_line("description: /t0-a0/" , False) @@ -259,7 +259,7 @@ notfile testTarget1 : @buildRule : : t.expect_output_line("description: /b1-a1-t0/" ) t.expect_output_line("description: /b1-a1-t1/", False) - t.run_build_system("aaa=1 bbb=1 ccc=1 toolset=%s-1" % toolset) + t.run_build_system(["aaa=1", "bbb=1", "ccc=1", "toolset=%s-1" % toolset]) t.expect_output_line("description: /t-a0/" , False) t.expect_output_line("description: /t-a1/" ) t.expect_output_line("description: /t0-a0/" , False) diff --git a/v2/test/configuration.py b/v2/test/configuration.py index d045be17c..994dc63ac 100755 --- a/v2/test/configuration.py +++ b/v2/test/configuration.py @@ -36,8 +36,8 @@ def test_user_configuration(): configFileNames = ["ups_lala_1.jam", "ups_lala_2.jam", os.path.join(subdirName, "ups_lala_3.jam")] - t = BoostBuild.Tester("toolset=%s --debug-configuration" % toolsetName, - pass_toolset=False, use_test_config=False) + t = BoostBuild.Tester(["toolset=%s" % toolsetName, + "--debug-configuration"], pass_toolset=False, use_test_config=False) for configFileName in configFileNames: message = "ECHO \"%s\" ;" % testMessage % configFileName @@ -75,12 +75,14 @@ ECHO test-index: $(test-index:E=(unknown)) ; "- %s" % message) self.__tester.fail_test(1) - def __call__(self, test_id, env, extra_args="", *args, **kwargs): + def __call__(self, test_id, env, extra_args=None, *args, **kwargs): if env == "" and not canSetEmptyEnvironmentVariable: self.__assertionFailure("Can not set empty environment " "variables on this platform.") self.__registerTestId(str(test_id)) - extra_args += " ---test-id---=%s" % test_id + if extra_args is None: + extra_args = [] + extra_args.append("---test-id---=%s" % test_id) env_name = "BOOST_BUILD_USER_CONFIG" previous_env = os.environ.get(env_name) _env_set(env_name, env) @@ -104,7 +106,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(2, None, "--user-config=") + test(2, None, ["--user-config="]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage, False) t.expect_output_line(disabledConfigLoadMessage) @@ -112,7 +114,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(3, None, '--user-config=""') + test(3, None, ['--user-config=""']) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage, False) t.expect_output_line(disabledConfigLoadMessage) @@ -120,7 +122,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(4, None, '--user-config="%s"' % configFileNames[0]) + test(4, None, ['--user-config="%s"' % configFileNames[0]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -128,7 +130,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(5, None, '--user-config="%s"' % configFileNames[2]) + test(5, None, ['--user-config="%s"' % configFileNames[2]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -136,7 +138,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2]) - test(6, None, '--user-config="%s"' % os.path.abspath(configFileNames[1])) + test(6, None, ['--user-config="%s"' % os.path.abspath(configFileNames[1])]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -144,7 +146,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1]) t.expect_output_line(testMessage % configFileNames[2], False) - test(7, None, '--user-config="%s"' % os.path.abspath(configFileNames[2])) + test(7, None, ['--user-config="%s"' % os.path.abspath(configFileNames[2])]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -177,7 +179,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1]) t.expect_output_line(testMessage % configFileNames[2], False) - test(11, configFileNames[1], '--user-config=""') + test(11, configFileNames[1], ['--user-config=""']) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage, False) t.expect_output_line(disabledConfigLoadMessage) @@ -185,7 +187,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(12, configFileNames[1], '--user-config="%s"' % configFileNames[0]) + test(12, configFileNames[1], ['--user-config="%s"' % configFileNames[0]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -194,7 +196,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[2], False) if canSetEmptyEnvironmentVariable: - test(13, "", '--user-config="%s"' % configFileNames[0]) + test(13, "", ['--user-config="%s"' % configFileNames[0]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -202,7 +204,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(14, '""', '--user-config="%s"' % configFileNames[0]) + test(14, '""', ['--user-config="%s"' % configFileNames[0]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -210,7 +212,7 @@ ECHO test-index: $(test-index:E=(unknown)) ; t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - test(15, "invalid", '--user-config="%s"' % configFileNames[0]) + test(15, "invalid", ['--user-config="%s"' % configFileNames[0]]) t.expect_output_line(implicitConfigLoadMessage, False) t.expect_output_line(explicitConfigLoadMessage) t.expect_output_line(disabledConfigLoadMessage, False) @@ -274,7 +276,7 @@ def _env_set(name, value): def _getExternalEnv(name): toolsetName = "__myDummyToolset__" - t = BoostBuild.Tester("toolset=%s" % toolsetName, pass_toolset=False, + t = BoostBuild.Tester(["toolset=%s" % toolsetName], pass_toolset=False, use_test_config=False) try: # Prepare a dummy toolset so we do not get errors in case the default @@ -302,7 +304,7 @@ for x in $(names) } """) - t.run_build_system("---var-name---=%s" % name) + t.run_build_system(["---var-name---=%s" % name]) m = re.search("^### %s: '(.*)' ###$" % name, t.stdout(), re.MULTILINE) if m: return m.group(1) diff --git a/v2/test/copy_time.py b/v2/test/copy_time.py index 14947aad2..7996c5288 100755 --- a/v2/test/copy_time.py +++ b/v2/test/copy_time.py @@ -62,7 +62,7 @@ if test2src != test2dest: "correctly") tester.fail_test(1) -tester.run_build_system("-d1") +tester.run_build_system(["-d1"]) tester.expect_output_line("common.copy*", expected_to_exist=False) tester.expect_nothing_more() diff --git a/v2/test/core_action_output.py b/v2/test/core_action_output.py index aaa7ec605..377cf0114 100755 --- a/v2/test/core_action_output.py +++ b/v2/test/core_action_output.py @@ -8,7 +8,7 @@ import BoostBuild -t = BoostBuild.Tester("-d1", pass_d0=False, pass_toolset=False) +t = BoostBuild.Tester(["-d1"], pass_d0=False, pass_toolset=False) t.write("file.jam", """\ prefix = "echo \\"" ; @@ -28,31 +28,31 @@ ALWAYS all ; go all ; """) -t.run_build_system("-ffile.jam -sXXX=1", stderr="") +t.run_build_system(["-ffile.jam", "-sXXX=1"], stderr="") t.expect_output_line("{{{ 1 }}}") t.expect_output_line("stdout") t.expect_output_line("stderr") t.expect_nothing_more() -t.run_build_system("-ffile.jam -sXXX=2 -p0", stderr="") +t.run_build_system(["-ffile.jam", "-sXXX=2", "-p0"], stderr="") t.expect_output_line("{{{ 2 }}}") t.expect_output_line("stdout") t.expect_output_line("stderr") t.expect_nothing_more() -t.run_build_system("-ffile.jam -sXXX=3 -p1", stderr="") +t.run_build_system(["-ffile.jam", "-sXXX=3", "-p1"], stderr="") t.expect_output_line("{{{ 3 }}}") t.expect_output_line("stdout") t.expect_output_line("stderr*", False) t.expect_nothing_more() -t.run_build_system("-ffile.jam -sXXX=4 -p2", stderr="stderr\n") +t.run_build_system(["-ffile.jam", "-sXXX=4", "-p2"], stderr="stderr\n") t.expect_output_line("{{{ 4 }}}") t.expect_output_line("stdout*", False) t.expect_output_line("stderr*", False) t.expect_nothing_more() -t.run_build_system("-ffile.jam -sXXX=5 -p3", stderr="stderr\n") +t.run_build_system(["-ffile.jam", "-sXXX=5", "-p3"], stderr="stderr\n") t.expect_output_line("{{{ 5 }}}") t.expect_output_line("stdout") t.expect_output_line("stderr", False) diff --git a/v2/test/core_action_status.py b/v2/test/core_action_status.py index f4f0536b9..7ebd43869 100755 --- a/v2/test/core_action_status.py +++ b/v2/test/core_action_status.py @@ -22,6 +22,6 @@ NOTFILE subtest ; DEPENDS all : subtest_a ; """) -t.run_build_system("-ffile.jam -sACTION=invalid", status=1) +t.run_build_system(["-ffile.jam", "-sACTION=invalid"], status=1) t.cleanup() diff --git a/v2/test/core_actions_quietly.py b/v2/test/core_actions_quietly.py index f941bfab3..c020846d5 100755 --- a/v2/test/core_actions_quietly.py +++ b/v2/test/core_actions_quietly.py @@ -28,7 +28,7 @@ NOTFILE subtest ; DEPENDS all : subtest_a subtest_b ; """) -t.run_build_system("-ffile.jam -d2", stdout="""\ +t.run_build_system(["-ffile.jam", "-d2"], stdout="""\ ...found 4 targets... ...updating 2 targets... .a. subtest_a @@ -52,7 +52,7 @@ echo [subtest_b] 2 ...updated 2 targets... """) -t.run_build_system("-ffile.jam -d1", stdout="""\ +t.run_build_system(["-ffile.jam", "-d1"], stdout="""\ ...found 4 targets... ...updating 2 targets... ...updated 2 targets... diff --git a/v2/test/core_arguments.py b/v2/test/core_arguments.py index d92a8df1b..36eac2294 100755 --- a/v2/test/core_arguments.py +++ b/v2/test/core_arguments.py @@ -17,7 +17,7 @@ def test(t, type, input, output, status=0): if input: code.append(input) code.append(";") t.write("file.jam", " ".join(code)) - t.run_build_system("-ffile.jam", status=status) + t.run_build_system(["-ffile.jam"], status=status) t.expect_output_line(output); diff --git a/v2/test/core_at_file.py b/v2/test/core_at_file.py index 585144880..d7189254e 100755 --- a/v2/test/core_at_file.py +++ b/v2/test/core_at_file.py @@ -8,7 +8,7 @@ import BoostBuild import os -t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) +t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", """\ name = n1 n2 ; @@ -30,7 +30,7 @@ actions run { echo file: "@(o$(name) .txt:E= test -D$(contents))" } run all ; """) -t.run_build_system("-d2") +t.run_build_system(["-d2"]) t.expect_output_line('echo file: "on1 on2 .txt"'); t.expect_addition("on1 on2 .txt") t.expect_content("on1 on2 .txt", " test -DM1 -DM2", True) @@ -45,7 +45,7 @@ actions run { $(file) } run all ; """) -t.run_build_system("-d1") +t.run_build_system(["-d1"]) t.expect_output_line(" test -DM1 -DM2") t.rm(".") @@ -57,7 +57,7 @@ actions run { @($(STDOUT):E= test -D$(contents)\n) } run all ; """) -t.run_build_system("-d1") +t.run_build_system(["-d1"]) t.expect_output_line(" test -DM1 -DM2") t.cleanup() diff --git a/v2/test/core_bindrule.py b/v2/test/core_bindrule.py index f41560165..3a6916afa 100755 --- a/v2/test/core_bindrule.py +++ b/v2/test/core_bindrule.py @@ -36,7 +36,7 @@ rule bind-rule ( target : path ) DEPENDS all : fake-target ; """) -t.run_build_system("-ffile.jam", stdout="""\ +t.run_build_system(["-ffile.jam"], stdout="""\ found: all at all found: file-to-bind at subdir1%sfile-to-bind ...found 3 targets... diff --git a/v2/test/core_d12.py b/v2/test/core_d12.py index 798ef5114..3aefe9aba 100644 --- a/v2/test/core_d12.py +++ b/v2/test/core_d12.py @@ -8,7 +8,7 @@ import BoostBuild -t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) +t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", """ actions a { } @@ -18,13 +18,13 @@ a all ; b all ; """) -t.run_build_system("-d0", stdout="") +t.run_build_system(["-d0"], stdout="") -t.run_build_system("-d1") +t.run_build_system(["-d1"]) t.expect_output_line("a all") t.expect_output_line("b all", False) -t.run_build_system("-d2") +t.run_build_system(["-d2"]) t.expect_output_line("a all") t.expect_output_line("b all") diff --git a/v2/test/core_delete_module.py b/v2/test/core_delete_module.py index b02fd95a3..d56ffe6e7 100644 --- a/v2/test/core_delete_module.py +++ b/v2/test/core_delete_module.py @@ -47,5 +47,5 @@ DEPENDS all : xx ; NOTFILE xx ; """) -t.run_build_system("-ffile.jam", status=0) +t.run_build_system(["-ffile.jam"], status=0) t.cleanup() diff --git a/v2/test/core_import_module.py b/v2/test/core_import_module.py index f2eed975f..f00419300 100644 --- a/v2/test/core_import_module.py +++ b/v2/test/core_import_module.py @@ -70,7 +70,7 @@ actions do-nothing { } do-nothing all ; """) -t.run_build_system("-fcode", stdout="""\ +t.run_build_system(["-fcode"], stdout="""\ R1 R2 L1 diff --git a/v2/test/core_language.py b/v2/test/core_language.py index ae1788b45..717e91ada 100755 --- a/v2/test/core_language.py +++ b/v2/test/core_language.py @@ -8,5 +8,5 @@ import BoostBuild t = BoostBuild.Tester(pass_toolset=0) t.set_tree("core-language") -t.run_build_system("-ftest.jam") +t.run_build_system(["-ftest.jam"]) t.cleanup() diff --git a/v2/test/core_nt_cmd_line.py b/v2/test/core_nt_cmd_line.py index 8c407db54..3f3c83eb2 100755 --- a/v2/test/core_nt_cmd_line.py +++ b/v2/test/core_nt_cmd_line.py @@ -38,18 +38,27 @@ def string_of_length(n): # content and always requires at least a single whitespace after the opening # brace in order to satisfy its Boost Jam language grammar rules. def test_raw_empty(): - whitespace = " \n\n\r\r\v\v\t\t \t \r\r \n\n" - t = BoostBuild.Tester("-d2 -d+4", pass_d0=False, pass_toolset=0, + whitespace_in = " \n\n\r\r\v\v\t\t \t \r\r \n\n" + + # We tell the testing system to read its child process output as raw + # binary data but the bjam process we run will read its input file and + # write out its output as text, i.e. convert all of our "\r\n" sequences to + # "\n" on input and all of its "\n" characters back to "\r\n" on output. + # This means that any lone "\n" input characters not preceded by "\r" will + # get an extra "\r" added in front of it on output. + whitespace_out = whitespace_in.replace("\r\n", "\n").replace("\n", "\r\n") + + t = BoostBuild.Tester(["-d2", "-d+4"], pass_d0=False, pass_toolset=0, use_test_config=False) t.write("file.jam", """\ actions do_empty {%s} JAMSHELL = %% ; do_empty all ; -""" % (whitespace)) - t.run_build_system("-ffile.jam") +""" % (whitespace_in)) + t.run_build_system(["-ffile.jam"], universal_newlines=False) t.expect_output_line("do_empty all") t.expect_output_line("Executing raw command directly", False) - if "\n%s\n" % whitespace not in t.stdout(): + if "\r\n%s\r\n" % whitespace_out not in t.stdout(): BoostBuild.annotation("failure", "Whitespace action content not found " "on stdout.") t.fail_test(1, dump_difference=False) @@ -57,7 +66,7 @@ do_empty all ; def test_raw_nt(n=None, error=False): - t = BoostBuild.Tester("-d1 -d+4", pass_d0=False, pass_toolset=0, + t = BoostBuild.Tester(["-d1", "-d+4"], pass_d0=False, pass_toolset=0, use_test_config=False) cmd_prefix = "%s -c \"print('XXX: " % executable @@ -100,7 +109,7 @@ do_echo all ; expected_status = 1 else: expected_status = 0 - t.run_build_system("-ffile.jam", status=expected_status) + t.run_build_system(["-ffile.jam"], status=expected_status) if error: t.expect_output_line("Executing raw command directly", False) t.expect_output_line("do_echo action is too long (%d, max 32766):" % n) @@ -124,7 +133,7 @@ do_echo all ; def test_raw_to_shell_fallback_nt(): - t = BoostBuild.Tester("-d1 -d+4", pass_d0=False, pass_toolset=0, + t = BoostBuild.Tester(["-d1", "-d+4"], pass_d0=False, pass_toolset=0, use_test_config=False) cmd_prefix = '%s -c print(' % executable @@ -141,7 +150,7 @@ actions do_multiline JAMSHELL = % ; do_multiline all ; """) - t.run_build_system("-ffile_multiline.jam") + t.run_build_system(["-ffile_multiline.jam"]) t.expect_output_line("do_multiline all") t.expect_output_line("one") t.expect_output_line("two") @@ -154,7 +163,7 @@ actions do_redirect { echo one > two.txt } JAMSHELL = % ; do_redirect all ; """) - t.run_build_system("-ffile_redirect.jam") + t.run_build_system(["-ffile_redirect.jam"]) t.expect_output_line("do_redirect all") t.expect_output_line("one", False) t.expect_output_line("Executing raw command directly", False) @@ -167,7 +176,7 @@ actions do_pipe { echo one | echo two } JAMSHELL = % ; do_pipe all ; """) - t.run_build_system("-ffile_pipe.jam") + t.run_build_system(["-ffile_pipe.jam"]) t.expect_output_line("do_pipe all") t.expect_output_line("one", False) t.expect_output_line("two") @@ -180,7 +189,7 @@ actions do_single_quoted { %s'5>10'%s } JAMSHELL = %% ; do_single_quoted all ; """ % (cmd_prefix, cmd_suffix)) - t.run_build_system("-ffile_single_quoted.jam") + t.run_build_system(["-ffile_single_quoted.jam"]) t.expect_output_line("do_single_quoted all") t.expect_output_line("5>10") t.expect_output_line("Executing raw command directly") @@ -193,7 +202,7 @@ actions do_double_quoted { %s"5>10"%s } JAMSHELL = %% ; do_double_quoted all ; """ % (cmd_prefix, cmd_suffix)) - t.run_build_system("-ffile_double_quoted.jam") + t.run_build_system(["-ffile_double_quoted.jam"]) t.expect_output_line("do_double_quoted all") # The difference between this example and the similar previous one using # single instead of double quotes stems from how the used Python executable @@ -209,7 +218,7 @@ actions do_escaped_quote { %s\\"5>10\\"%s } JAMSHELL = %% ; do_escaped_quote all ; """ % (cmd_prefix, cmd_suffix)) - t.run_build_system("-ffile_escaped_quote.jam") + t.run_build_system(["-ffile_escaped_quote.jam"]) t.expect_output_line("do_escaped_quote all") t.expect_output_line("5>10") t.expect_output_line("Executing raw command directly", False) diff --git a/v2/test/core_option_d2.py b/v2/test/core_option_d2.py index 8370e960b..bf809aa85 100755 --- a/v2/test/core_option_d2.py +++ b/v2/test/core_option_d2.py @@ -28,7 +28,7 @@ NOTFILE subtest ; DEPENDS all : subtest_a subtest_b ; """) -t.run_build_system("-ffile.jam -d2", stdout="""\ +t.run_build_system(["-ffile.jam", "-d2"], stdout="""\ ...found 4 targets... ...updating 2 targets... .a. subtest_a diff --git a/v2/test/core_option_l.py b/v2/test/core_option_l.py index 96cb86e13..3088626f1 100755 --- a/v2/test/core_option_l.py +++ b/v2/test/core_option_l.py @@ -37,7 +37,7 @@ echo 002 DEPENDS all : sleeper ; """) -t.run_build_system("-ffile.jam -d1 -l2", status=1) +t.run_build_system(["-ffile.jam", "-d1", "-l2"], status=1) t.expect_output_line("2 second time limit exceeded") t.cleanup() diff --git a/v2/test/core_option_n.py b/v2/test/core_option_n.py index 2696f5d2f..4dab3bf99 100755 --- a/v2/test/core_option_n.py +++ b/v2/test/core_option_n.py @@ -29,7 +29,7 @@ FAIL_EXPECTED subtest_b ; DEPENDS all : subtest_a subtest_b ; """) -t.run_build_system("-ffile.jam -n", stdout="""\ +t.run_build_system(["-ffile.jam", "-n"], stdout="""\ ...found 4 targets... ...updating 2 targets... .a. subtest_a diff --git a/v2/test/core_parallel_actions.py b/v2/test/core_parallel_actions.py index 5e4dfec2d..0d44149b7 100755 --- a/v2/test/core_parallel_actions.py +++ b/v2/test/core_parallel_actions.py @@ -62,7 +62,7 @@ DEPENDS bottom : 1.b 2.b 3.b 4.b ; DEPENDS all : bottom ; """) -t.run_build_system("-ffile.jam -j4", stdout="""\ +t.run_build_system(["-ffile.jam", "-j4"], stdout="""\ ...found 12 targets... ...updating 8 targets... sleeper 1.a diff --git a/v2/test/core_parallel_multifile_actions_1.py b/v2/test/core_parallel_multifile_actions_1.py index 14a8ec770..3e5317dfc 100755 --- a/v2/test/core_parallel_multifile_actions_1.py +++ b/v2/test/core_parallel_multifile_actions_1.py @@ -54,7 +54,7 @@ DEPENDS g1.generated g2.generated : root ; DEPENDS all : u1.user u2.user ; """) -t.run_build_system("-ffile.jam -j2", stdout="""\ +t.run_build_system(["-ffile.jam", "-j2"], stdout="""\ ...found 6 targets... ...updating 4 targets... .gen. g1.generated diff --git a/v2/test/core_parallel_multifile_actions_2.py b/v2/test/core_parallel_multifile_actions_2.py index 169c742fb..d46602977 100755 --- a/v2/test/core_parallel_multifile_actions_2.py +++ b/v2/test/core_parallel_multifile_actions_2.py @@ -57,7 +57,7 @@ DEPENDS installed_dll : dll ; DEPENDS all : lib installed_dll ; """) -t.run_build_system("-ffile.jam -j2", stdout="""\ +t.run_build_system(["-ffile.jam", "-j2"], stdout="""\ ...found 4 targets... ...updating 3 targets... link dll diff --git a/v2/test/core_typecheck.py b/v2/test/core_typecheck.py index ed83a8916..225ea7a4b 100644 --- a/v2/test/core_typecheck.py +++ b/v2/test/core_typecheck.py @@ -8,7 +8,7 @@ import BoostBuild -t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) +t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", """ module .typecheck @@ -33,8 +33,8 @@ actions dummy { } dummy all ; """) -t.run_build_system("-sARGUMENT=::a/b/c") -t.run_build_system("-sARGUMENT=a/b/c", status=1, stdout="""\ +t.run_build_system(["-sARGUMENT=::a/b/c"]) +t.run_build_system(["-sARGUMENT=a/b/c"], status=1, stdout="""\ Error: a/b/c is not a path file.jam:18: in module scope *** argument error diff --git a/v2/test/core_update_now.py b/v2/test/core_update_now.py index 30fd88b31..e1fd49e27 100755 --- a/v2/test/core_update_now.py +++ b/v2/test/core_update_now.py @@ -26,7 +26,7 @@ UPDATE_NOW target1 ; DEPENDS all : target1 ; """) - t.run_build_system("-ffile.jam", stdout="""\ + t.run_build_system(["-ffile.jam"], stdout="""\ ...found 1 target... ...updating 1 target... do-print target1 @@ -56,7 +56,7 @@ UPDATE_NOW target1 : : ignore-minus-n ; DEPENDS all : target1 ; """) - t.run_build_system("-ffile.jam -n", stdout="""\ + t.run_build_system(["-ffile.jam", "-n"], stdout="""\ ...found 1 target... ...updating 1 target... do-print target1 @@ -98,7 +98,7 @@ UPDATE_NOW target1 : : ignore-minus-n ; DEPENDS all : target1 target2 ; """) - t.run_build_system("-ffile.jam -n", stdout="""\ + t.run_build_system(["-ffile.jam", "-n"], stdout="""\ ...found 1 target... ...updating 1 target... fail target1 @@ -137,7 +137,7 @@ UPDATE_NOW target1 : : ignore-minus-n ; DEPENDS all : target1 target2 ; """) - t.run_build_system("-ffile.jam -n", status=1, stdout="""\ + t.run_build_system(["-ffile.jam", "-n"], status=1, stdout="""\ don't know how to make target1 ...found 1 target... ...can't find 1 target... @@ -174,7 +174,7 @@ UPDATE_NOW target1 : : ignore-minus-n ; DEPENDS all : target1 ; """) - t.run_build_system("-ffile.jam -n", stdout="""\ + t.run_build_system(["-ffile.jam", "-n"], stdout="""\ ...found 1 target... ...updating 1 target... do-print target1 diff --git a/v2/test/core_variables_in_actions.py b/v2/test/core_variables_in_actions.py index 12d67c5bc..869efa1cd 100755 --- a/v2/test/core_variables_in_actions.py +++ b/v2/test/core_variables_in_actions.py @@ -32,7 +32,7 @@ actions dummy dummy all ; """) -t.run_build_system("-ffile.jam -d1") +t.run_build_system(["-ffile.jam", "-d1"]) t.expect_output_line("From rule: 1 seconds 2 seconds 3 seconds") t.expect_output_line('*From action: 1" 2" 3" seconds"*') t.cleanup() diff --git a/v2/test/core_varnames.py b/v2/test/core_varnames.py index 64d445409..6b61ffcd3 100644 --- a/v2/test/core_varnames.py +++ b/v2/test/core_varnames.py @@ -33,6 +33,6 @@ DEPENDS all : xx ; NOTFILE xx ; """) -t.run_build_system("-ffile.jam", status=0) +t.run_build_system(["-ffile.jam"], status=0) t.cleanup() diff --git a/v2/test/default_build.py b/v2/test/default_build.py index 03dd5465f..ba8766724 100644 --- a/v2/test/default_build.py +++ b/v2/test/default_build.py @@ -21,13 +21,13 @@ t.expect_addition("bin/$toolset/release/a.exe") # Check that explictly-specified build variant supresses default-build. t.rm("bin") -t.run_build_system("release") +t.run_build_system(["release"]) t.expect_addition(BoostBuild.List("bin/$toolset/release/") * "a.exe a.obj") t.expect_nothing_more() # Now check that we can specify explicit build request and default-build will be # combined with it. -t.run_build_system("optimization=space") +t.run_build_system(["optimization=space"]) t.expect_addition("bin/$toolset/debug/optimization-space/a.exe") t.expect_addition("bin/$toolset/release/optimization-space/a.exe") @@ -36,7 +36,7 @@ t.write("jamfile.jam", """\ exe a : a.cpp : : debug ; exe a : b.cpp : : ; """) -t.run_build_system("-n --no-error-backtrace", status=1) +t.run_build_system(["-n", "--no-error-backtrace"], status=1) t.fail_test(t.stdout().find("default build must be identical in all alternatives") == -1) # Test that default-build must be identical in all alternatives. No Error case, @@ -45,7 +45,7 @@ t.write("jamfile.jam", """\ exe a : a.cpp : debug ; exe a : b.cpp : release ; """) -t.run_build_system("-n --no-error-backtrace", status=0) +t.run_build_system(["-n", "--no-error-backtrace"], status=0) # Now try a harder example: default build which contains should cause # to be present when "b" is compiled. This happens only if diff --git a/v2/test/dependency_property.py b/v2/test/dependency_property.py index c6daaa298..e5c78b60a 100644 --- a/v2/test/dependency_property.py +++ b/v2/test/dependency_property.py @@ -30,7 +30,7 @@ __declspec(dllexport) void foo() {} """) -t.run_build_system("--no-error-backtrace", status=1) +t.run_build_system(["--no-error-backtrace"], status=1) t.fail_test(string.find(t.stdout(), "Duplicate name of actual target") == -1) t.cleanup() diff --git a/v2/test/direct_request_test.py b/v2/test/direct_request_test.py index 1719d80d2..e39cf0bb7 100644 --- a/v2/test/direct_request_test.py +++ b/v2/test/direct_request_test.py @@ -35,14 +35,14 @@ int __declspec(dllexport) force_implib_creation; # endif """) -t.run_build_system("define=MACROS") +t.run_build_system(["define=MACROS"]) t.expect_addition("bin/$toolset/debug/" * (BoostBuild.List("a.obj b.obj b.dll a.exe"))) # When building a debug version, the 'define' still applies. t.rm("bin") -t.run_build_system("debug define=MACROS") +t.run_build_system(["debug", "define=MACROS"]) t.expect_addition("bin/$toolset/debug/" * (BoostBuild.List("a.obj b.obj b.dll a.exe"))) @@ -53,7 +53,7 @@ exe a : a.cpp b : debug ; lib b : b.cpp ; """) t.rm("bin") -t.run_build_system("release define=MACROS") +t.run_build_system(["release", "define=MACROS"]) # Regression test: direct build request was not working when there was more @@ -63,6 +63,6 @@ t.write("jamroot.jam", "") t.write("jamfile.jam", "build-project a ;") t.write("a/jamfile.jam", "build-project b ;") t.write("a/b/jamfile.jam", "") -t.run_build_system("release") +t.run_build_system(["release"]) t.cleanup() diff --git a/v2/test/dll_path.py b/v2/test/dll_path.py index c22ade935..7eeda564f 100644 --- a/v2/test/dll_path.py +++ b/v2/test/dll_path.py @@ -134,12 +134,12 @@ __declspec(dllexport) bar() {} """) -t.run_build_system("hardcode-dll-paths=true") +t.run_build_system(["hardcode-dll-paths=true"]) t.expect_addition("bin/$toolset/debug/mp.pathlist") -es1 = t.adjust_names(["a/bin/$toolset/debug"])[0] -es2 = t.adjust_names(["b/bin/$toolset/debug"])[0] +es1 = t.adjust_names("a/bin/$toolset/debug")[0] +es2 = t.adjust_names("b/bin/$toolset/debug")[0] t.expect_content_line("bin/$toolset/debug/mp.pathlist", "*" + es1); t.expect_content_line("bin/$toolset/debug/mp.pathlist", "*" + es2); diff --git a/v2/test/example_make.py b/v2/test/example_make.py index 01c542272..270541829 100644 --- a/v2/test/example_make.py +++ b/v2/test/example_make.py @@ -10,7 +10,7 @@ import BoostBuild import sys -t = BoostBuild.Tester('example.python.interpreter="%s"' % sys.executable) +t = BoostBuild.Tester(['example.python.interpreter=%s' % sys.executable]) t.set_tree("../example/make") t.run_build_system() t.expect_addition(["bin/$toolset/debug/main.cpp"]) diff --git a/v2/test/explicit.py b/v2/test/explicit.py index 8759bf22a..28bca4185 100644 --- a/v2/test/explicit.py +++ b/v2/test/explicit.py @@ -22,7 +22,7 @@ t.expect_addition(BoostBuild.List("bin/$toolset/debug/hello") * \ [".exe", ".obj"]) t.expect_nothing_more() -t.run_build_system("hello2") +t.run_build_system(["hello2"]) t.expect_addition("bin/$toolset/debug/hello2.exe") t.rm(".") diff --git a/v2/test/free_features_request.py b/v2/test/free_features_request.py index b38e97571..3bef67196 100644 --- a/v2/test/free_features_request.py +++ b/v2/test/free_features_request.py @@ -35,7 +35,7 @@ void foo() {} # If FOO is not defined when compiling the 'foo' target, we will get a link # error at this point. -t.run_build_system("hello define=FOO") +t.run_build_system(["hello", "define=FOO"]) t.expect_addition("bin/$toolset/debug/hello.exe") diff --git a/v2/test/gcc_runtime.py b/v2/test/gcc_runtime.py index f0095342e..5c5ff06f4 100644 --- a/v2/test/gcc_runtime.py +++ b/v2/test/gcc_runtime.py @@ -13,12 +13,12 @@ t = BoostBuild.Tester() t.write("jamroot.jam", "lib hello : hello.cpp ;") t.write("hello.cpp", "int main() {}\n") -t.run_build_system("runtime-link=static") +t.run_build_system(["runtime-link=static"]) t.expect_output_line("warning: On gcc, DLLs can not be built with " "'static'.") t.expect_nothing_more() -t.run_build_system("link=static runtime-link=static") +t.run_build_system(["link=static", "runtime-link=static"]) binFolder = "bin/$toolset/debug/link-static/runtime-link-static" t.expect_addition("%s/hello.obj" % binFolder) t.expect_addition("%s/hello.lib" % binFolder) diff --git a/v2/test/generators_test.py b/v2/test/generators_test.py index 0f3f1daed..06b433131 100644 --- a/v2/test/generators_test.py +++ b/v2/test/generators_test.py @@ -21,7 +21,7 @@ def match_count_is(lines, pattern, expected): t = BoostBuild.Tester() t.set_tree("generators-test") -t.run_build_system("-d1") +t.run_build_system(["-d1"]) t.expect_addition("bin/$toolset/debug/" * BoostBuild.List("a.my_exe a.my_obj " "b.my_obj c.tui_h c.cpp c.my_obj d_parser.whl d_lexer.dlp d_parser.cpp " " d_lexer.cpp d_lexer.my_obj d_parser.lr0 d_parser.h d_parser.my_obj " diff --git a/v2/test/inherit_toolset.py b/v2/test/inherit_toolset.py index 632b097cb..af1878003 100644 --- a/v2/test/inherit_toolset.py +++ b/v2/test/inherit_toolset.py @@ -39,13 +39,13 @@ actions link { yfc2-link } t.write("jamfile.jam", "exe a : a.cpp ;") t.write("jamroot.jam", "using yfc1 ;") -t.run_build_system("-n -d2 yfc1") +t.run_build_system(["-n", "-d2", "yfc1"]) t.fail_test(string.find(t.stdout(), "yfc1-link") == -1) # Make sure we do not have to explicitly 'use' yfc1. t.write("jamroot.jam", "using yfc2 ;") -t.run_build_system("-n -d2 yfc2") +t.run_build_system(["-n", "-d2", "yfc2"]) t.fail_test(string.find(t.stdout(), "yfc2-link") == -1) t.cleanup() diff --git a/v2/test/inline.py b/v2/test/inline.py index ff76f7234..2ed21ccc9 100644 --- a/v2/test/inline.py +++ b/v2/test/inline.py @@ -24,7 +24,7 @@ t.run_build_system() t.expect_addition("bin/$toolset/debug/link-static/a__helper.lib") t.rm("bin/$toolset/debug/link-static/a__helper.lib") -t.run_build_system("a__helper") +t.run_build_system(["a__helper"]) t.expect_addition("bin/$toolset/debug/link-static/a__helper.lib") t.rm("bin") @@ -56,7 +56,7 @@ t.rm("bin") t.run_build_system() t.expect_nothing_more() -t.run_build_system("a") +t.run_build_system(["a"]) t.expect_addition("bin/$toolset/debug/link-static/helper.lib") t.cleanup() diff --git a/v2/test/library_chain.py b/v2/test/library_chain.py index 1818fae21..e08f29ed1 100644 --- a/v2/test/library_chain.py +++ b/v2/test/library_chain.py @@ -53,11 +53,11 @@ foo() { geek(); } t.write("b/jamfile.jam", "lib b : b.cpp ../a//a ;") -t.run_build_system("-d2", stderr=None) +t.run_build_system(["-d2"], stderr=None) t.expect_addition("bin/$toolset/debug/main.exe") t.rm(["bin", "a/bin", "b/bin"]) -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/main.exe") t.rm(["bin", "a/bin", "b/bin"]) @@ -65,7 +65,7 @@ t.rm(["bin", "a/bin", "b/bin"]) # Check that works for static linking. t.write("b/jamfile.jam", "lib b : b.cpp : ../a//a ;") -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/main.exe") t.rm(["bin", "a/bin", "b/bin"]) @@ -85,7 +85,7 @@ lib png : z : png ; lib z : : zzz ; """) -t.run_build_system("-a -d+2", status=None, stderr=None) +t.run_build_system(["-a", "-d+2"], status=None, stderr=None) # Try to find the "zzz" string either in response file (for Windows compilers), # or in the standard output. rsp = t.adjust_names("bin/$toolset/debug/main.exe.rsp")[0] diff --git a/v2/test/loop.py b/v2/test/loop.py index 0d8a87a49..30b069001 100644 --- a/v2/test/loop.py +++ b/v2/test/loop.py @@ -17,7 +17,7 @@ lib l : l.cpp main ; t.write("main.cpp", "") t.write("l.cpp", "") -t.run_build_system("--no-error-backtrace", status=1) +t.run_build_system(["--no-error-backtrace"], status=1) t.fail_test(string.find(t.stdout(), "error: Recursion in main target references") == -1) diff --git a/v2/test/make_rule.py b/v2/test/make_rule.py index 9f1f70aee..f13bdb4cd 100644 --- a/v2/test/make_rule.py +++ b/v2/test/make_rule.py @@ -48,7 +48,7 @@ make hello1.cpp : hello.cpp : common.copy ; t.write("dir/hello.cpp", "int main() {}\n") # Show only action names. -t.run_build_system("-d1 -n") +t.run_build_system(["-d1", "-n"]) t.fail_test(t.stdout().count("copy") != 1) t.cleanup() diff --git a/v2/test/module_actions.py b/v2/test/module_actions.py index 4890671f6..1a0af5ecc 100644 --- a/v2/test/module_actions.py +++ b/v2/test/module_actions.py @@ -10,7 +10,7 @@ import BoostBuild import os import re -t = BoostBuild.Tester("-d+1", pass_toolset=0) +t = BoostBuild.Tester(["-d+1"], pass_toolset=0) t.set_tree('module-actions') diff --git a/v2/test/ndebug.py b/v2/test/ndebug.py index 317af2991..eed15cf62 100644 --- a/v2/test/ndebug.py +++ b/v2/test/ndebug.py @@ -28,6 +28,6 @@ void foo() {} # 'release' builds should get the NDEBUG define. We use static linking to avoid # messing with imports/exports on Windows. -t.run_build_system("link=static release") +t.run_build_system(["link=static", "release"]) t.cleanup() diff --git a/v2/test/notfile.py b/v2/test/notfile.py index 0ec7e8439..3385eee59 100644 --- a/v2/test/notfile.py +++ b/v2/test/notfile.py @@ -31,7 +31,7 @@ t.write("hello.cpp", """\ int main() { std::cout << "Hello!\\n"; } """) -t.run_build_system("-n -d+2") +t.run_build_system(["-n", "-d+2"]) t.fail_test(string.find(t.stdout(), "echo hi") == -1) diff --git a/v2/test/out_of_tree.py b/v2/test/out_of_tree.py index b15e02552..f6484de6a 100644 --- a/v2/test/out_of_tree.py +++ b/v2/test/out_of_tree.py @@ -22,7 +22,7 @@ exe hello3 : hello.cpp ; """) t.write("p2/hello.cpp", "int main() {}\n") -t.run_build_system("p1 p2//hello3") +t.run_build_system(["p1", "p2//hello3"]) t.expect_addition("p1/bin/$toolset/debug/hello.exe") t.expect_addition("p2/bin/$toolset/debug/hello3.exe") diff --git a/v2/test/prebuilt.py b/v2/test/prebuilt.py index da0393de3..20f26bc28 100644 --- a/v2/test/prebuilt.py +++ b/v2/test/prebuilt.py @@ -8,7 +8,7 @@ import BoostBuild -t = BoostBuild.Tester("debug release") +t = BoostBuild.Tester(["debug", "release"]) t.set_tree('prebuilt') diff --git a/v2/test/project_test3.py b/v2/test/project_test3.py index 8e5383cc6..c4b249d24 100644 --- a/v2/test/project_test3.py +++ b/v2/test/project_test3.py @@ -84,13 +84,13 @@ t.expect_touch(["bin/$toolset/debug/a.obj", "bin/$toolset/debug/a.exe", "lib2/bin/$toolset/debug/l.exe"]) -t.run_build_system("release optimization=off,speed") +t.run_build_system(["release", "optimization=off,speed"]) t.expect_addition(["bin/$toolset/release/a.exe", "bin/$toolset/release/a.obj", "bin/$toolset/release/optimization-off/a.exe", "bin/$toolset/release/optimization-off/a.obj"]) -t.run_build_system("--clean-all") +t.run_build_system(["--clean-all"]) t.expect_removal(["bin/$toolset/debug/a.obj", "bin/$toolset/debug/a.exe", "lib/bin/$toolset/debug/b.obj", @@ -102,31 +102,31 @@ t.expect_removal(["bin/$toolset/debug/a.obj", # Now test target ids in command line. t.set_tree("project-test3") -t.run_build_system("lib//b.obj") +t.run_build_system(["lib//b.obj"]) t.expect_addition("lib/bin/$toolset/debug/b.obj") t.expect_nothing_more() -t.run_build_system("--clean lib//b.obj") +t.run_build_system(["--clean", "lib//b.obj"]) t.expect_removal("lib/bin/$toolset/debug/b.obj") t.expect_nothing_more() -t.run_build_system("lib//b.obj") +t.run_build_system(["lib//b.obj"]) t.expect_addition("lib/bin/$toolset/debug/b.obj") t.expect_nothing_more() -t.run_build_system("release lib2/helper//e.obj /lib3//f.obj") +t.run_build_system(["release", "lib2/helper//e.obj", "/lib3//f.obj"]) t.expect_addition("lib2/helper/bin/$toolset/release/e.obj") t.expect_addition("lib3/bin/$toolset/release/f.obj") t.expect_nothing_more() # Test project ids in command line work as well. t.set_tree("project-test3") -t.run_build_system("/lib2") +t.run_build_system(["/lib2"]) t.expect_addition("lib2/bin/$toolset/debug/" * BoostBuild.List("c.obj d.obj l.exe")) t.expect_addition("bin/$toolset/debug/a.obj") t.expect_nothing_more() -t.run_build_system("lib") +t.run_build_system(["lib"]) t.expect_addition("lib/bin/$toolset/debug/" * BoostBuild.List("b.obj m.exe")) t.expect_nothing_more() diff --git a/v2/test/property_expansion.py b/v2/test/property_expansion.py index 760df59e1..16d2708f1 100644 --- a/v2/test/property_expansion.py +++ b/v2/test/property_expansion.py @@ -23,6 +23,6 @@ int main() {} #endif """) -t.run_build_system("debug-AA") +t.run_build_system(["debug-AA"]) t.cleanup() diff --git a/v2/test/rebuilds.py b/v2/test/rebuilds.py index 9d4142f05..84b0b3647 100644 --- a/v2/test/rebuilds.py +++ b/v2/test/rebuilds.py @@ -6,7 +6,7 @@ import BoostBuild -t = BoostBuild.Tester("-ffile.jam", pass_toolset=0) +t = BoostBuild.Tester(["-ffile.jam"], pass_toolset=0) t.write("file.jam", """\ rule make @@ -29,12 +29,12 @@ make aux2 : bar ; t.write("baz", "nothing") -t.run_build_system("bar") +t.run_build_system(["bar"]) t.expect_addition("bar") t.expect_nothing_more() t.wait_for_time_change_since_last_build() -t.run_build_system("foo") +t.run_build_system(["foo"]) t.expect_touch("bar") t.expect_addition("foo") t.expect_nothing_more() diff --git a/v2/test/regression.py b/v2/test/regression.py index 9c6e6770a..c86e29b63 100644 --- a/v2/test/regression.py +++ b/v2/test/regression.py @@ -46,7 +46,7 @@ helper() {} """) # First test that when outcomes are expected, all .test files are created. -t.run_build_system("hardcode-dll-paths=false", stderr=None, status=None) +t.run_build_system(["hardcode-dll-paths=false"], stderr=None, status=None) t.expect_addition("bin/c.test/$toolset/debug/c.test") t.expect_addition("bin/c-f.test/$toolset/debug/c-f.test") t.expect_addition("bin/r.test/$toolset/debug/r.test") @@ -83,7 +83,7 @@ time execution : r ; time compilation : c-obj ; """) -t.run_build_system("hardcode-dll-paths=false") +t.run_build_system(["hardcode-dll-paths=false"]) t.expect_content("bin/r.test/$toolset/debug/r.output", """\ test input EXIT STATUS: 0 @@ -104,7 +104,7 @@ run r-f.cpp ; t.touch(BoostBuild.List("c.cpp c-f.cpp r.cpp r-f.cpp")) -t.run_build_system("hardcode-dll-paths=false", stderr=None, status=1) +t.run_build_system(["hardcode-dll-paths=false"], stderr=None, status=1) t.expect_removal("bin/c.test/$toolset/debug/c.test") t.expect_removal("bin/c-f.test/$toolset/debug/c-f.test") t.expect_removal("bin/r.test/$toolset/debug/r.test") diff --git a/v2/test/rescan_header.py b/v2/test/rescan_header.py index 204c56465..d4efdccd7 100755 --- a/v2/test/rescan_header.py +++ b/v2/test/rescan_header.py @@ -34,7 +34,7 @@ make header3.h : header3.in : @common.copy ; obj test : test.cpp : header3.h ; """) -t.run_build_system("-j2") +t.run_build_system(["-j2"]) t.expect_addition("bin/$toolset/debug/header3.h") t.expect_addition("bin/$toolset/debug/test.obj") t.expect_nothing_more() @@ -71,7 +71,7 @@ obj test : test.cpp : header3.h ; """) -t.run_build_system("-j2 test") +t.run_build_system(["-j2", "test"]) t.expect_addition("bin/$toolset/debug/header1.h") t.expect_addition("bin/$toolset/debug/header2.h") t.expect_addition("bin/$toolset/debug/header3.h") @@ -121,7 +121,7 @@ obj test : test.cpp : header3.h ; """) -t.run_build_system("-j2 test") +t.run_build_system(["-j2", "test"]) t.expect_addition("bin/$toolset/debug/header1.h") t.expect_addition("bin/$toolset/debug/header2.h") t.expect_addition("bin/$toolset/debug/header3.h") @@ -183,7 +183,7 @@ make header3.h : header3.in : @copy ; exe test : test2.cpp test1.cpp : header3.h ; """) -t.run_build_system("-j2 test") +t.run_build_system(["-j2", "test"]) t.expect_addition("bin/$toolset/debug/header3.h") t.expect_addition("bin/$toolset/debug/test1.obj") t.expect_addition("bin/$toolset/debug/test2.obj") @@ -191,7 +191,7 @@ t.expect_addition("bin/$toolset/debug/test.exe") t.expect_nothing_more() t.touch("header3.in") -t.run_build_system("-j2 test") +t.run_build_system(["-j2", "test"]) t.expect_touch("bin/$toolset/debug/header3.h") t.expect_touch("bin/$toolset/debug/test1.obj") t.expect_touch("bin/$toolset/debug/test2.obj") @@ -255,7 +255,7 @@ make header2.h : header2.in : @copy ; exe test : test2.cpp test1.cpp : header2.h . ; """) -t.run_build_system("-j2 test") +t.run_build_system(["-j2", "test"]) t.expect_addition("bin/$toolset/debug/header2.h") t.expect_addition("bin/$toolset/debug/test1.obj") t.expect_addition("bin/$toolset/debug/test2.obj") diff --git a/v2/test/resolution.py b/v2/test/resolution.py index eeb8647a6..c0132b611 100644 --- a/v2/test/resolution.py +++ b/v2/test/resolution.py @@ -27,7 +27,7 @@ t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.obj") t.touch("hello.cpp") -t.run_build_system("s") +t.run_build_system(["s"]) # If 'hello' in the 's' target resolved to file in the current dir, nothing # will be rebuilt. t.expect_touch("bin/$toolset/debug/hello.obj") diff --git a/v2/test/searched_lib.py b/v2/test/searched_lib.py index 81e976a1e..e56fcbd3a 100644 --- a/v2/test/searched_lib.py +++ b/v2/test/searched_lib.py @@ -64,7 +64,7 @@ __declspec(dllexport) helper() { foo(); } """) -t.run_build_system("-d2") +t.run_build_system(["-d2"]) t.expect_addition("bin/$toolset/debug/main.exe") t.rm("bin/$toolset/debug/main.exe") @@ -142,7 +142,7 @@ lib l : : l_d debug ; lib l : : l_r release ; """) -t.run_build_system("-n") +t.run_build_system(["-n"]) # A regression test. Two virtual target with the same properties were created @@ -157,7 +157,7 @@ static-lib a : a.cpp l ; lib l : : l_f ; """) -t.run_build_system("-n") +t.run_build_system(["-n"]) # Make sure plain "lib foobar ; " works. @@ -166,7 +166,7 @@ exe a : a.cpp foobar ; lib foobar ; """) -t.run_build_system("-n -d2") +t.run_build_system(["-n", "-d2"]) t.fail_test(string.find(t.stdout(), "foobar") == -1) @@ -176,7 +176,7 @@ exe a : a.cpp foo bar ; lib foo bar ; """) -t.run_build_system("-n -d2") +t.run_build_system(["-n", "-d2"]) t.fail_test(string.find(t.stdout(), "foo") == -1) t.fail_test(string.find(t.stdout(), "bar") == -1) diff --git a/v2/test/skipping.py b/v2/test/skipping.py index fa82e9a0c..6d9394808 100644 --- a/v2/test/skipping.py +++ b/v2/test/skipping.py @@ -22,6 +22,6 @@ exe b : b.cpp : 2 ; exe c : c.cpp ; """) -t.run_build_system("foo=1") +t.run_build_system(["foo=1"]) t.cleanup() diff --git a/v2/test/sort_rule.py b/v2/test/sort_rule.py index 26d61d48a..85faf66b3 100755 --- a/v2/test/sort_rule.py +++ b/v2/test/sort_rule.py @@ -19,7 +19,7 @@ import BoostBuild def testSORTCorrectness(): """Testing that Boost Jam's SORT builtin rule actually sorts correctly.""" - t = BoostBuild.Tester("-ftest.jam -d1", pass_toolset=False, + t = BoostBuild.Tester(["-ftest.jam", "-d1"], pass_toolset=False, use_test_config=False) t.write("test.jam", """\ @@ -59,7 +59,7 @@ def testSORTDuration(): quadratic behaviour again in this use case. """ - t = BoostBuild.Tester("-ftest.jam -d1", pass_toolset=False, + t = BoostBuild.Tester(["-ftest.jam", "-d1"], pass_toolset=False, use_test_config=False) f = open(t.workpath("test.jam"), "w") diff --git a/v2/test/space_in_path.py b/v2/test/space_in_path.py index 593795c47..c93e7357a 100755 --- a/v2/test/space_in_path.py +++ b/v2/test/space_in_path.py @@ -8,12 +8,6 @@ import BoostBuild -class unsplit(object): - def __init__(self, value): - self.value = value - def split(self, ignored): - return self.value - t = BoostBuild.Tester() t.write("has space/jamroot.jam", """\ @@ -22,6 +16,6 @@ unit-test test : test.cpp ; """) t.write("has space/test.cpp", "int main() {}\n") -t.run_build_system(unsplit(["has space"])) +t.run_build_system(["has space"]) t.cleanup() diff --git a/v2/test/stage.py b/v2/test/stage.py index 9de8c2494..1e184054e 100644 --- a/v2/test/stage.py +++ b/v2/test/stage.py @@ -50,7 +50,7 @@ stage dist : a : debug:ds release:rs ; t.run_build_system() t.expect_addition("ds/a.dll") -t.run_build_system("release") +t.run_build_system(["release"]) t.expect_addition("rs/a.dll") @@ -141,7 +141,7 @@ stage a2 : a2.txt : dist a1 ; """) t.write("a1.txt", "") t.write("a2.txt", "") -t.run_build_system("a2") +t.run_build_system(["a2"]) t.expect_addition(["dist/a1.txt", "dist/a2.txt"]) # Regression test: check that . works. diff --git a/v2/test/startup_v2.py b/v2/test/startup_v2.py index 0f9c50bc8..2dd867a1d 100644 --- a/v2/test/startup_v2.py +++ b/v2/test/startup_v2.py @@ -84,7 +84,7 @@ r"""Unable to load Boost.Build However, it failed to call the "boost-build" rule""") # Test bootstrapping based on BOOST_BUILD_PATH. -t.run_build_system("-sBOOST_BUILD_PATH=../boost-root/build", +t.run_build_system(["-sBOOST_BUILD_PATH=../boost-root/build"], subdir="bootstrap-env", stdout="build system bootstrapped") # Test bootstrapping based on an explicit path in boost-build.jam. diff --git a/v2/test/static_and_shared_library.py b/v2/test/static_and_shared_library.py index 7dda5d429..f37c342b5 100755 --- a/v2/test/static_and_shared_library.py +++ b/v2/test/static_and_shared_library.py @@ -24,13 +24,13 @@ t.expect_addition("lib/bin/$toolset/debug/" * BoostBuild.List("c.obj " t.expect_nothing_more() reset() -t.run_build_system("link=shared", subdir="lib") +t.run_build_system(["link=shared"], subdir="lib") t.expect_addition("lib/bin/$toolset/debug/" * BoostBuild.List("c.obj " "auxilliary1.lib auxilliary2.dll")) t.expect_nothing_more() reset() -t.run_build_system("link=static", subdir="lib") +t.run_build_system(["link=static"], subdir="lib") t.expect_addition("lib/bin/$toolset/debug/link-static/" * BoostBuild.List( "c.obj auxilliary1.lib auxilliary2.lib")) t.expect_nothing_more() diff --git a/v2/test/tag.py b/v2/test/tag.py index a7779cfa0..c42e511c9 100644 --- a/v2/test/tag.py +++ b/v2/test/tag.py @@ -98,12 +98,12 @@ __declspec (dllexport) void x () {} BoostBuild.List("bin/$toolset/release/link-static/b_rt.lib") + BoostBuild.List("c/a_rt.exe")) - variants = "debug release link=static,shared" + variants = ["debug", "release", "link=static,shared"] t.run_build_system(variants) t.expect_addition(file_list) - t.run_build_system(variants + " clean") + t.run_build_system(variants + ["clean"]) t.expect_removal(file_list) diff --git a/v2/test/test_rc.py b/v2/test/test_rc.py index 664059e11..570289338 100755 --- a/v2/test/test_rc.py +++ b/v2/test/test_rc.py @@ -31,9 +31,10 @@ def included_resource_newer_than_rc_script(): # Disable reading any external Boost Build configuration. This test is # self sufficient so these options protect it from being adversly # affected by any local (mis)configuration.. - t = BoostBuild.Tester("-d4 --debug-configuration --ignore-site-config " - "--user-config= toolset=%s" % toolsetName, pass_d0=False, - pass_toolset=False, use_test_config=False, translate_suffixes=False) + t = BoostBuild.Tester(["-d4", "--debug-configuration", + "--ignore-site-config", "--user-config=", "toolset=%s" % toolsetName], + pass_d0=False, pass_toolset=False, use_test_config=False, + translate_suffixes=False) # Prepare a dummy toolset so we do not get errors in case the default one # is not found and that we can test rc.jam functionality without having to @@ -84,7 +85,7 @@ obj xxx : xxx.rc ; if noexec: params.append("-n") params.append("-sNOEXEC=NOEXEC") - t.run_build_system(" ".join(params)) + t.run_build_system(params) t.expect_output_line("*NOEXEC*", noexec) obj_file = "xxx_res.obj" t.expect_output_line("compile.resource.dummy *%s" % obj_file, expect) diff --git a/v2/test/test_result_dumping.py b/v2/test/test_result_dumping.py index 9c8604fb2..fb9ca439b 100755 --- a/v2/test/test_result_dumping.py +++ b/v2/test/test_result_dumping.py @@ -16,7 +16,7 @@ import BoostBuild # ############################################################################### -t = BoostBuild.Tester("--dump-tests") +t = BoostBuild.Tester(["--dump-tests"]) t.write("TestBuild/jamroot.jam", """\ import testing ; diff --git a/v2/test/timedata.py b/v2/test/timedata.py index 440113e23..5484a6bad 100644 --- a/v2/test/timedata.py +++ b/v2/test/timedata.py @@ -83,8 +83,8 @@ bar +user: [0-9\.]+ +system: +[0-9\.]+ * \.\.\.updated 2 targets\.\.\.$ """ - t.run_build_system("-ffile.jam -d+1", stdout=expected_output, match=lambda - actual, expected: re.search(expected, actual, re.DOTALL)) + t.run_build_system(["-ffile.jam", "-d+1"], stdout=expected_output, + match=lambda actual, expected: re.search(expected, actual, re.DOTALL)) t.expect_addition("foo") t.expect_addition("bar") t.expect_nothing_more() diff --git a/v2/test/unit_test.py b/v2/test/unit_test.py index 94575ad31..0da693c58 100644 --- a/v2/test/unit_test.py +++ b/v2/test/unit_test.py @@ -30,7 +30,7 @@ __declspec(dllexport) helper() {} """) -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("bin/$toolset/debug/link-static/test.passed") t.cleanup() diff --git a/v2/test/unit_tests.py b/v2/test/unit_tests.py index a9899a0c9..705764b6b 100644 --- a/v2/test/unit_tests.py +++ b/v2/test/unit_tests.py @@ -7,5 +7,5 @@ import BoostBuild t = BoostBuild.Tester(pass_toolset=0) -t.run_build_system("--debug --build-system=test/test") +t.run_build_system(["--debug", "--build-system=test/test"]) t.cleanup() diff --git a/v2/test/unused.py b/v2/test/unused.py index e860b4ae4..290d2c685 100644 --- a/v2/test/unused.py +++ b/v2/test/unused.py @@ -19,11 +19,11 @@ t.run_build_system() # easy to check if a warning was issued or not. t.run_build_system(stdout="") -t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1", stdout="") +t.run_build_system(["-sGENERATE_ONLY_UNUSABLE=1"], stdout="") # Now check that even if main target generates nothing, its usage requirements # are still propagated to dependants. t.write("a.cpp", "int main() {}\n") -t.run_build_system("-sGENERATE_NOTHING=1") +t.run_build_system(["-sGENERATE_NOTHING=1"]) t.cleanup() diff --git a/v2/test/use_requirements.py b/v2/test/use_requirements.py index 61f45c9ca..8c445dd35 100644 --- a/v2/test/use_requirements.py +++ b/v2/test/use_requirements.py @@ -51,7 +51,7 @@ int main() { foo(); } """) t.run_build_system() -t.run_build_system("--clean") +t.run_build_system(["--clean"]) # Test that use requirements on main target work, when they are referred using @@ -78,7 +78,7 @@ int main() {} """) t.run_build_system() -t.run_build_system("--clean") +t.run_build_system(["--clean"]) # Test that usage requirements on a project work. @@ -132,7 +132,7 @@ foo() {} """) t.run_build_system() -t.run_build_system("--clean") +t.run_build_system(["--clean"]) # Test that we correctly handle dependency features in usage requirements on @@ -170,7 +170,7 @@ must_export_something; """) t.run_build_system() -t.run_build_system("--clean") +t.run_build_system(["--clean"]) # Test correct handling of dependency features in project requirements. @@ -249,7 +249,7 @@ __declspec(dllexport) foo() {} """) -t.run_build_system("link=static") +t.run_build_system(["link=static"]) t.expect_addition("libs/bin/$toolset/debug/link-static/a_d.obj")