From 5bce542c2c367cbef5420d803546ad67cee29ae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurko=20Gospodneti=C4=87?= Date: Sat, 23 Jun 2012 23:07:29 +0000 Subject: [PATCH] Minor stylistic changes in Boost Build tests. [SVN r79035] --- v2/test/BoostBuild.py | 17 ++++++++-------- v2/test/core_parallel_actions.py | 21 ++++++++++---------- v2/test/core_parallel_multifile_actions_1.py | 18 ++++++++--------- v2/test/core_parallel_multifile_actions_2.py | 18 ++++++++--------- 4 files changed, 38 insertions(+), 36 deletions(-) diff --git a/v2/test/BoostBuild.py b/v2/test/BoostBuild.py index 3a50438d1..c6701a6ef 100644 --- a/v2/test/BoostBuild.py +++ b/v2/test/BoostBuild.py @@ -218,7 +218,8 @@ class Tester(TestCmd.TestCmd): self.original_workdir = os.getcwd() if workdir != '' and not os.path.isabs(workdir): - raise "Parameter workdir <"+workdir+"> must point to an absolute directory: " + raise ("Parameter workdir <%s> must point to an absolute " + "directory: " % workdir) self.last_build_time_start = 0 self.last_build_time_finish = 0 @@ -238,8 +239,10 @@ class Tester(TestCmd.TestCmd): elif (os.name == 'posix') and os.__dict__.has_key('uname'): if os.uname()[0].lower().startswith('cygwin'): jam_build_dir = "bin.cygwinx86" - if 'TMP' in os.environ and os.environ['TMP'].find('~') != -1: - print 'Setting $TMP to /tmp to get around problem with short path names' + if ('TMP' in os.environ and + os.environ['TMP'].find('~') != -1): + print('Setting $TMP to /tmp to get around problem ' + 'with short path names') os.environ['TMP'] = '/tmp' elif os.uname()[0] == 'Linux': cpu = os.uname()[4] @@ -270,8 +273,7 @@ class Tester(TestCmd.TestCmd): # Find where jam_src is located. Try for the debug version if it is # lying around. dirs = [os.path.join('../engine', jam_build_dir + '.debug'), - os.path.join('../engine', jam_build_dir), - ] + os.path.join('../engine', jam_build_dir)] for d in dirs: if os.path.exists(d): jam_build_dir = d @@ -420,8 +422,7 @@ class Tester(TestCmd.TestCmd): os.chdir(self.workdir) def expand_toolset(self, name): - """Expands $toolset in the given file to tested toolset. - """ + """Expands $toolset in the given file to tested toolset.""" content = self.read(name) content = string.replace(content, "$toolset", self.toolset) self.write(name, content) @@ -790,7 +791,7 @@ class Tester(TestCmd.TestCmd): self.fail_test(1) def maybe_do_diff(self, actual, expected): - if os.environ.has_key("DO_DIFF") and os.environ["DO_DIFF"] != '': + if os.environ.get("DO_DIFF"): e = tempfile.mktemp("expected") a = tempfile.mktemp("actual") open(e, "w").write(expected) diff --git a/v2/test/core_parallel_actions.py b/v2/test/core_parallel_actions.py index dedf9b118..eed1d0a79 100755 --- a/v2/test/core_parallel_actions.py +++ b/v2/test/core_parallel_actions.py @@ -2,23 +2,23 @@ # Copyright 2006 Rene Rivera. # Copyright 2011 Steven Watanabe -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) -t.write("sleep.bat","""@setlocal -@echo off +t.write("sleep.bat", """\ +@setlocal @REM timeout /T %1 /NOBREAK >nul -ping 127.0.0.1 -n 2 -w 1000 >nul -ping 127.0.0.1 -n %1 -w 1000 >nul +@ping 127.0.0.1 -n 2 -w 1000 >nul +@ping 127.0.0.1 -n %1 -w 1000 >nul @endlocal @exit /B 0 """) -t.write("file.jam", """ +t.write("file.jam", """\ if $(NT) { actions sleeper @@ -43,12 +43,12 @@ echo "[$(<:S)] 2" 1>&2 sleep $(<:B) } } - + rule sleeper { DEPENDS $(<) : $(>) ; } - + NOTFILE front ; sleeper 1.a : front ; sleeper 2.a : front ; @@ -64,7 +64,8 @@ sleep $(<:B) DEPENDS all : bottom ; """) -t.run_build_system("-ffile.jam -j4", stdout="""...found 12 targets... +t.run_build_system("-ffile.jam -j4", stdout="""\ +...found 12 targets... ...updating 8 targets... sleeper 1.a [.a] 0 diff --git a/v2/test/core_parallel_multifile_actions_1.py b/v2/test/core_parallel_multifile_actions_1.py index 9d995dbca..68d446b99 100755 --- a/v2/test/core_parallel_multifile_actions_1.py +++ b/v2/test/core_parallel_multifile_actions_1.py @@ -2,24 +2,23 @@ # Copyright 2007 Rene Rivera. # Copyright 2011 Steven Watanabe -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) import BoostBuild t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) -t.write("sleep.bat","""@setlocal -@echo off +t.write("sleep.bat", """\ +@setlocal @REM timeout /T %1 /NOBREAK >nul -ping 127.0.0.1 -n 2 -w 1000 >nul -ping 127.0.0.1 -n %1 -w 1000 >nul +@ping 127.0.0.1 -n 2 -w 1000 >nul +@ping 127.0.0.1 -n %1 -w 1000 >nul @endlocal @exit /B 0 """) -t.write("file.jam", """ - +t.write("file.jam", """\ if $(NT) { SLEEP = @call sleep.bat ; @@ -53,7 +52,8 @@ echo 004 DEPENDS all : u1.user u2.user ; """) -t.run_build_system("-ffile.jam -j2", stdout="""...found 6 targets... +t.run_build_system("-ffile.jam -j2", stdout="""\ +...found 6 targets... ...updating 4 targets... .gen. g1.generated 001 diff --git a/v2/test/core_parallel_multifile_actions_2.py b/v2/test/core_parallel_multifile_actions_2.py index aae0fe26e..fb9e8213a 100755 --- a/v2/test/core_parallel_multifile_actions_2.py +++ b/v2/test/core_parallel_multifile_actions_2.py @@ -2,8 +2,8 @@ # Copyright 2008 Jurko Gospodnetic, Vladimir Prus # Copyright 2011 Steven Watanabe -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) # Added to guard against a bug causing targets to be used before they # themselves have finished building. This used to happen for targets built by a @@ -21,17 +21,16 @@ import BoostBuild t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) -t.write("sleep.bat","""@setlocal -@echo off +t.write("sleep.bat", """\ +@setlocal @REM timeout /T %1 /NOBREAK >nul -ping 127.0.0.1 -n 2 -w 1000 >nul -ping 127.0.0.1 -n %1 -w 1000 >nul +@ping 127.0.0.1 -n 2 -w 1000 >nul +@ping 127.0.0.1 -n %1 -w 1000 >nul @endlocal @exit /B 0 """) -t.write("file.jam", """ - +t.write("file.jam", """\ if $(NT) { SLEEP = @call sleep.bat ; @@ -60,7 +59,8 @@ t.write("file.jam", """ DEPENDS all : lib installed_dll ; """) -t.run_build_system("-ffile.jam -j2", stdout="""...found 4 targets... +t.run_build_system("-ffile.jam -j2", stdout="""\ +...found 4 targets... ...updating 3 targets... link dll 001 - linked