1#!/usr/local/bin/python3.8
2
3# Copyright 2003 Dave Abrahams
4# Copyright 2002, 2006 Vladimir Prus
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7
8# Test that we can specify sources using relative names.
9
10import BoostBuild
11
12t = BoostBuild.Tester(use_test_config=False)
13
14# Test that relative path to source, 'src', is preserved.
15t.write("jamroot.jam", "exe a : src/a.cpp ;")
16t.write("src/a.cpp", "int main() {}\n")
17
18t.run_build_system()
19t.expect_addition("bin/$toolset/debug*/src/a.obj")
20
21# Test that the relative path to source is preserved
22# when using 'glob'.
23t.rm("bin")
24t.write("jamroot.jam", "exe a : [ glob src/*.cpp ] ;")
25t.run_build_system()
26t.expect_addition("bin/$toolset/debug*/src/a.obj")
27
28
29# Test that relative path with ".." is *not* added to
30# target path.
31t.rm(".")
32t.write("jamroot.jam", "")
33t.write("a.cpp", "int main() { return 0; }\n")
34t.write("build/Jamfile", "exe a : ../a.cpp ; ")
35t.run_build_system(subdir="build")
36t.expect_addition("build/bin/$toolset/debug*/a.obj")
37
38t.cleanup()
39