1#!/usr/local/bin/python3.8 2 3# Copyright 2002, 2003 Dave Abrahams 4# Copyright 2002, 2003, 2004, 2006 Vladimir Prus 5# Distributed under the Boost Software License, Version 1.0. 6# (See accompanying file LICENSE_1_0.txt or copy at 7# http://www.boost.org/LICENSE_1_0.txt) 8 9import BoostBuild 10import os 11 12t = BoostBuild.Tester(translate_suffixes=0) 13 14# First check some startup. 15t.set_tree("project-test3") 16os.remove("jamroot.jam") 17t.run_build_system(status=1) 18 19t.expect_output_lines("*.yfc-compile\" unknown in module*") 20 21t.set_tree("project-test3") 22t.run_build_system() 23 24t.expect_addition("bin/$toolset/debug*/a.obj") 25t.expect_content("bin/$toolset/debug*/a.obj", """\ 26$toolset/debug* 27a.cpp 28""") 29 30t.expect_addition("bin/$toolset/debug*/a.exe") 31t.expect_content("bin/$toolset/debug*/a.exe", 32"$toolset/debug*\n" + 33"bin/$toolset/debug*/a.obj lib/bin/$toolset/debug*/b.obj " + 34"lib2/bin/$toolset/debug*/c.obj lib2/bin/$toolset/debug*/d.obj " + 35"lib2/helper/bin/$toolset/debug*/e.obj " + 36"lib3/bin/$toolset/debug*/f.obj\n" 37) 38 39t.expect_addition("lib/bin/$toolset/debug*/b.obj") 40t.expect_content("lib/bin/$toolset/debug*/b.obj", """\ 41$toolset/debug* 42lib/b.cpp 43""") 44 45t.expect_addition("lib/bin/$toolset/debug*/m.exe") 46t.expect_content("lib/bin/$toolset/debug*/m.exe", """\ 47$toolset/debug* 48lib/bin/$toolset/debug*/b.obj lib2/bin/$toolset/debug*/c.obj 49""") 50 51t.expect_addition("lib2/bin/$toolset/debug*/c.obj") 52t.expect_content("lib2/bin/$toolset/debug*/c.obj", """\ 53$toolset/debug* 54lib2/c.cpp 55""") 56 57t.expect_addition("lib2/bin/$toolset/debug*/d.obj") 58t.expect_content("lib2/bin/$toolset/debug*/d.obj", """\ 59$toolset/debug* 60lib2/d.cpp 61""") 62 63t.expect_addition("lib2/bin/$toolset/debug*/l.exe") 64t.expect_content("lib2/bin/$toolset/debug*/l.exe", """\ 65$toolset/debug* 66lib2/bin/$toolset/debug*/c.obj bin/$toolset/debug*/a.obj 67""") 68 69t.expect_addition("lib2/helper/bin/$toolset/debug*/e.obj") 70t.expect_content("lib2/helper/bin/$toolset/debug*/e.obj", """\ 71$toolset/debug* 72lib2/helper/e.cpp 73""") 74 75t.expect_addition("lib3/bin/$toolset/debug*/f.obj") 76t.expect_content("lib3/bin/$toolset/debug*/f.obj", """\ 77$toolset/debug* 78lib3/f.cpp lib2/helper/bin/$toolset/debug*/e.obj 79""") 80 81t.touch("a.cpp") 82t.run_build_system() 83t.expect_touch(["bin/$toolset/debug*/a.obj", 84 "bin/$toolset/debug*/a.exe", 85 "lib2/bin/$toolset/debug*/l.exe"]) 86 87t.run_build_system(["release", "optimization=off,speed"]) 88t.expect_addition(["bin/$toolset/release/optimization-off*/a.exe", 89 "bin/$toolset/release/optimization-off*/a.obj", 90 "bin/$toolset/release*/a.exe", 91 "bin/$toolset/release*/a.obj"]) 92 93t.run_build_system(["--clean-all"]) 94t.expect_removal(["bin/$toolset/debug*/a.obj", 95 "bin/$toolset/debug*/a.exe", 96 "lib/bin/$toolset/debug*/b.obj", 97 "lib/bin/$toolset/debug*/m.exe", 98 "lib2/bin/$toolset/debug*/c.obj", 99 "lib2/bin/$toolset/debug*/d.obj", 100 "lib2/bin/$toolset/debug*/l.exe", 101 "lib3/bin/$toolset/debug*/f.obj"]) 102 103# Now test target ids in command line. 104t.set_tree("project-test3") 105t.run_build_system(["lib//b.obj"]) 106t.expect_addition("lib/bin/$toolset/debug*/b.obj") 107t.expect_nothing_more() 108 109t.run_build_system(["--clean", "lib//b.obj"]) 110t.expect_removal("lib/bin/$toolset/debug*/b.obj") 111t.expect_nothing_more() 112 113t.run_build_system(["lib//b.obj"]) 114t.expect_addition("lib/bin/$toolset/debug*/b.obj") 115t.expect_nothing_more() 116 117t.run_build_system(["release", "lib2/helper//e.obj", "/lib3//f.obj"]) 118t.expect_addition("lib2/helper/bin/$toolset/release*/e.obj") 119t.expect_addition("lib3/bin/$toolset/release*/f.obj") 120t.expect_nothing_more() 121 122# Test project ids in command line work as well. 123t.set_tree("project-test3") 124t.run_build_system(["/lib2"]) 125t.expect_addition("lib2/bin/$toolset/debug*/" * 126 BoostBuild.List("c.obj d.obj l.exe")) 127t.expect_addition("bin/$toolset/debug*/a.obj") 128t.expect_nothing_more() 129 130t.run_build_system(["lib"]) 131t.expect_addition("lib/bin/$toolset/debug*/" * 132 BoostBuild.List("b.obj m.exe")) 133t.expect_nothing_more() 134 135t.cleanup() 136