From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../tools/build/test/project_root_constants.py | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/boost/tools/build/test/project_root_constants.py (limited to 'src/boost/tools/build/test/project_root_constants.py') diff --git a/src/boost/tools/build/test/project_root_constants.py b/src/boost/tools/build/test/project_root_constants.py new file mode 100644 index 000000000..25006a015 --- /dev/null +++ b/src/boost/tools/build/test/project_root_constants.py @@ -0,0 +1,62 @@ +#!/usr/bin/python + +# Copyright 2003, 2004, 2005 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) + +import BoostBuild + +# Create a temporary working directory. +t = BoostBuild.Tester() + +# Create the needed files. +t.write("jamroot.jam", """\ +constant FOO : foobar gee ; +ECHO $(FOO) ; +""") + +t.run_build_system() +t.expect_output_lines("foobar gee") + +# Regression test: when absolute paths were passed to path-constant rule, +# B2 failed to recognize path as absolute and prepended the current +# dir. +t.write("jamroot.jam", """\ +import path ; +local here = [ path.native [ path.pwd ] ] ; +path-constant HERE : $(here) ; +if $(HERE) != $(here) +{ + ECHO "PWD =" $(here) ; + ECHO "path constant =" $(HERE) ; + EXIT ; +} +""") +t.write("jamfile.jam", "") + +t.run_build_system() + +t.write("jamfile.jam", """\ +# This tests that rule 'hello' will be imported to children unlocalized, and +# will still access variables in this Jamfile. +x = 10 ; +constant FOO : foo ; +rule hello ( ) { ECHO "Hello $(x)" ; } +""") + +t.write("d/jamfile.jam", """\ +ECHO "d: $(FOO)" ; +constant BAR : bar ; +""") + +t.write("d/d2/jamfile.jam", """\ +ECHO "d2: $(FOO)" ; +ECHO "d2: $(BAR)" ; +hello ; +""") + +t.run_build_system(subdir="d/d2") +t.expect_output_lines("d: foo\nd2: foo\nd2: bar\nHello 10") + +t.cleanup() -- cgit v1.2.3