from BoostBuild import Tester, List # Create a temporary working directory t = Tester() # Create the needed files t.write("Jamroot", """ exe hello : hello.cpp ; # This should use the 'hello' target, even if there's # 'hello' file in current dir. install s : hello : <location>. ; """) t.write("hello.cpp", """ int main() { return 0; } """) t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.obj") t.touch("hello.cpp") t.run_build_system("s") # If 'hello' in the 's' target resolved to file in # current dir, nothing will be rebuilt. t.expect_touch("bin/$toolset/debug/hello.obj") t.cleanup()
t.expect_addition("lib2/helper/bin/$toolset/debug/e.obj") t.expect_content("lib2/helper/bin/$toolset/debug/e.obj", """$toolset/debug lib2/helper/e.cpp """) t.expect_addition("lib3/bin/$toolset/debug/f.obj") t.expect_content( "lib3/bin/$toolset/debug/f.obj", """$toolset/debug lib3/f.cpp lib2/helper/bin/$toolset/debug/e.obj """) t.touch("a.cpp") t.run_build_system() t.expect_touch([ "bin/$toolset/debug/a.obj", "bin/$toolset/debug/a.exe", "lib2/bin/$toolset/debug/l.exe" ]) t.run_build_system(extra_args="release optimization=off,speed") t.expect_addition([ "bin/$toolset/release/a.exe", "bin/$toolset/release/a.obj", "bin/$toolset/release/optimization-off/a.exe", "bin/$toolset/release/optimization-off/a.obj" ]) t.run_build_system(extra_args='clean') 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.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\ """ <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug a.cpp <optimization>space <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug b.cpp """) # Check that we have vanilla target names available in subdirs t.touch("auxillary/b.cpp") t.run_build_system("-sTOOLSET b.obj", subdir="auxillary") t.expect_touch("auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/optimization-space/b.obj") t.expect_no_modification("bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") t.expect_no_modification("bin/a/yfc/debug/runtime-link-dynamic/a") # Check that we cannot request link-incompatible property for source target t.write('Jamfile', t.read('Jamfile2')) stdout="""Error: subvariant of target ./a with properties <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug requests link-incompatible property <rtti>off for source @auxillary/b.obj """ t.run_build_system("-sTOOLSET=yfc", stdout=stdout)
lib2/helper/e.cpp """, ) t.expect_addition("lib3/bin/$toolset/debug/f.obj") t.expect_content( "lib3/bin/$toolset/debug/f.obj", """$toolset/debug lib3/f.cpp lib2/helper/bin/$toolset/debug/e.obj """, ) t.touch("a.cpp") t.run_build_system() t.expect_touch(["bin/$toolset/debug/a.obj", "bin/$toolset/debug/a.exe", "lib2/bin/$toolset/debug/l.exe"]) t.run_build_system(extra_args="release optimization=off,speed") t.expect_addition( [ "bin/$toolset/release/a.exe", "bin/$toolset/release/a.obj", "bin/$toolset/release/optimization-off/a.exe", "bin/$toolset/release/optimization-off/a.obj", ] ) t.run_build_system(extra_args="clean") t.expect_removal( [
t = Tester() t.set_tree("dependency-test") t.run_build_system() # Check that main target 'c' was able to find 'x.h' from # 'a's dependency graph t.expect_addition("bin/$toolset/debug/c.exe") # Check handling of first level includes. # Both 'a' and 'b' include "a.h" and should be updated t.touch("a.h") t.run_build_system() t.expect_touch("bin/$toolset/debug/a.exe") t.expect_touch("bin/$toolset/debug/a.obj") t.expect_touch("bin/$toolset/debug/a_c.obj") t.expect_touch("bin/$toolset/debug/b.exe") t.expect_touch("bin/$toolset/debug/b.obj") # Now, <dependency> does not add dependency. # It sound weird, but is intentional. Need # to rename <dependency> eventually. #t.expect_touch("bin/$toolset/debug/main-target-c/c.exe") t.ignore("*.tds") t.expect_nothing_more() # Only 'a' include <a.h> and should be updated t.touch("src1/a.h") t.run_build_system()
t.set_tree("dependency-test") t.run_build_system() # Check that main target 'c' was able to find 'x.h' from # 'a's dependency graph t.expect_addition("bin/$toolset/debug/main-target-c/c.exe") # Check that main target 'e' was able to find 'y.h' t.expect_addition("bin/$toolset/debug/main-target-e/e.exe") # Check handling of first level includes. # Both 'a' and 'b' include "a.h" and should be updated t.touch("a.h") t.run_build_system() t.expect_touch("bin/$toolset/debug/a.exe") t.expect_touch("bin/$toolset/debug/a.obj") t.expect_touch("bin/$toolset/debug/b.exe") t.expect_touch("bin/$toolset/debug/b.obj") t.expect_touch("bin/$toolset/debug/main-target-c/c.exe") t.expect_nothing_more() # Only 'a' include <a.h> and should be updated t.touch("src1/a.h") t.run_build_system() t.expect_touch("bin/$toolset/debug/a.exe") t.expect_touch("bin/$toolset/debug/a.obj") t.expect_touch("bin/$toolset/debug/main-target-c/c.exe") t.expect_nothing_more()
#!/usr/bin/python # Copyright 2002, 2003 Dave Abrahams # 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) from BoostBuild import Tester, List from time import sleep t = Tester() t.set_tree("test2") t.run_build_system("-sBOOST_BUILD_PATH=" + t.original_workdir + "/..") file_list = 'bin/foo/$toolset/debug/runtime-link-dynamic/' * List("foo foo.o") t.expect_addition(file_list) t.write("foo.cpp", "int main(int, char**) { return 0; }\n") t.run_build_system("-d2 -sBOOST_BUILD_PATH=" + t.original_workdir + "/..") t.expect_touch(file_list) t.pass_test()
<optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug a.cpp """) t.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\ """ <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug a.cpp """) # Check that we have vanilla target names available t.touch("a.cpp") t.run_build_system("-sTOOLSET a.obj") t.expect_touch("bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") t.expect_no_modification("bin/a/yfc/debug/runtime-link-dynamic/a") # Check that if build request cannot be completely matches, a warning is # issued and subvariant with link-compatible properties is used t.write("Jamfile", t.read("Jamfile2")) stdout="""Warning: cannot exactly satisfy request for ./a with properties <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug Using <optimization>space <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug instead. """) t.run_build_system("-sTOOLSET=yfc", stdout=stdout)
#!/usr/bin/python from BoostBuild import Tester, List from time import sleep t = Tester() t.set_tree("test2") t.run_build_system("-sBOOST_BUILD_PATH=" + t.original_workdir + "/..") file_list = 'bin/foo/$toolset/debug/runtime-link-dynamic/' * List("foo foo.o") t.expect_addition(file_list) t.write("foo.cpp", "int main(int, char**) { return 0; }\n") t.run_build_system("-d2 -sBOOST_BUILD_PATH=" + t.original_workdir + "/..") t.expect_touch(file_list) t.pass_test()