| 1 | #!/usr/bin/python |
|---|
| 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 | |
|---|
| 9 | from BoostBuild import Tester |
|---|
| 10 | t = Tester() |
|---|
| 11 | |
|---|
| 12 | t.write("project-root.jam", """ |
|---|
| 13 | path-constant TOP : . ; |
|---|
| 14 | """) |
|---|
| 15 | t.write("Jamfile", """ |
|---|
| 16 | local pwd = [ PWD ] ; |
|---|
| 17 | ECHO $(pwd) XXXXX ; |
|---|
| 18 | exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ; |
|---|
| 19 | """) |
|---|
| 20 | t.write("hello.cpp", "int main() { return 0; }\n") |
|---|
| 21 | t.write("empty.cpp", "\n") |
|---|
| 22 | |
|---|
| 23 | t.run_build_system() |
|---|
| 24 | t.expect_addition("bin/$toolset/debug/hello.exe") |
|---|
| 25 | |
|---|
| 26 | # Test a contrived case. There, absolute name is used in |
|---|
| 27 | # standalone project (not Jamfile). Moreover, the target with |
|---|
| 28 | # absolute name is returned by 'alias' and used from other project. |
|---|
| 29 | t.write("a.cpp", """ |
|---|
| 30 | int main() |
|---|
| 31 | { |
|---|
| 32 | return 0; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | """) |
|---|
| 36 | |
|---|
| 37 | t.write("Jamfile", """ |
|---|
| 38 | exe a : /standalone//a ; |
|---|
| 39 | """) |
|---|
| 40 | |
|---|
| 41 | t.write("project-root.jam", """ |
|---|
| 42 | import standalone ; |
|---|
| 43 | """) |
|---|
| 44 | |
|---|
| 45 | t.write("standalone.jam", """ |
|---|
| 46 | import project ; |
|---|
| 47 | |
|---|
| 48 | project.initialize $(__name__) ; |
|---|
| 49 | project standalone ; |
|---|
| 50 | |
|---|
| 51 | local pwd = [ PWD ] ; |
|---|
| 52 | |
|---|
| 53 | alias a : $(pwd)/a.cpp ; |
|---|
| 54 | |
|---|
| 55 | """) |
|---|
| 56 | t.run_build_system() |
|---|
| 57 | t.expect_addition("bin/$toolset/debug/a.exe") |
|---|
| 58 | |
|---|
| 59 | # Test absolute path in target ids |
|---|
| 60 | t.rm(".") |
|---|
| 61 | t.write("d1/project-root.jam", "") |
|---|
| 62 | t.write("d1/Jamfile", """ |
|---|
| 63 | exe a : a.cpp ; |
|---|
| 64 | """) |
|---|
| 65 | t.write("d1/a.cpp", """ |
|---|
| 66 | int main() { return 0; } |
|---|
| 67 | """) |
|---|
| 68 | t.write("d2/project-root.jam", "") |
|---|
| 69 | t.write("d2/Jamfile", """ |
|---|
| 70 | local pwd = [ PWD ] ; |
|---|
| 71 | alias x : $(pwd)/../d1//a ; |
|---|
| 72 | """) |
|---|
| 73 | |
|---|
| 74 | t.run_build_system(subdir="d2") |
|---|
| 75 | t.expect_addition("d1/bin/$toolset/debug/a.exe") |
|---|
| 76 | |
|---|
| 77 | t.cleanup() |
|---|