2
0
mirror of https://github.com/boostorg/build.git synced 2026-01-19 16:12:14 +00:00
Files
build/test/core_update_now.py
Rene Rivera 6c1a6557b0 Add list of failed and skipped targets to tail summary.
This expands out the failed and skipped summary tail lines to also include a sorted list of action and targets of the corresponding failed and skipped targets. This makes it easier to see them and to further search for individual ones in teh rest of the output. It also makes it possible to quickly retry specific targets.

fixes #196
2024-03-06 08:39:42 -06:00

402 lines
6.1 KiB
Python
Executable File

#!/usr/bin/env python3
# Copyright 2011 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
import BoostBuild
import os
def basic():
t = BoostBuild.Tester(pass_toolset=0)
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)
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)
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...
fail target1
...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)
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)
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()
def return_status():
"""
Make sure that UPDATE_NOW returns a failure status if
the target failed in a previous call to UPDATE_NOW
"""
t = BoostBuild.Tester(pass_toolset=0)
t.write("file.jam", """\
actions fail
{
exit 1
}
NOTFILE target1 ;
ALWAYS target1 ;
fail target1 ;
ECHO "update1:" [ UPDATE_NOW target1 ] ;
ECHO "update2:" [ UPDATE_NOW target1 ] ;
DEPENDS all : target1 ;
""")
t.run_build_system(["-ffile.jam"], status=1, stdout="""\
...found 1 target...
...updating 1 target...
fail target1
exit 1
...failed fail target1...
...failed updating 1 target...
fail target1
update1:
update2:
...found 1 target...
""")
t.cleanup()
def save_restore():
"""Tests that ignore-minus-n and ignore-minus-q are
local to the call to UPDATE_NOW"""
t = BoostBuild.Tester(pass_toolset=0)
t.write("actions.jam", """\
rule fail
{
NOTFILE $(<) ;
ALWAYS $(<) ;
}
actions fail
{
exit 1
}
rule pass
{
NOTFILE $(<) ;
ALWAYS $(<) ;
}
actions pass
{
echo updating $(<)
}
""")
t.write("file.jam", """
include actions.jam ;
fail target1 ;
fail target2 ;
UPDATE_NOW target1 target2 : : $(IGNORE_MINUS_N) : $(IGNORE_MINUS_Q) ;
fail target3 ;
fail target4 ;
UPDATE_NOW target3 target4 ;
UPDATE ;
""")
t.run_build_system(['-n', '-sIGNORE_MINUS_N=1', '-ffile.jam'],
stdout='''...found 2 targets...
...updating 2 targets...
fail target1
exit 1
...failed fail target1...
fail target2
exit 1
...failed fail target2...
...failed updating 2 targets...
fail target1
fail target2
...found 2 targets...
...updating 2 targets...
fail target3
exit 1
fail target4
exit 1
...updated 2 targets...
''')
t.run_build_system(['-q', '-sIGNORE_MINUS_N=1', '-ffile.jam'],
status=1, stdout='''...found 2 targets...
...updating 2 targets...
fail target1
exit 1
...failed fail target1...
...failed updating 1 target...
fail target1
...found 2 targets...
...updating 2 targets...
fail target3
exit 1
...failed fail target3...
...failed updating 1 target...
fail target3
''')
t.run_build_system(['-n', '-sIGNORE_MINUS_Q=1', '-ffile.jam'],
stdout='''...found 2 targets...
...updating 2 targets...
fail target1
exit 1
fail target2
exit 1
...updated 2 targets...
...found 2 targets...
...updating 2 targets...
fail target3
exit 1
fail target4
exit 1
...updated 2 targets...
''')
t.run_build_system(['-q', '-sIGNORE_MINUS_Q=1', '-ffile.jam'],
status=1, stdout='''...found 2 targets...
...updating 2 targets...
fail target1
exit 1
...failed fail target1...
fail target2
exit 1
...failed fail target2...
...failed updating 2 targets...
fail target1
fail target2
...found 2 targets...
...updating 2 targets...
fail target3
exit 1
...failed fail target3...
...failed updating 1 target...
fail target3
''')
t.cleanup()
basic()
ignore_minus_n()
failed_target()
missing_target()
build_once()
return_status()
save_restore()