mirror of
https://github.com/boostorg/build.git
synced 2026-02-10 11:22:12 +00:00
Add test for rootless projects.
This commit is contained in:
8
test/project-test5/a.cpp
Normal file
8
test/project-test5/a.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2003 Vladimir Prus
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// http://www.boost.org
|
||||
//
|
||||
73
test/project-test5/jamfile.jam
Normal file
73
test/project-test5/jamfile.jam
Normal file
@@ -0,0 +1,73 @@
|
||||
# Copyright 2002-2005 Vladimir Prus.
|
||||
# Copyright 2018 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)
|
||||
|
||||
import os ;
|
||||
import gcc ;
|
||||
import property ;
|
||||
import toolset ;
|
||||
|
||||
rule properties-as-path ( properties * )
|
||||
{
|
||||
local r ;
|
||||
for local p in $(properties)
|
||||
{
|
||||
if $(p:G) != <action>
|
||||
{
|
||||
r += $(p) ;
|
||||
}
|
||||
}
|
||||
return [ property.as-path
|
||||
[ property.remove incidental : $(r) ] ] ;
|
||||
}
|
||||
|
||||
toolset.flags yfc-compile KNOWN-PROPERTIES : <toolset> <optimization> ;
|
||||
toolset.flags yfc-link KNOWN-PROPERTIES : <toolset> <optimization> ;
|
||||
|
||||
rule yfc-compile ( target : sources * : property-set * )
|
||||
{
|
||||
PROPERTIES on $(target) = [ properties-as-path $(property-set) ] ;
|
||||
}
|
||||
|
||||
actions yfc-compile
|
||||
{
|
||||
echo $(PROPERTIES) > $(<)
|
||||
echo $(>) >> $(<)
|
||||
}
|
||||
|
||||
rule yfc-link ( target : sources * : property-set * )
|
||||
{
|
||||
PROPERTIES on $(target) = [ properties-as-path $(property-set) ] ;
|
||||
}
|
||||
|
||||
actions yfc-link
|
||||
{
|
||||
echo $(PROPERTIES) > $(<)
|
||||
echo $(>) >> $(<)
|
||||
}
|
||||
|
||||
if [ os.name ] = VMS
|
||||
{
|
||||
actions yfc-compile
|
||||
{
|
||||
PIPE WRITE SYS$OUTPUT "$(PROPERTIES)" | TYPE SYS$INPUT /OUT=$(<:W)
|
||||
PIPE WRITE SYS$OUTPUT "$(>:J= ",")" | APPEND /NEW SYS$INPUT $(<:W)
|
||||
}
|
||||
|
||||
actions yfc-link
|
||||
{
|
||||
PIPE WRITE SYS$OUTPUT "$(PROPERTIES)" | TYPE SYS$INPUT /OUT=$(<:W)
|
||||
OPEN /APPEND FOUT $(<:W)
|
||||
WRITE FOUT "$(>:J= ",")"
|
||||
CLOSE FOUT
|
||||
}
|
||||
}
|
||||
|
||||
IMPORT $(__name__) : yfc-compile yfc-link : : yfc-compile yfc-link ;
|
||||
|
||||
|
||||
make a.exe : a.obj lib//b.obj : yfc-link ;
|
||||
make a.obj : a.cpp : yfc-compile ;
|
||||
|
||||
build-project lib ;
|
||||
8
test/project-test5/lib/b.cpp
Normal file
8
test/project-test5/lib/b.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2003 Vladimir Prus
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// http://www.boost.org
|
||||
//
|
||||
7
test/project-test5/lib/jamfile.jam
Normal file
7
test/project-test5/lib/jamfile.jam
Normal file
@@ -0,0 +1,7 @@
|
||||
# Copyright 2002, 2003 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)
|
||||
|
||||
|
||||
make b.obj : b.cpp : yfc-compile ;
|
||||
make m.exe : b.obj : yfc-link ;
|
||||
59
test/project_test5.py
Normal file
59
test/project_test5.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
# Copyright 2002, 2003 Dave Abrahams
|
||||
# Copyright 2002, 2003, 2004, 2006 Vladimir Prus
|
||||
# Copyright 2018 Rene Rivera
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import BoostBuild
|
||||
import os
|
||||
|
||||
t = BoostBuild.Tester(translate_suffixes=0)
|
||||
|
||||
t.set_tree("project-test5")
|
||||
t.run_build_system()
|
||||
|
||||
t.expect_addition("bin/$toolset/debug*/a.obj")
|
||||
t.expect_content("bin/$toolset/debug*/a.obj", """\
|
||||
$toolset/debug*
|
||||
a.cpp
|
||||
""")
|
||||
|
||||
t.expect_addition("bin/$toolset/debug*/a.exe")
|
||||
t.expect_content("bin/$toolset/debug*/a.exe",
|
||||
"$toolset/debug*\n" +
|
||||
"bin/$toolset/debug*/a.obj lib/bin/$toolset/debug*/b.obj\n"
|
||||
)
|
||||
|
||||
t.expect_addition("lib/bin/$toolset/debug*/b.obj")
|
||||
t.expect_content("lib/bin/$toolset/debug*/b.obj", """\
|
||||
$toolset/debug*
|
||||
lib/b.cpp
|
||||
""")
|
||||
|
||||
t.expect_addition("lib/bin/$toolset/debug*/m.exe")
|
||||
t.expect_content("lib/bin/$toolset/debug*/m.exe", """\
|
||||
$toolset/debug*
|
||||
lib/bin/$toolset/debug*/b.obj
|
||||
""")
|
||||
|
||||
t.touch("a.cpp")
|
||||
t.run_build_system()
|
||||
t.expect_touch(["bin/$toolset/debug*/a.obj",
|
||||
"bin/$toolset/debug*/a.exe"])
|
||||
|
||||
t.run_build_system(["release", "optimization=off,speed"])
|
||||
t.expect_addition(["bin/$toolset/release/optimization-off*/a.exe",
|
||||
"bin/$toolset/release/optimization-off*/a.obj",
|
||||
"bin/$toolset/release*/a.exe",
|
||||
"bin/$toolset/release*/a.obj"])
|
||||
|
||||
t.run_build_system(["--clean-all"])
|
||||
t.expect_removal(["bin/$toolset/debug*/a.obj",
|
||||
"bin/$toolset/debug*/a.exe",
|
||||
"lib/bin/$toolset/debug*/b.obj",
|
||||
"lib/bin/$toolset/debug*/m.exe"])
|
||||
|
||||
t.cleanup()
|
||||
Reference in New Issue
Block a user