2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00

Minor stylistic changes in Boost Build tests.

[SVN r79035]
This commit is contained in:
Jurko Gospodnetić
2012-06-23 23:07:29 +00:00
parent a810fcf5eb
commit 5bce542c2c
4 changed files with 38 additions and 36 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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