From df2eadef97f8e577d2bacbca3f4ca8c7151ab977 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Thu, 18 Oct 2018 10:22:32 -0500 Subject: [PATCH] Add test for rootless projects. --- test/project-test5/a.cpp | 8 ++++ test/project-test5/jamfile.jam | 73 ++++++++++++++++++++++++++++++ test/project-test5/lib/b.cpp | 8 ++++ test/project-test5/lib/jamfile.jam | 7 +++ test/project_test5.py | 59 ++++++++++++++++++++++++ 5 files changed, 155 insertions(+) create mode 100644 test/project-test5/a.cpp create mode 100644 test/project-test5/jamfile.jam create mode 100644 test/project-test5/lib/b.cpp create mode 100644 test/project-test5/lib/jamfile.jam create mode 100644 test/project_test5.py diff --git a/test/project-test5/a.cpp b/test/project-test5/a.cpp new file mode 100644 index 000000000..ccecbb414 --- /dev/null +++ b/test/project-test5/a.cpp @@ -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 +// diff --git a/test/project-test5/jamfile.jam b/test/project-test5/jamfile.jam new file mode 100644 index 000000000..6e4ab62ea --- /dev/null +++ b/test/project-test5/jamfile.jam @@ -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) != + { + r += $(p) ; + } + } + return [ property.as-path + [ property.remove incidental : $(r) ] ] ; +} + +toolset.flags yfc-compile KNOWN-PROPERTIES : ; +toolset.flags yfc-link KNOWN-PROPERTIES : ; + +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 ; diff --git a/test/project-test5/lib/b.cpp b/test/project-test5/lib/b.cpp new file mode 100644 index 000000000..ccecbb414 --- /dev/null +++ b/test/project-test5/lib/b.cpp @@ -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 +// diff --git a/test/project-test5/lib/jamfile.jam b/test/project-test5/lib/jamfile.jam new file mode 100644 index 000000000..6c33d5bd7 --- /dev/null +++ b/test/project-test5/lib/jamfile.jam @@ -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 ; diff --git a/test/project_test5.py b/test/project_test5.py new file mode 100644 index 000000000..09312e759 --- /dev/null +++ b/test/project_test5.py @@ -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()