# First check some startup t.set_tree("project-test3") os.remove("project-root.jam") t.run_build_system(status=1, stdout="""error: Could not find parent for project at '.' error: Did not find Jamfile or project-root.jam in any parent directory. """) t.set_tree("project-test3") 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 " + "lib2/bin/$toolset/debug/c.obj lib2/bin/$toolset/debug/d.obj " + "lib2/helper/bin/$toolset/debug/e.obj " + "lib3/bin/$toolset/debug/f.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 """)
from BoostBuild import Tester, List t = Tester() t.write("project-root.jam", "import gcc ;") t.write( "Jamfile", """ import print ; print.output foo ; print.text \\\"Something\\\" ; DEPENDS all : foo ; ALWAYS foo ; """) t.run_build_system() t.expect_content("foo", """\"Something\"""") t.write( "Jamfile", """ import print ; print.output foo ; print.text \\\n\\\"Somethingelse\\\" ; DEPENDS all : foo ; ALWAYS foo ; """) t.run_build_system() t.expect_content("foo", """\"Something\" \"Somethingelse\"""") t.write(
os.remove("project-root.jam") t.run_build_system( status=1, stdout="""Failed to find the project root for directory '.'. Did not find a project-root.jam file there or in any of its parent directories. Please consult the documentation at 'http://www.boost.org'. """, ) t.set_tree("project-test3") 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 " + "lib2/bin/$toolset/debug/c.obj lib2/bin/$toolset/debug/d.obj " + "lib2/helper/bin/$toolset/debug/e.obj " + "lib3/bin/$toolset/debug/f.obj\n", ) t.expect_addition("lib/bin/$toolset/debug/b.obj") t.expect_content(
"rcc.jam", """ import type ; import generators ; import print ; # Use 'RCC' to avoid conflicts with definitions in # the standard rc.jam and msvc.jam type.register RCC : rcc ; rule resource-compile ( targets * : sources * : properties * ) { print.output $(targets[1]) ; print.text "rc-object" ; } generators.register-standard rcc.resource-compile : RCC : OBJ ; """) t.write("Jamfile", """ obj r : r.rcc ; """) t.write("r.rcc", """ """) t.run_build_system() t.expect_content("bin/$toolset/debug/r.obj", "rc-object\n") t.cleanup()
#endif helper() {} """) t.write("project-root.jam", "") # First test that when outcomes are expected, all .test files are created. t.run_build_system("hardcode-dll-paths=false", stderr=None, status=None) t.expect_addition("bin/c.test/$toolset/debug/c.test") t.expect_addition("bin/c-f.test/$toolset/debug/c-f.test") t.expect_addition("bin/r.test/$toolset/debug/r.test") t.expect_addition("bin/r-f.test/$toolset/debug/r-f.test") # Make sure args are handled. t.expect_content("bin/r.test/$toolset/debug/r.output", "foo\nbar\n*\nEXIT STATUS: 0*\n", True) # Test that input file is handled as well. t.write( "r.cpp", """ #include <iostream> #include <fstream> int main(int ac, char* av[]) { for (int i = 1; i < ac; ++i) { std::ifstream ifs(av[i]); std::cout << ifs.rdbuf(); } return 0; }
#endif helper() {} """) t.write("project-root.jam", "") # First test that when outcomes are expected, all .test files are created. t.run_build_system("hardcode-dll-paths=false", stderr=None, status=None) t.expect_addition("bin/c.test/$toolset/debug/c.test") t.expect_addition("bin/c-f.test/$toolset/debug/c-f.test") t.expect_addition("bin/r.test/$toolset/debug/r.test") t.expect_addition("bin/r-f.test/$toolset/debug/r-f.test") # Make sure args are handled. t.expect_content("bin/r.test/$toolset/debug/r.output", "foo\nbar\n\nEXIT STATUS: 0\n") # Test that input file is handled as well. t.write("r.cpp", """ #include <iostream> #include <fstream> int main(int ac, char* av[]) { for (int i = 1; i < ac; ++i) { std::ifstream ifs(av[i]); std::cout << ifs.rdbuf(); } return 0; } """)
#!/usr/bin/python from BoostBuild import Tester import os from string import strip, find t = Tester(translate_suffixes=0) t.set_tree("project-test4") t.run_build_system() t.expect_addition("bin/$toolset/debug/a.obj") t.expect_content("bin/$toolset/debug/a.obj", """$toolset/debug/include-everything a.cpp """) t.expect_addition("bin/$toolset/debug/a.exe") t.expect_content( "bin/$toolset/debug/a.exe", "$toolset/debug/include-everything\n" + "bin/$toolset/debug/a.obj lib/bin/$toolset/debug/optimization-speed/b.obj\n" ) t.expect_addition("lib/bin/$toolset/debug/optimization-speed/b.obj") t.expect_content( "lib/bin/$toolset/debug/optimization-speed/b.obj", """$toolset/debug/include-everything/optimization-speed lib/b.cpp """)
type.register RCC : rcc ; rule resource-compile ( targets * : sources * : properties * ) { print.output $(targets[1]) ; print.text "rc-object" ; } generators.register-standard rcc.resource-compile : RCC : OBJ ; """, ) t.write( "Jamfile", """ obj r : r.rcc ; """, ) t.write( "r.rcc", """ """, ) t.run_build_system() t.expect_content("bin/$toolset/debug/r.obj", "rc-object") t.cleanup()
#!/usr/bin/python from BoostBuild import Tester import os from string import strip, find t = Tester(translate_suffixes=0) t.set_tree("project-test4") t.run_build_system() t.expect_addition("bin/$toolset/debug/a.obj") t.expect_content("bin/$toolset/debug/a.obj", """$toolset/debug/include-everything a.cpp """) t.expect_addition("bin/$toolset/debug/a.exe") t.expect_content("bin/$toolset/debug/a.exe", "$toolset/debug/include-everything\n" + "bin/$toolset/debug/a.obj lib/bin/$toolset/debug/optimization-speed/b.obj\n" ) t.expect_addition("lib/bin/$toolset/debug/optimization-speed/b.obj") t.expect_content("lib/bin/$toolset/debug/optimization-speed/b.obj", """$toolset/debug/include-everything/optimization-speed lib/b.cpp """) t.expect_addition("bin/$toolset/debug/b.exe")
from BoostBuild import Tester, List t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", """ import print ; print.output foo ; print.text \\\"Something\\\" ; DEPENDS all : foo ; ALWAYS foo ; """) t.run_build_system() t.expect_content("foo", """\"Something\"""") t.write("Jamfile", """ import print ; print.output foo ; print.text \\\n\\\"Somethingelse\\\" ; DEPENDS all : foo ; ALWAYS foo ; """) t.run_build_system() t.expect_content("foo", """\"Something\" \"Somethingelse\"""") t.write("Jamfile", """ import print ;