1#!/usr/local/bin/python3.8 2 3# Copyright 2003, 2004 Vladimir Prus 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7# Test that sources with absolute names are handled OK. 8 9import BoostBuild 10 11t = BoostBuild.Tester(use_test_config=False) 12 13t.write("jamroot.jam", "path-constant TOP : . ;") 14t.write("jamfile.jam", """\ 15local pwd = [ PWD ] ; 16ECHO $(pwd) XXXXX ; 17exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ; 18""") 19t.write("hello.cpp", "int main() {}\n") 20t.write("empty.cpp", "\n") 21 22t.run_build_system() 23t.expect_addition("bin/$toolset/debug*/hello.exe") 24t.rm(".") 25 26# Test a contrived case in which an absolute name is used in a standalone 27# project (not Jamfile). Moreover, the target with an absolute name is returned 28# via an 'alias' and used from another project. 29t.write("a.cpp", "int main() {}\n") 30t.write("jamfile.jam", "exe a : /standalone//a ;") 31t.write("jamroot.jam", "import standalone ;") 32t.write("standalone.jam", """\ 33import project ; 34project.initialize $(__name__) ; 35project standalone ; 36local pwd = [ PWD ] ; 37alias a : $(pwd)/a.cpp ; 38""") 39 40t.write("standalone.py", """ 41from b2.manager import get_manager 42 43# FIXME: this is ugly as death 44get_manager().projects().initialize(__name__) 45 46import os ; 47 48# This use of list as parameter is also ugly. 49project(['standalone']) 50 51pwd = os.getcwd() 52alias('a', [os.path.join(pwd, 'a.cpp')]) 53""") 54 55t.run_build_system() 56t.expect_addition("bin/$toolset/debug*/a.exe") 57 58# Test absolute path in target ids. 59t.rm(".") 60 61t.write("d1/jamroot.jam", "") 62t.write("d1/jamfile.jam", "exe a : a.cpp ;") 63t.write("d1/a.cpp", "int main() {}\n") 64t.write("d2/jamroot.jam", "") 65t.write("d2/jamfile.jam", """\ 66local pwd = [ PWD ] ; 67alias x : $(pwd)/../d1//a ; 68""") 69 70t.run_build_system(subdir="d2") 71t.expect_addition("d1/bin/$toolset/debug*/a.exe") 72 73t.cleanup() 74