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

Integrate the tests in test/engine/ into the Python test scripts.

[SVN r75834]
This commit is contained in:
Steven Watanabe
2011-12-07 02:43:29 +00:00
parent 462b5b9639
commit 481bc03561
24 changed files with 426 additions and 655 deletions

View File

@@ -206,7 +206,7 @@ class Tester(TestCmd.TestCmd):
def __init__(self, arguments="", 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="", **keywords):
ignore_toolset_requirements=True, workdir="", pass_d0=True, **keywords):
self.original_workdir = os.getcwd()
if workdir != '' and not os.path.isabs(workdir):
@@ -273,6 +273,8 @@ class Tester(TestCmd.TestCmd):
sys.exit(1)
verbosity = ['-d0', '--quiet']
if not pass_d0:
verbosity = []
if '--verbose' in sys.argv:
keywords['verbose'] = True
verbosity = ['-d+2']

27
v2/test/core_action_status.py Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/python
# 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)
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0)
t.write("file.jam", """
actions quietly .a. { $(ACTION) }
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
DEPENDS all : subtest_a ;
""")
t.run_build_system("-ffile.jam -sACTION=invalid", status=1)
t.cleanup()

View File

@@ -1,12 +1,34 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
#!/usr/bin/python
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing \"actions quietly\"... ;
# 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)
assert "...found 4 targets...
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0)
t.write("file.jam", """
actions quietly .a.
{
echo [$(<:B)] 0
echo [$(<:B)] 1
echo [$(<:B)] 2
}
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
""")
t.run_build_system("-ffile.jam -d2", stdout="""...found 4 targets...
...updating 2 targets...
.a. subtest_a
@@ -27,29 +49,11 @@ echo [subtest_b] 2
[subtest_b] 1
[subtest_b] 2
...updated 2 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f actions_quietly.jam -sBJAM_SUBTEST=1 -d2" ] ;
""")
assert "...found 4 targets...
t.run_build_system("-ffile.jam -d1", stdout="""...found 4 targets...
...updating 2 targets...
...updated 2 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f actions_quietly.jam -sBJAM_SUBTEST=1" ] ;
}
else
{
actions quietly .a.
{
echo [$(<:B)] 0
echo [$(<:B)] 1
echo [$(<:B)] 2
}
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
}
""")
t.cleanup()

View File

@@ -9,7 +9,10 @@ failed = 0 ;
rule show-result ( id : test-result )
{
ECHO $(test-result): $(id) ;
if ! ( --quiet in $(ARGV) )
{
ECHO $(test-result): $(id) ;
}
$(test-result) = [ CALC $($(test-result)) + 1 ] ;
}
@@ -57,6 +60,9 @@ local select1 = GU BL DBST ;
local case1 = L U ;
local vars = 7 8 ;
local sub = 2 1 ;
local p0 = name ;
local p1 = dir/name ;
local p2 = dir/sub/name ;
check-equal var-product : $(v1)$(v2) : 14 15 16 24 25 26 34 35 36 ;
@@ -74,6 +80,16 @@ check-equal var-dir : $(v6:D) : generic ;
check-equal var-member : $(v6:M) : (member.txt) ;
check-equal var-multi : $(v6:$(select1)) : <GRIST> path generic/path.txt ;
check-equal var-D=-0 : name : $(p0:D=) ;
check-equal var-D=-1 : name : $(p1:D=) ;
check-equal var-D=-2 : name : $(p2:D=) ;
check-equal var-D-0 : "" : $(p0:D) ;
check-equal var-D-1 : dir : $(p1:D) ;
check-equal var-D-2 : dir/sub : $(p2:D) ;
check-equal var-S-1 : "" : $(p0:S) ;
check-equal var-no-at-file-0 : ($(p0)) : [ MATCH ^@(.*) : "@($(p0))" ] ;
check-equal var-no-at-file-1 : ($(p0)) : [ MATCH @(.*) : "--@($(p0))" ] ;
if $(OS) = CYGWIN
{
local cyg-root = $(:WE=/) ;
@@ -158,22 +174,35 @@ check-equal var-subscript-range-empty : $(v3[4-3]) : ;
rule test-rule
{
return $(<) $(>) $(1) $(2) $(3) $(4) $(5) $(6) $(7) $(8) $(9) $(10) $(11) $(12) $(13) $(14) $(15) $(16) $(17) $(18) $(19) ;
return $(<) - $(>) - $(1) - $(2) - $(3) - $(4) - $(5) - $(6) - $(7) - $(8) - $(9) - $(10) - $(11) - $(12) - $(13) - $(14) - $(15) - $(16) - $(17) - $(18) - $(19) ;
}
check-equal rule-arguments :
check-equal rule-arguments-numbered :
[ test-rule a1 : a2 : a3 : a4 : a5 : a6 : a7 : a8 : a9 : a10 : a11 : a12 : a13 : a14 : a15 : a16 : a17 : a18 : a19 ] :
a1 a2 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 ;
a1 - a2 - a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 - a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 ;
rule test-rule
{
return $(<:L) $(>:L) $(1:L) $(2:L) $(3:L) $(4:L) $(5:L) $(6:L) $(7:L) $(8:L) $(9:L) $(10:L) $(11:L) $(12:L) $(13:L) $(14:L) $(15:L) $(16:L) $(17:L) $(18:L) $(19:L) ;
return $(<:L) - $(>:L) - $(1:L) - $(2:L) - $(3:L) - $(4:L) - $(5:L) - $(6:L) - $(7:L) - $(8:L) - $(9:L) - $(10:L) - $(11:L) - $(12:L) - $(13:L) - $(14:L) - $(15:L) - $(16:L) - $(17:L) - $(18:L) - $(19:L) ;
}
# behavior change
check-equal rule-arguments :
check-equal rule-arguments-numbered-lower :
[ test-rule a1 : a2 : a3 : a4 : a5 : a6 : a7 : a8 : a9 : a10 : a11 : a12 : a13 : a14 : a15 : a16 : a17 : a18 : a19 ] :
a1 a2 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 ;
a1 - a2 - a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 - a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 ;
rule test-rule ( p1 : p2 : p3 : p4 : p5 : p6 : p7 : p8 : p9 :
p10 : p11 : p12 : p13 : p14 : p15 : p16 : p17 : p18 : p19 )
{
return $(p1) - $(p2) - $(p3) - $(p4) - $(p5) - $(p6) - $(p7) - $(p8) - $(p9) - $(p10) - $(p11) - $(p12) - $(p13) - $(p14) - $(p15) - $(p16) - $(p17) - $(p18) - $(p19) ;
}
check-equal rule-arguments-named :
[ test-rule a1 : a2 : a3 : a4 : a5 : a6 : a7 : a8 : a9 : a10 : a11 : a12 : a13 : a14 : a15 : a16 : a17 : a18 : a19 ] :
a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 - a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 ;
}
@@ -1017,6 +1046,104 @@ check-equal while-result : [ test-rule ] : x ;
}
# Test NORMALIZE_PATH
{
check-equal normalize-path : "." : [ NORMALIZE_PATH ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "" ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "." ] ;
check-equal normalize-path : ".." : [ NORMALIZE_PATH ".." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "\\" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "//" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "\\\\" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "//\\\\//\\\\" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/./" ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "\\\\///.///\\\\\\" ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "./././././." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/./././././." ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo" ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo/" ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo\\" ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo\\\\/////" ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo\\\\/////././." ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo\\\\/////./././" ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo/.." ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo////.." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "///foo/\\\\/.." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "\\\\\\foo\\//\\.." ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo/./.." ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo/././././.." ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo/./././bar/./././.././././baz/./././.." ] ;
check-equal normalize-path : "/foo" : [ NORMALIZE_PATH "/foo/./././bar/./././.././././baz/./././.." ] ;
check-equal normalize-path : "foo" : [ NORMALIZE_PATH "foo/./././bar/./././////.././././baz/./././.." ] ;
check-equal normalize-path : "/foo" : [ NORMALIZE_PATH "/foo/./././bar/./././////.././././baz/./././.." ] ;
check-equal normalize-path : ".." : [ NORMALIZE_PATH "./.." ] ;
check-equal normalize-path : ".." : [ NORMALIZE_PATH "././././.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "../.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "./../.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "././././../.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "./.././././.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "././././.././././.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "..//\\\\\\//.." ] ;
check-equal normalize-path : "../.." : [ NORMALIZE_PATH "../..\\\\/\\\\" ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo/../bar/../baz/.." ] ;
check-equal normalize-path : "." : [ NORMALIZE_PATH "foo////..////bar////.//////.////../baz/.." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/foo/../bar/../baz/.." ] ;
check-equal normalize-path : "/" : [ NORMALIZE_PATH "/foo////..////bar////.//////.////../baz/.." ] ;
# Invalid rooted paths with leading dotdots.
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/../" ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "//\\\\//\\\\/.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "\\\\//\\\\//\\.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/../.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/../../.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/foo/bar/../baz/../../.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/../for/././../././bar/././../././.." ] ;
check-equal normalize-path-invalid : : [ NORMALIZE_PATH "/../foo/bar" ] ;
}
# Test W32_GETREGNAMES
{
if $(NT)
{
local sound = "Beep" "ExtendedSounds" ;
local r1 = [ W32_GETREGNAMES "HKEY_CURRENT_USER\\Control Panel\\Sound" : values ] ;
check-equal w32_getregnames : $(sound:L) : $(r1:L) ;
local r2 = [ W32_GETREGNAMES "HKCU\\Control Panel\\Sound" : values ] ;
check-equal w32_getregnames : $(sound:L) : $(r2:L) ;
local CurrentControlSet = "Control" "Enum" "Hardware Profiles" "Services" ;
local r3 = [ W32_GETREGNAMES "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet" : subkeys ] ;
check-equal w32_getregnames : $(CurrentControlSet:L) : $(r3:L) ;
local r4 = [ W32_GETREGNAMES "HKLM\\SYSTEM\\CurrentControlSet" : subkeys ] ;
check-equal w32_getregnames : $(CurrentControlSet:L) : $(r4:L) ;
}
}
# Test SHELL
{
local c = "echo value" ;
check-equal shell : "value\n" : [ SHELL $(c) ] ;
check-equal shell : "" : [ SHELL $(c) : no-output ] ;
check-equal shell : "value\n" 0 : [ SHELL $(c) : exit-status ] ;
check-equal shell : "" 0 : [ SHELL $(c) : no-output : exit-status ] ;
check-equal command : "value\n" : [ COMMAND $(c) ] ;
check-equal command : "" : [ COMMAND $(c) : no-output ] ;
check-equal command : "value\n" 0 : [ COMMAND $(c) : exit-status ] ;
check-equal command : "" 0 : [ COMMAND $(c) : no-output : exit-status ] ;
}
# Test summary
if $(failed) = 0

View File

@@ -1,12 +1,39 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
#!/usr/bin/python
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -d2 option... ;
# 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)
assert "...found 4 targets...
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
t.write("sleep.bat","""@setlocal
@echo off
timeout /T %1 /NOBREAK >nul
""")
t.write("file.jam", """
actions .a.
{
echo [$(<:B)] 0
echo [$(<:B)] 1
echo [$(<:B)] 2
}
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
""")
t.run_build_system("-ffile.jam -d2", stdout="""...found 4 targets...
...updating 2 targets...
.a. subtest_a
@@ -27,24 +54,6 @@ echo [subtest_b] 2
[subtest_b] 1
[subtest_b] 2
...updated 2 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f option_d2.jam -sBJAM_SUBTEST=1 -d2" ] ;
}
else
{
actions .a.
{
echo [$(<:B)] 0
echo [$(<:B)] 1
echo [$(<:B)] 2
}
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
}
""")
t.cleanup()

44
v2/test/core_option_l.py Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/python
# 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)
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0)
t.write("sleep.bat","""@setlocal
@echo off
timeout /T %1 /NOBREAK >nul
""")
t.write("file.jam", """
actions .a. {
echo 001
sleep 4
echo 002
}
.a. sleeper ;
DEPENDS all : sleeper ;
""")
t.run_build_system("-ffile.jam -d1 -l2", status=1, stdout="""...found 2 targets...
...updating 1 target...
.a. sleeper
2 second time limit exceeded
001
echo 001
sleep 4
echo 002
...failed .a. sleeper...
...failed updating 1 target...
""")
t.cleanup()

View File

@@ -1,30 +1,15 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
#!/usr/bin/python
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -n option... ;
# 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)
assert "...found 4 targets...
...updating 2 targets...
.a. subtest_a
import BoostBuild
echo [subtest_a] 0
echo [subtest_a] 1
echo [subtest_a] 2
.a. subtest_b
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
echo [subtest_b] 0
echo [subtest_b] 1
echo [subtest_b] 2
...updated 2 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f option_n.jam -sBJAM_SUBTEST=1 -n" ] ;
}
else
{
t.write("file.jam", """
actions .a.
{
echo [$(<:B)] 0
@@ -41,4 +26,23 @@ echo [$(<:B)] 2
.a. subtest_a : subtest ;
.a. subtest_b : subtest ;
DEPENDS all : subtest_a subtest_b ;
}
""")
t.run_build_system("-ffile.jam -n", stdout="""...found 4 targets...
...updating 2 targets...
.a. subtest_a
echo [subtest_a] 0
echo [subtest_a] 1
echo [subtest_a] 2
.a. subtest_b
echo [subtest_b] 0
echo [subtest_b] 1
echo [subtest_b] 2
...updated 2 targets...
""")
t.cleanup()

View File

@@ -1,50 +1,20 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
#!/usr/bin/python
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -jN parallel execution of actions... ;
# 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)
assert "...found 12 targets...
...updating 8 targets...
sleeper 1.a
[.a] 0
[.a] 1
[.a] 2
sleeper 2.a
[.a] 0
[.a] 1
[.a] 2
sleeper 3.a
[.a] 0
[.a] 1
[.a] 2
sleeper 4.a
[.a] 0
[.a] 1
[.a] 2
sleeper 1.b
[.b] 0
[.b] 1
[.b] 2
sleeper 2.b
[.b] 0
[.b] 1
[.b] 2
sleeper 3.b
[.b] 0
[.b] 1
[.b] 2
sleeper 4.b
[.b] 0
[.b] 1
[.b] 2
...updated 8 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f parallel_actions.jam -sBJAM_SUBTEST=1 -j4" ] ;
}
else
{
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
t.write("sleep.bat","""@setlocal
@echo off
timeout /T %1 /NOBREAK >nul
""")
t.write("file.jam", """
if $(NT)
{
actions sleeper
@@ -88,4 +58,43 @@ sleep $(<:B)
sleeper 4.b : choke ;
DEPENDS bottom : 1.b 2.b 3.b 4.b ;
DEPENDS all : bottom ;
}
""")
t.run_build_system("-ffile.jam -j4", stdout="""...found 12 targets...
...updating 8 targets...
sleeper 1.a
[.a] 0
[.a] 1
[.a] 2
sleeper 2.a
[.a] 0
[.a] 1
[.a] 2
sleeper 3.a
[.a] 0
[.a] 1
[.a] 2
sleeper 4.a
[.a] 0
[.a] 1
[.a] 2
sleeper 1.b
[.b] 0
[.b] 1
[.b] 2
sleeper 2.b
[.b] 0
[.b] 1
[.b] 2
sleeper 3.b
[.b] 0
[.b] 1
[.b] 2
sleeper 4.b
[.b] 0
[.b] 1
[.b] 2
...updated 8 targets...
""")
t.cleanup()

View File

@@ -1,25 +1,20 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
#!/usr/bin/python
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -jN parallel execution of multi-file actions - 1... ;
# 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)
assert "...found 6 targets...
...updating 4 targets...
.gen. g1.generated
001
002
.use.1 u1.user
003
.use.2 u2.user
004
...updated 4 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f parallel_multifile_actions_1.jam -sBJAM_SUBTEST=1 -j2" ] ;
}
else
{
import BoostBuild
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
t.write("sleep.bat","""@setlocal
@echo off
timeout /T %1 /NOBREAK >nul
""")
t.write("file.jam", """
actions .gen. {
echo 001
sleep 4
@@ -42,4 +37,18 @@ echo 004
NOTFILE root ;
DEPENDS g1.generated g2.generated : root ;
DEPENDS all : u1.user u2.user ;
}
""")
t.run_build_system("-ffile.jam -j2", stdout="""...found 6 targets...
...updating 4 targets...
.gen. g1.generated
001
002
.use.1 u1.user
003
.use.2 u2.user
004
...updated 4 targets...
""")
t.cleanup()

View File

@@ -1,6 +1,9 @@
#!/usr/bin/python
# Copyright 2008 Jurko Gospodnetic, Vladimir Prus
# 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)
# 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)
# 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
@@ -14,21 +17,16 @@
# while the action was still running, target A was already reporting as being
# built causing other targets depending on target A to be built prematurely.
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -jN parallel execution of multi-file actions - 2... ;
import BoostBuild
assert "...found 4 targets...
...updating 3 targets...
link dll
001 - linked
install installed_dll
002 - installed
...updated 3 targets...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f parallel_multifile_actions_2.jam -sBJAM_SUBTEST=1 -j2" ] ;
}
else
{
t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
t.write("sleep.bat","""@setlocal
@echo off
timeout /T %1 /NOBREAK >nul
""")
t.write("file.jam", """
actions link
{
sleep 1
@@ -46,4 +44,15 @@ else
DEPENDS installed_dll : dll ;
DEPENDS all : lib installed_dll ;
}
""")
t.run_build_system("-ffile.jam -j2", stdout="""...found 4 targets...
...updating 3 targets...
link dll
001 - linked
install installed_dll
002 - installed
...updated 3 targets...
""")
t.cleanup()

View File

@@ -1,5 +0,0 @@
This directory contains tests for the update engine of
Boost.Build. They presently are not integrated with
the Python based test system and must be run by
hand.

View File

@@ -1,28 +0,0 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing \"actions status results\"... ;
assert "" 0 : (==) : [ SHELL "\"$(ARGV[1])\" -f action_status.jam -sBJAM_SUBTEST=1" : exit-status : no-output ] ;
if $(NT)
{
assert "" 0 : (==) : [ SHELL "\"$(ARGV[1])\" -f action_status.jam -sBJAM_SUBTEST=1 \"-sACTION=;\"" : exit-status : no-output ] ;
}
assert "" 0 : (!=) : [ SHELL "\"$(ARGV[1])\" -f action_status.jam -sBJAM_SUBTEST=1 -sACTION=invalid" : exit-status : no-output ] ;
}
else
{
actions quietly .a. { $(ACTION) }
rule .a.
{
DEPENDS $(<) : $(>) ;
}
NOTFILE subtest ;
.a. subtest_a : subtest ;
DEPENDS all : subtest_a ;
}

View File

@@ -1,60 +0,0 @@
#~ Copyright 2008 Jurko Gospodnetic.
#~ 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)
ECHO --- Testing NORMALIZE_PATH builtin... ;
assert "." : (==) : [ NORMALIZE_PATH ] ;
assert "." : (==) : [ NORMALIZE_PATH "" ] ;
assert "." : (==) : [ NORMALIZE_PATH "." ] ;
assert ".." : (==) : [ NORMALIZE_PATH ".." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "\\" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "//" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "\\\\" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "//\\\\//\\\\" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/./" ] ;
assert "/" : (==) : [ NORMALIZE_PATH "\\\\///.///\\\\\\" ] ;
assert "." : (==) : [ NORMALIZE_PATH "./././././." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/./././././." ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo" ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo/" ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo\\" ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo\\\\/////" ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo\\\\/////././." ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo\\\\/////./././" ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo/.." ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo////.." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "///foo/\\\\/.." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "\\\\\\foo\\//\\.." ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo/./.." ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo/././././.." ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo/./././bar/./././.././././baz/./././.." ] ;
assert "/foo" : (==) : [ NORMALIZE_PATH "/foo/./././bar/./././.././././baz/./././.." ] ;
assert "foo" : (==) : [ NORMALIZE_PATH "foo/./././bar/./././////.././././baz/./././.." ] ;
assert "/foo" : (==) : [ NORMALIZE_PATH "/foo/./././bar/./././////.././././baz/./././.." ] ;
assert ".." : (==) : [ NORMALIZE_PATH "./.." ] ;
assert ".." : (==) : [ NORMALIZE_PATH "././././.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "../.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "./../.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "././././../.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "./.././././.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "././././.././././.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "..//\\\\\\//.." ] ;
assert "../.." : (==) : [ NORMALIZE_PATH "../..\\\\/\\\\" ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo/../bar/../baz/.." ] ;
assert "." : (==) : [ NORMALIZE_PATH "foo////..////bar////.//////.////../baz/.." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/foo/../bar/../baz/.." ] ;
assert "/" : (==) : [ NORMALIZE_PATH "/foo////..////bar////.//////.////../baz/.." ] ;
# Invalid rooted paths with leading dotdots.
assert : (==) : [ NORMALIZE_PATH "/.." ] ;
assert : (==) : [ NORMALIZE_PATH "/../" ] ;
assert : (==) : [ NORMALIZE_PATH "//\\\\//\\\\/.." ] ;
assert : (==) : [ NORMALIZE_PATH "\\\\//\\\\//\\.." ] ;
assert : (==) : [ NORMALIZE_PATH "/../.." ] ;
assert : (==) : [ NORMALIZE_PATH "/../../.." ] ;
assert : (==) : [ NORMALIZE_PATH "/foo/bar/../baz/../../.." ] ;
assert : (==) : [ NORMALIZE_PATH "/../for/././../././bar/././../././.." ] ;
assert : (==) : [ NORMALIZE_PATH "/../foo/bar" ] ;

View File

@@ -1,31 +0,0 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
# TODO: Here we should test for the Windows popen() command unquoting bug but
# that test will have to wait until a better testing framework is implemented.
# To reproduce the bug try executing any command with its first parameter quoted
# and containing spaces and having at least one other quote in the command
# string.
#
# For example:
#
# "\Long folder name\aaa.exe" --name="Jurko" --no-surname
#
# would get its outermost quotes stripped and would be executed as:
#
# \Long folder name\aaa.exe" --name="Jurko --no-surname
ECHO --- Testing SHELL builtin... ;
local c = "date" ;
if $(NT) { c = "PATH" ; }
assert "" : (!=) : [ SHELL $(c) ] ;
assert "" : (==) : [ SHELL $(c) : no-output ] ;
assert "" 0 : (!=) : [ SHELL $(c) : exit-status ] ;
assert "" 0 : (==) : [ SHELL $(c) : no-output : exit-status ] ;
assert "" : (!=) : [ COMMAND $(c) ] ;
assert "" : (==) : [ COMMAND $(c) : no-output ] ;
assert "" 0 : (!=) : [ COMMAND $(c) : exit-status ] ;
assert "" 0 : (==) : [ COMMAND $(c) : no-output : exit-status ] ;

View File

@@ -1,17 +0,0 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
ECHO --- Testing W32_GETREGNAMES builtin... ;
if $(NT)
{
assert "Beep" "ExtendedSounds"
: (==) : [ W32_GETREGNAMES "HKEY_CURRENT_USER\\Control Panel\\Sound" : values ] ;
assert "Beep" "ExtendedSounds"
: (==) : [ W32_GETREGNAMES "HKCU\\Control Panel\\Sound" : values ] ;
assert "Control" "Enum" "Hardware Profiles" "Services"
: (==) : [ W32_GETREGNAMES "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet" : subkeys ] ;
assert "Control" "Enum" "Hardware Profiles" "Services"
: (==) : [ W32_GETREGNAMES "HKLM\\SYSTEM\\CurrentControlSet" : subkeys ] ;
}

View File

@@ -1,34 +0,0 @@
#~ Copyright 2007 Rene Rivera.
#~ 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)
if ! $(BJAM_SUBTEST)
{
ECHO --- Testing -l option... ;
assert "...found 2 targets...
...updating 1 target...
.a. sleeper
2 second time limit exceeded
001
echo 001
sleep 4
echo 002
...failed .a. sleeper...
...failed updating 1 target...
" : (==) : [ SHELL "\"$(ARGV[1])\" -f option_l.jam -sBJAM_SUBTEST=1 -l2" ] ;
}
else
{
actions .a. {
echo 001
sleep 4
echo 002
}
.a. sleeper ;
DEPENDS all : sleeper ;
}

View File

@@ -1,60 +0,0 @@
#~ Copyright 2008 Jonathan Biggar
#~ 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)
ECHO -- Testing parameter passing... ;
rule test_numeric_params
{
assert $(1) : (==) : 1 ;
assert $(2) : (==) : 2 ;
assert $(3) : (==) : 3 ;
assert $(4) : (==) : 4 ;
assert $(5) : (==) : 5 ;
assert $(6) : (==) : 6 ;
assert $(7) : (==) : 7 ;
assert $(8) : (==) : 8 ;
assert $(9) : (==) : 9 ;
assert $(10) : (==) : 10 ;
assert $(11) : (==) : 11 ;
assert $(12) : (==) : 12 ;
assert $(13) : (==) : 13 ;
assert $(14) : (==) : 14 ;
assert $(15) : (==) : 15 ;
assert $(16) : (==) : 16 ;
assert $(17) : (==) : 17 ;
assert $(18) : (==) : 18 ;
assert $(19) : (==) : 19 ;
}
rule test_named_params ( p1 : p2 : p3 : p4 : p5 : p6 : p7 : p8 : p9 :
p10 : p11 : p12 : p13 : p14 : p15 : p16 : p17 : p18 : p19 )
{
assert $(p1) : (==) : 1 ;
assert $(p2) : (==) : 2 ;
assert $(p3) : (==) : 3 ;
assert $(p4) : (==) : 4 ;
assert $(p5) : (==) : 5 ;
assert $(p6) : (==) : 6 ;
assert $(p7) : (==) : 7 ;
assert $(p8) : (==) : 8 ;
assert $(p9) : (==) : 9 ;
assert $(p10) : (==) : 10 ;
assert $(p11) : (==) : 11 ;
assert $(p12) : (==) : 12 ;
assert $(p13) : (==) : 13 ;
assert $(p14) : (==) : 14 ;
assert $(p15) : (==) : 15 ;
assert $(p16) : (==) : 16 ;
assert $(p17) : (==) : 17 ;
assert $(p18) : (==) : 18 ;
assert $(p19) : (==) : 19 ;
}
test_numeric_params 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 :
10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 ;
test_named_params 1 : 2 : 3 : 4 : 5 : 6 : 7 : 8 : 9 :
10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : 18 : 19 ;

View File

@@ -1,14 +0,0 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
ECHO --- Testing var expansion... ;
local i = 0 ;
local v = one two ;
while $(i) != 4
{
i = [ CALC $(i) + 1 ] ;
v = $(v)$(v) ;
assert $(i) : (==) : $(i) ;
}

View File

@@ -1,16 +0,0 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
ECHO --- Testing var on target semantics... ;
v on a = 1 ;
v on b = 1 2 ;
v on c = 1 2 3 ;
v on d ?= 1 2 3 4 ;
v on d ?= 5 6 7 8 ;
v on a ?= 2 ;
assert [ on a return $(v) ] : (==) : 1 ;
assert [ on b return $(v) ] : (==) : 1 2 ;
assert [ on c return $(v) ] : (==) : 1 2 3 ;
assert [ on d return $(v) ] : (==) : 1 2 3 4 ;

View File

@@ -1,53 +0,0 @@
@ECHO OFF
REM ~ Copyright 2006-2008 Rene Rivera.
REM ~ Distributed under the Boost Software License, Version 1.0.
REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
REM ~ set BJAM=bjam
REM ~ set BJAM_SRC=..\src
REM ~ set BJAM_BIN=..\src\bin.ntx86\bjam.exe
setlocal
goto Start
:Test_Path
REM Tests for the given file(executable) presence in the directories in the PATH
REM environment variable. Additionaly sets FOUND_PATH to the path of the
REM found file.
setlocal & endlocal & ver>NUL
setlocal
set test=%~$PATH:1
endlocal
if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
goto :eof
:Guess_BJAM
setlocal & endlocal & ver>NUL
if NOT "_%BJAM%_" == "__" goto :eof
call :Test_Path bjam.exe
if not errorlevel 1 (
set BJAM=bjam.exe
goto :eof)
if "_%BJAM%_" == "__" (
set BJAM=%BJAM_BIN%
goto :eof)
setlocal & endlocal & ver>NUL
goto :eof
:Build_BJAM_To_Test
setlocal & endlocal & ver>NUL
if "_%BJAM_SRC%_" == "__" set BJAM_SRC=..\src
PUSHD %BJAM_SRC%
call build.bat
@ECHO OFF
POPD
set BJAM_BIN=%BJAM_SRC%\bin.ntx86\bjam.exe
setlocal & endlocal & ver>NUL
goto :eof
:Start
call :Build_BJAM_To_Test
call :Guess_BJAM
@ECHO ON
%BJAM% -f test.jam "-sBJAM=%BJAM_BIN%"

View File

@@ -1,91 +0,0 @@
#~ Copyright 2006-2008 Rene Rivera.
#~ 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)
TESTS =
action_status
actions_quietly
builtin_normalize_path
builtin_shell
builtin_w32_getregnames
option_d2
option_l
option_n
parallel_actions
parallel_multifile_actions_1
parallel_multifile_actions_2
rule_param
stress_var_expand
target_var
var_expand
;
BJAM ?= bjam ;
#############################################################################
if $(BJAM_RUN_TEST)
{
fail-count = 0 ;
pass-count = 0 ;
rule message ( message * )
{
local b = [ BACKTRACE ] ;
ECHO "$(b[-4]):$(b[-3]):" $(message) ;
}
rule fail ( message * )
{
fail-count = [ CALC $(fail-count) + 1 ] ;
message "error:" [FAILED] $(message) ;
}
rule pass ( message * )
{
pass-count = [ CALC $(pass-count) + 1 ] ;
if --verbose in $(ARGV)
{
message "info:" [PASSED] $(message) ;
}
}
rule assert ( expected * : test ? : obtained * )
{
test ?= "(==)" ;
local r = 0 ;
if $(test) = "(==)" && "*$(expected)*" != "*$(obtained)*"
{
fail '$(expected)' $(test) '$(obtained)' ;
}
else if $(test) = "(!=)" && "*$(expected)*" = "*$(obtained)*"
{
fail '$(expected)' $(test) '$(obtained)' ;
}
else
{
pass '$(expected)' $(test) '$(obtained)' ;
}
}
include $(BJAM_RUN_TEST).jam ;
EXIT --- $(BJAM_RUN_TEST): PASSED($(pass-count)) *FAILED($(fail-count))* : $(fail-count) ;
}
else
{
ECHO "Testing: $(BJAM)" ;
fail-count = 0 ;
for local test in $(TESTS)
{
local result = [ SHELL "\"$(BJAM)\" -f test.jam -sBJAM_RUN_TEST=$(test)" : exit-status ] ;
fail-count = [ CALC $(fail-count) + $(result[1]) ] ;
ECHO $(result[0]) ;
}
EXIT --- Complete: *FAILED($(fail-count))* : $(fail-count) ;
}

View File

@@ -1,53 +0,0 @@
#!/bin/sh
#~ Copyright 2006-2008 Rene Rivera.
#~ 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)
#~ BJAM=bjam
#~ BJAM_SRC=../src
#~ BJAM_BIN=`ls -1 ${BJAM_SRC}/bin.*/bjam`
# Run a command, and echo before doing so. Also checks the exit
# status and quits if there was an error.
echo_run ()
{
echo "$@"
$@
r=$?
if test $r -ne 0 ; then
exit $r
fi
}
# Check that a command is in the PATH.
test_path ()
{
if `command -v command 1>/dev/null 2>/dev/null`; then
command -v $1 1>/dev/null 2>/dev/null
else
hash $1 1>/dev/null 2>/dev/null
fi
}
Guess_BJAM ()
{
if test_path bjam ; then BJAM=bjam
elif test -r ./bjam ; then BJAM=./bjam
elif test -r "${BJAM_BIN}" ; then BJAM="${BJAM_BIN}"
fi
}
Build_BJAM_To_Test ()
{
cwd=`pwd`
if test "${BJAM_SRC}" = "" ; then BJAM_SRC=../src ; fi
cd "${BJAM_SRC}"
./build.sh
if test "${BJAM_BIN}" = "" ; then BJAM_BIN=`ls -1 ${BJAM_SRC}/bin.*/bjam` ; fi
cd "${cwd}"
}
Build_BJAM_To_Test
Guess_BJAM
echo_run "${BJAM}" -f test.jam "-sBJAM=${BJAM_BIN}" "$@"

View File

@@ -1,19 +0,0 @@
#~ Copyright 2006 Rene Rivera.
#~ 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)
ECHO --- Testing var expansion... ;
local p0 = name ;
local p1 = dir/name ;
local p2 = dir/sub/name ;
assert name : (==) : $(p0:D=) ;
assert name : (==) : $(p1:D=) ;
assert name : (==) : $(p2:D=) ;
assert "" : (==) : $(p0:D) ;
assert dir : (==) : $(p1:D) ;
assert dir/sub : (==) : $(p2:D) ;
assert "" : (==) : $(p0:S) ;
assert ($(p0)) : (==) : [ MATCH ^@(.*) : "@($(p0))" ] ;
assert ($(p0)) : (==) : [ MATCH @(.*) : "--@($(p0))" ] ;

View File

@@ -140,6 +140,14 @@ tests = [ "absolute_sources",
"conditionals_multiple",
"configuration",
"copy_time",
"core_action_status",
"core_actions_quietly",
"core_option_d2",
"core_option_l",
"core_option_n",
"core_parallel_actions",
"core_parallel_multifile_actions_1",
"core_parallel_multifile_actions_2",
"custom_generator",
"default_build",
"default_features",