mirror of
https://github.com/boostorg/build.git
synced 2026-02-13 12:22:17 +00:00
Related changes: * BoostBuild.Tester & TestCmd.TestCmd interfaces now accept external process parameters as a list of strings, thus avoiding problems with parsing arguments containing spaces. * Avoided a potential process hang in case an external process being run prints out enough output to fill up the OS's pipe buffer (OS would pause the process until someone read the data from the pipe but the testing framework would not do this until the process in question had terminated). [SVN r79448]
202 lines
3.2 KiB
Python
Executable File
202 lines
3.2 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
# 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)
|
|
|
|
import BoostBuild
|
|
import os
|
|
|
|
|
|
def basic():
|
|
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
|
|
|
|
t.write("file.jam", """\
|
|
actions do-print
|
|
{
|
|
echo updating $(<)
|
|
}
|
|
|
|
NOTFILE target1 ;
|
|
ALWAYS target1 ;
|
|
do-print target1 ;
|
|
|
|
UPDATE_NOW target1 ;
|
|
|
|
DEPENDS all : target1 ;
|
|
""")
|
|
|
|
t.run_build_system(["-ffile.jam"], stdout="""\
|
|
...found 1 target...
|
|
...updating 1 target...
|
|
do-print target1
|
|
updating target1
|
|
...updated 1 target...
|
|
...found 1 target...
|
|
""")
|
|
|
|
t.cleanup()
|
|
|
|
|
|
def ignore_minus_n():
|
|
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
|
|
|
|
t.write("file.jam", """\
|
|
actions do-print
|
|
{
|
|
echo updating $(<)
|
|
}
|
|
|
|
NOTFILE target1 ;
|
|
ALWAYS target1 ;
|
|
do-print target1 ;
|
|
|
|
UPDATE_NOW target1 : : ignore-minus-n ;
|
|
|
|
DEPENDS all : target1 ;
|
|
""")
|
|
|
|
t.run_build_system(["-ffile.jam", "-n"], stdout="""\
|
|
...found 1 target...
|
|
...updating 1 target...
|
|
do-print target1
|
|
|
|
echo updating target1
|
|
|
|
updating target1
|
|
...updated 1 target...
|
|
...found 1 target...
|
|
""")
|
|
|
|
t.cleanup()
|
|
|
|
|
|
def failed_target():
|
|
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
|
|
|
|
t.write("file.jam", """\
|
|
actions fail
|
|
{
|
|
exit 1
|
|
}
|
|
|
|
NOTFILE target1 ;
|
|
ALWAYS target1 ;
|
|
fail target1 ;
|
|
|
|
actions do-print
|
|
{
|
|
echo updating $(<)
|
|
}
|
|
|
|
NOTFILE target2 ;
|
|
do-print target2 ;
|
|
DEPENDS target2 : target1 ;
|
|
|
|
UPDATE_NOW target1 : : ignore-minus-n ;
|
|
|
|
DEPENDS all : target1 target2 ;
|
|
""")
|
|
|
|
t.run_build_system(["-ffile.jam", "-n"], stdout="""\
|
|
...found 1 target...
|
|
...updating 1 target...
|
|
fail target1
|
|
|
|
exit 1
|
|
|
|
...failed fail target1...
|
|
...failed updating 1 target...
|
|
...found 2 targets...
|
|
...updating 1 target...
|
|
do-print target2
|
|
|
|
echo updating target2
|
|
|
|
...updated 1 target...
|
|
""")
|
|
|
|
t.cleanup()
|
|
|
|
|
|
def missing_target():
|
|
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
|
|
|
|
t.write("file.jam", """\
|
|
actions do-print
|
|
{
|
|
echo updating $(<)
|
|
}
|
|
|
|
NOTFILE target2 ;
|
|
do-print target2 ;
|
|
DEPENDS target2 : target1 ;
|
|
|
|
UPDATE_NOW target1 : : ignore-minus-n ;
|
|
|
|
DEPENDS all : target1 target2 ;
|
|
""")
|
|
|
|
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...
|
|
...found 2 targets...
|
|
...can't make 1 target...
|
|
""")
|
|
|
|
t.cleanup()
|
|
|
|
|
|
def build_once():
|
|
"""
|
|
Make sure that if we call UPDATE_NOW with ignore-minus-n, the target gets
|
|
updated exactly once regardless of previous calls to UPDATE_NOW with -n in
|
|
effect.
|
|
|
|
"""
|
|
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
|
|
|
|
t.write("file.jam", """\
|
|
actions do-print
|
|
{
|
|
echo updating $(<)
|
|
}
|
|
|
|
NOTFILE target1 ;
|
|
ALWAYS target1 ;
|
|
do-print target1 ;
|
|
|
|
UPDATE_NOW target1 ;
|
|
UPDATE_NOW target1 : : ignore-minus-n ;
|
|
UPDATE_NOW target1 : : ignore-minus-n ;
|
|
|
|
DEPENDS all : target1 ;
|
|
""")
|
|
|
|
t.run_build_system(["-ffile.jam", "-n"], stdout="""\
|
|
...found 1 target...
|
|
...updating 1 target...
|
|
do-print target1
|
|
|
|
echo updating target1
|
|
|
|
...updated 1 target...
|
|
do-print target1
|
|
|
|
echo updating target1
|
|
|
|
updating target1
|
|
...updated 1 target...
|
|
...found 1 target...
|
|
""")
|
|
|
|
t.cleanup()
|
|
|
|
|
|
basic()
|
|
ignore_minus_n()
|
|
failed_target()
|
|
missing_target()
|
|
build_once()
|