#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) # Test that it's possible to add a suffix to a main target name to # disambiguate that main target from another, and that this does not # affect the names of the generated targets. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() # Create the needed files t.write("Jamroot", """ exe hello.exe : hello.obj ; obj hello.obj : hello.cpp : <variant>debug ; obj hello.obj2 : hello.cpp : <variant>release ; """) t.write("hello.cpp", """ int main() { return 0; } """) t.run_build_system()
#!/usr/bin/python # Test staging from BoostBuild import Tester t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", """ lib a : a.cpp ; stage dist : a a.h auxilliary/1 ; """) t.write("a.cpp", "") t.write("a.h", "") t.write("auxilliary/1", "") t.run_build_system() t.expect_addition(["dist/a.dll", "dist/a.h", "dist/1"]) # Test the <location> property t.write( "Jamfile", """ lib a : a.cpp ; stage dist : a : <variant>debug:<location>ds <variant>release:<location>rs ; """) t.run_build_system() t.expect_addition("ds/a.dll")
#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) # Test the 'libraries' example. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.set_tree("../example/make") t.run_build_system() t.expect_addition(["bin/$toolset/debug/main.exe"]) t.cleanup()
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. from BoostBuild import Tester, List import string t = Tester() # Regression test for double loading of the same Jamfile. t.write("Jamfile", """ build-project subdir ; """) t.write("project-root.jam", """ """) t.write("subdir/Jamfile", """ ECHO "Loaded subdir" ; """) t.run_build_system(subdir="subdir") t.fail_test(string.count(t.stdout(), "Loaded subdir") != 1) # Regression test for a more contrived case. The top-level # jamfile refers to subdir via use-project, while subdir's # Jamfile is being loaded. The motivation why use-project # referring to subprojects are usefull can be found at
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. from BoostBuild import Tester, List from string import find t = Tester() t.write("project-root.jam", "") t.write("Jamfile", """ lib main : main.cpp l ; lib l : l.cpp main ; """) t.write("main.cpp", "") t.write("l.cpp", "") t.run_build_system("--no-error-backtrace", status=1) t.fail_test(find(t.stdout(), "error: Recursion in main target references") == -1) t.fail_test(find(t.stdout(), "./main ./l ./main") == -1) t.cleanup()
#!/usr/bin/python from BoostBuild import Tester, List import os from string import strip import re def match_re(actual, expected): return re.match(expected, actual, re.DOTALL) != None t = Tester(match=match_re) t.set_tree('testing-primitives') # We expect t5 and t7's output to be dumped to stdout t.run_build_system(stdout=r'''.*failing t5.*failing t7''') t.expect_addition('t2.txt') t.expect_addition('t3.txt') t.expect_addition('t5.out') t.expect_addition('t6.out') t.expect_addition('t6.txt') t.expect_addition('t7.out') t.expect_addition('t7.txt') t.expect_addition('t8.out')
#!/usr/bin/python # Copyright 2002 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) # Test that we cannot specify targets of unknown type as sources. # This is based on the fact that Unix 'ar' will happily consume # just about anything. from BoostBuild import Tester t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", """ static-lib a : a.foo ; """) t.write("a.foo", "") t.run_build_system(status=1) t.cleanup()
#!/usr/bin/python # Test conditional properties from BoostBuild import Tester, List import os from string import strip t = Tester() # Arrange a project which will build only if # 'a.cpp' is compiled with "STATIC" define. t.write("project-root.jam", "import gcc ;") t.write("a.cpp", """ #ifdef STATIC int main() { return 0; } #endif """) t.write("Jamfile", "exe a : a.cpp : <link>static:<define>STATIC ;") t.run_build_system("link=static") t.expect_addition("bin/$toolset/debug/link-static/a.exe") t.write( "Jamfile", """ project : requirements <link>static:<define>STATIC ; exe a : a.cpp ; """) t.rm("bin") t.run_build_system("link=static") t.expect_addition("bin/$toolset/debug/link-static/a.exe")
# Niklaus Giger, 2005-03-15 # Testing whether we may run a test in a absolute directories # There are no tests for temporary directories as this is implictly tested in a lot of other cases from BoostBuild import Tester import os, string t = Tester(executable="jam", workdir=os.getcwd(), pass_toolset=0) jamfile = """ actions print_pwd { pwd ; } print_pwd pwd ; Always pwd ; """ t.write("Jamfile", jamfile) t.write("project-root.jam", " ") t.run_build_system(status=0, extra_args="pwd") if 'TMP' in os.environ: tmp_dir = os.environ.get('TMP') else: tmp_dir = "/tmp" if string.rfind(t.stdout(), tmp_dir) != -1: t.fail_test(1) if string.rfind(t.stdout(), 'build/v2/test') == -1: t.fail_test(1)
#!/usr/bin/python # Copyright (C) Craig Rodrigues 2005. # 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) # Test that projects with multiple source-location directories are handled OK. from BoostBuild import Tester t = Tester() t.write("Jamroot", """ path-constant SRC1 : "./src1" ; path-constant SRC2 : "./src2" ; path-constant SRC3 : "./src3" ; path-constant BUILD : "build" ; project : requirements <include>$(SRC1)/include <threading>multi : build-dir $(BUILD) ; build-project project1 ; """) t.write("project1/Jamfile", """ project project1 : source-location $(SRC1)
#!/usr/bin/python # Copyright 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) # This tests that # 1) the 'make' correctly assigns types to produced targets # 2) than if 'make' create targets of type CPP, they are # correctly used (there was a bug with it). from BoostBuild import Tester t = Tester() # In order to correctly link this app, 'b.cpp', created by 'make' # rule, should be compiled. t.write("project-root.jam", "import gcc ;") t.write( "Jamfile", r''' rule create ( dst : src * : properties * ) { # hack to echo a space under NT setup on $(dst) = "set x=int main(){ return 0; }" ; } import modules ; if [ modules.peek : NT ] { actions create
#!/usr/bin/python from BoostBuild import Tester, List import os from string import strip t = Tester(translate_suffixes=0) # First check some startup t.set_tree("project-test3") 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")
#!/usr/bin/python # Copyright 2003, 2004 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) # Test that sources with absolute names are handled OK. from BoostBuild import Tester t = Tester() t.write("project-root.jam", """ path-constant TOP : . ; """) t.write("Jamfile", """ local pwd = [ PWD ] ; ECHO $(pwd) XXXXX ; exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ; """) t.write("hello.cpp", "int main() { return 0; }\n") t.write("empty.cpp", "\n") t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.exe") # Test a contrived case. There, absolute name is used in # standalone project (not Jamfile). Moreover, the target with # absolute name is returned by 'alias' and used from other project. t.write("a.cpp", """ int main() {
#!/usr/bin/python # Copyright 2004 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) # Test that we load parent projects before loading children. from BoostBuild import Tester, List from string import find t = Tester() t.write("Jamfile", """ use-project /child : child ; ECHO "Setting parent requirements" ; project : requirements <define>PASS_THE_TEST ; alias x : child//main ; """) t.write("project-root.jam", """ """) t.write("child/Jamfile", """ ECHO "Setting child requirements" ; project /child ;
#!/usr/bin/python from BoostBuild import Tester, List import os t = Tester() t.set_tree("generators-test") t.run_build_system() t.expect_addition( "bin/$toolset/debug/" * ( List( "a.obj b.obj c.h c.cpp c.obj d_parser.whl d_lexer.dlp d_parser.cpp d_lexer.cpp " + "d_parser.lr0 d_parser.h d_parser_symbols.h x.c x.obj y.x1 y.x2 " + "y.cpp y.obj e.marked_cpp e.positions e.target_cpp e.obj ")) ) ok = 0 t.expect_addition("bin/$toolset/debug/a.exe") t.expect_addition(["lib/bin/$toolset/debug/c.obj", "lib/bin/$toolset/debug/auxilliary.lib", ]) t.run_build_system(subdir='lib') t.expect_addition(["lib/bin/$toolset/debug/auxilliary2.dll"])
#!/usr/bin/python # Copyright Vladimir Prus 2005. # 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) # Regression test. When Jamfile contained "using whatever ; " and the # 'whatever' module declared a project, then all targets in Jamfile were # considered to be declared in the project associated with 'whatever', # not with the Jamfile. from BoostBuild import Tester, List t = Tester() # Remove temporary directories t.write("a.cpp", """ int main() { return 0; } """) t.write("Jamroot", """ using some_tool ; exe a : a.cpp ; """) t.write( "some_tool.jam", """ import project ; project.initialize $(__name__) ;
#!/usr/bin/python # Copyright (C) Pedro Ferreira 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. from BoostBuild import Tester, List import string t = Tester() t.write("project-root.jam", "") t.write("Jamfile", """ import virtual-target ; rule tag ( name : type ? : property-set ) { local tags ; local v = [ $(property-set).get <variant> ] ; if $(v) = debug { tags += d ; } else if $(v) = release { tags += r ; } local l = [ $(property-set).get <link> ] ; if $(l) = shared {
#!/usr/bin/python from BoostBuild import Tester import os import re def match_re(actual, expected): return re.match(expected, actual, re.DOTALL) != None # Test the v1 startup behavior t = Tester(match=match_re, boost_build_path='', pass_toolset=0) t.set_tree('startup') t.run_build_system( status=1, stdout=r'''Unable to load Boost\.Build: could not find "boost-build.jam" .*Attempted search from .* up to the root''', match=match_re) os.chdir('no-bootstrap1') t.run_build_system( status=1, stdout=r'''Unable to load Boost\.Build: could not find build system\.''' + r'''.*attempted to load the build system by invoking''' + r'''.*'boost-build ;'.*''' + r'''but we were unable to find "bootstrap\.jam"''')
#!/usr/bin/python # Tests that we can use objects from other projects # (i.e. with other project root) # Test also that we can refer to those target using project-id. from BoostBuild import Tester, List t = Tester() t.set_tree("test1") t.run_build_system("-sTOOLSET=yfc", subdir="p1") t.expect_addition("p1/bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") t.expect_addition("p1/auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/optimization-space/b.obj") t.expect_addition("p2/bin/c.obj/yfc/debug/runtime-link-dynamic/c.obj") t.expect_addition("bin/a/yfc/debug/runtime-link-dynamic/a") t.expect_nothing_more() t.fail(t.read("p1/bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") !=\ """ <optimization>off <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug a.cpp """) t.fail(t.read("p1/auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/b.obj") !=\ """ <optimization>space <rtti>on <runtime-link>dynamic <toolset>yfc <variant>debug b.cpp """) t.fail(t.read("p2/bin/c.obj/yfc/debug/runtime-link-dynamic/c.obj") !=\
# Copyright 2003 Dave Abrahams # Copyright 2002, 2003, 2004 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) # Test that we can specify a dependency property # in project requirements, and that it won't # cause every main target in the project to # be generated in it's own subdirectory. # The whole test is somewhat moot now. from BoostBuild import Tester, List t = Tester() t.write("Jamroot", "build-project src ;") t.write("lib/Jamfile", "lib lib1 : lib1.cpp ;") t.write("lib/lib1.cpp", """ #ifdef _WIN32 __declspec(dllexport) #endif void foo() {}\n """) t.write( "src/Jamfile", """ project : requirements <library>../lib//lib1 ;
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. # Test that V2 does not fail gracelessy when any target is skipped. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.write("a.cpp", """ int main() {} """) t.write("b.cpp", """ int main() {} """) t.write("c.cpp", """ int main() {} """) t.write("Jamfile", """ import feature : feature ; feature foo : 1 2 : link-incompatible ; exe a : a.cpp : <foo>1 ; exe b : b.cpp : <foo>2 ;
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2002, 2006 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) # Test that we can specify sources using relative names. from BoostBuild import Tester t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", "exe a : src/a.cpp ;") t.write("src/a.cpp", "int main() { return 0; }\n") t.run_build_system() t.cleanup()
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. # Test that we can access project-root attributes from Jamfiles. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.write("Jamfile", """ local l = [ project-root get-location ] ; ECHO XXX $(l) ; """) t.write("project-root.jam", "") t.run_build_system(stdout="XXX .\n") t.cleanup()
#!/usr/bin/python # (c) Copyright Juergen Hunold 2008 # Use, modification, and distribution are subject to 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 os from BoostBuild import Tester # Run test in real directory in order to find Boost.Test via Boost Top-Level Jamroot qt4_dir = os.getcwd() + "/qt4" t = Tester(workdir=qt4_dir) t.run_build_system() t.cleanup()
#!/usr/bin/python # Copyright 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) # Test that composite properties are handled correctly. from BoostBuild import Tester, List t = Tester() t.write("project-root.jam", "") t.write("Jamfile", """ exe hello : hello.cpp : <variant>release ; """) t.write("hello.cpp", """ int main() { return 0; } """) t.run_build_system() t.expect_addition("bin/$toolset/release/hello.exe") t.cleanup()
#!/usr/bin/python # Copyright 2003, 2004, 2005, 2006 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) # Test that a chain of libraries work ok, not matter if we use static or # shared linking. from BoostBuild import Tester, List, get_toolset import string import os t = Tester() t.write("Jamfile", """ # Stage the binary, so that it will be relinked # without hardcode-dll-paths. That will chech that # we pass correct -rpath-link, even if not passing # -rpath. stage dist : main ; exe main : main.cpp b ; """) t.write("main.cpp", """ void foo(); int main() { foo(); return 0; } """) t.write("project-root.jam", """
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. # Test that we can access project-root attributes from Jamfiles. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.write("Jamfile", """ local l = [ project-root get-location ] ; ECHO XXX $(l) ; """) t.write("project-root.jam", "") t.run_build_system(stdout="XXX .\n") t.cleanup()
#!/usr/bin/python # Test that sources with absolute names are handled OK. from BoostBuild import Tester t = Tester() t.write("project-root.jam", """ path-constant TOP : . ; """) t.write( "Jamfile", """ local pwd = [ PWD ] ; ECHO $(pwd) XXXXX ; exe hello : $(pwd)/hello.cpp $(TOP)/empty.cpp ; """) t.write("hello.cpp", "int main() { return 0; }\n") t.write("empty.cpp", "\n") t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.exe") # Test a contrived case. There, absolute name is used in # standalone project (not Jamfile). Moreover, the target with # absolute name is returned by 'alias' and used from other project. t.write("a.cpp", """ int main() { return 0; }
#!/usr/bin/python # Copyright 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) # Test that unused sources are at least reported. from BoostBuild import Tester from string import find t = Tester() t.set_tree("unused") t.run_build_system() # The second invocation should do nothing, and produce # no warning. The previous invocation might have printed # executed actions and other things, so it's not easy # to check if warning was issued or not. t.run_build_system() t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1) t.run_build_system("-sGENERATE_ONLY_UNUSABLE=1") t.fail_test(find(t.stdout(), "warning: Unused source { b.X } in main target ./a") == -1) # Now check that even if main target generates nothing, its # usage requirements are still propagated to dependents. t.write("a.cpp",""" #ifdef FOO int main() {} #endif
#!/usr/bin/python from BoostBuild import Tester t = Tester() t.write("project-root.jam", "import gcc ;") t.write("Jamfile", "lib a : a.cpp : <include>. ;") t.write("a.cpp", """ #include <a.h> void # ifdef _WIN32 __declspec(dllexport) # endif foo() {} """) t.write("a.h", "//empty file\n") t.write("d/Jamfile", "exe b : b.cpp ..//a ; ") t.write("d/b.cpp", """ void foo(); int main() { foo(); } """) t.run_build_system(subdir="d") # Now test the path features with condition work as well t.write("Jamfile", "lib a : a.cpp : <variant>debug:<include>. ;") t.rm("bin") t.run_build_system(subdir="d") # Test path features with condtion in usage requirements
#!/usr/bin/python # Test the 'make' rule from BoostBuild import Tester from string import find t = Tester(pass_toolset=0) t.write("project-root.jam", "") t.write( "Jamfile", """ rule creator ( string targets * : sources * : * ) { STRING on $(targets) = $(string) ; creator2 $(targets) : $(sources) ; } actions creator2 { echo $(STRING) > $(<) } make foo.bar : : creator foobar ; """) t.run_build_system() t.expect_addition("bin/$toolset/debug/foo.bar") t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "foobar") == -1)
#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) # Test the 'libraries' example. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.set_tree("../example/make") t.run_build_system() t.expect_addition(["bin/$toolset/debug/main.exe"]) t.cleanup()
#!/usr/bin/python # Test usage of searched-libs: one which are found via -l # switch to the linker/compiler. from BoostBuild import Tester import string t = Tester() # To start with, we have to prepate a library to link with t.write("lib/project-root.jam", "import gcc ; ") t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;") t.write("lib/test_lib.cpp", "void foo() {}\n") t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/test_lib.dll") t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") # A regression test: <library>property referring to # searched-lib was mishandled. As the result, we were # putting target name to the command line! # Note that # g++ ...... <.>z # works nicely in some cases, sending output from compiler # to file 'z'. # This problem shows up when searched libs are in usage # requirements. t.write('project-root.jam', 'import gcc ;') t.write('Jamfile', 'exe main : main.cpp d/d2/a ;')
#!/usr/bin/python # Copyright 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) # This tests that # 1) the 'make' correctly assigns types to produced targets # 2) than if 'make' create targets of type CPP, they are # correctly used (there was a bug with it). from BoostBuild import Tester t = Tester() # In order to correctly link this app, 'b.cpp', created by 'make' # rule, should be compiled. t.write("project-root.jam", "import gcc ;") t.write( "Jamfile", r""" rule create ( dst : src * : properties * ) { # hack to echo a space under NT setup on $(dst) = "set x=int main(){ return 0; }" ; } import modules ; if [ modules.peek : NT ] {
#!/usr/bin/python from BoostBuild import Tester, List import os import re spaces_re = re.compile("\ \ +") trailing_spaces_re = re.compile("\ +\n") t = Tester(pass_toolset=0) t.set_tree('module-actions') expected = r'''A.act t1: X1-t1 B.act t1: X1-t1 X2-B act t1: X1-t1 X2-global X3-global A.act t2: X1-A X2-t2 B.act t2: X2-t2 act t2: X1-global X2-t2 X3-global A.act t3: X1-A X3-t3 B.act t3: X2-B X3-t3 act t3: X1-global X2-global X3-t3 ''' # On Unixes, call to 'echo 1 2 3' produces '1 2 3' (note spacing) # Accomodate for that fact. if os.name != 'nt': expected = re.sub(spaces_re, " ", expected) expected = re.sub(trailing_spaces_re, "\n", expected) # We expect t5 and t7's output to be dumped to stdout
#!/usr/bin/python # Test usage of searched-libs: one which are found via -l # switch to the linker/compiler. from BoostBuild import Tester import string t = Tester() # To start with, we have to prepate a library to link with t.write("lib/project-root.jam", "import gcc ; ") t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;") t.write("lib/test_lib.cpp", "void foo() {}\n"); t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/test_lib.dll") t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/libtest_lib.dll") # A regression test: <library>property referring to # searched-lib was mishandled. As the result, we were # putting target name to the command line! # Note that # g++ ...... <.>z # works nicely in some cases, sending output from compiler # to file 'z'. # This problem shows up when searched libs are in usage # requirements. t.write('project-root.jam', 'import gcc ;')
#!/usr/bin/python from BoostBuild import Tester, List import os from string import strip t = Tester(translate_suffixes=0) # 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 " +
#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) # Test the 'libraries' example. from BoostBuild import Tester, List # Create a temporary working directory t = Tester() t.set_tree("../example/libraries") t.run_build_system() t.expect_addition( ["app/bin/$toolset/debug/app.exe", "util/foo/bin/$toolset/debug/bar.dll"]) t.cleanup()
#!/usr/bin/python # Copyright (C) Vladimir Prus 2005. # 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) # Basic tests for the 'notfile' rule. from BoostBuild import Tester, List import string import os t = Tester() t.write("Jamroot", """ import notfile ; notfile say : "echo hi" ; exe hello : hello.cpp ; notfile hello_valgrind : @valgrind : hello ; actions valgrind { valgrind $(>) } """) t.write("hello.cpp", """
#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) from BoostBuild import Tester, List import string t = Tester() t.write( "Jamroot", """ exe a1 : a1.cpp : <conditional>@a1-rule ; rule a1-rule ( properties * ) { if <variant>debug in $(properties) { return <define>OK ; } } exe a2 : a2.cpp : <conditional>@$(__name__).a2-rule <variant>debug:<optimization>speed ; rule a2-rule ( properties * ) { if <optimization>speed in $(properties) { return <define>OK ;
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2002, 2003, 2005 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) # Test that we can change build directory using # the 'build-dir' project attribute. from BoostBuild import Tester import string import os t = Tester() # Test that top-level project can affect build dir t.write("project-root.jam", "import gcc ; ") t.write( "Jamfile", """ project : build-dir build ; exe a : a.cpp ; build-project src ; """) t.write("a.cpp", "int main() { return 0; }\n") t.write("src/Jamfile", "exe b : b.cpp ; ") t.write("src/b.cpp", "int main() { return 0; }\n")
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2006 Rene Rivera # Copyright 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 import os import re spaces_re = re.compile("\ \ +") trailing_spaces_re = re.compile("\ +\n") t = Tester(pass_toolset=0) t.set_tree('module-actions') expected = r'''A.act t1: X1-t1 B.act t1: X1-t1 X2-B act t1: X1-t1 X2-global X3-global A.act t2: X1-A X2-t2 B.act t2: X2-t2 act t2: X1-global X2-t2 X3-global A.act t3: X1-A X3-t3 B.act t3: X2-B X3-t3 act t3: X1-global X2-global X3-t3 ''' # On Unixes, call to 'echo 1 2 3' produces '1 2 3' (note spacing)
#!/usr/bin/python from BoostBuild import Tester import os t = Tester("--build-system=project-test1", boost_build_path='', pass_toolset=0) # This test does no modifications, so run in in the invocation dir os.chdir(t.original_workdir) expected_output1 = """Project Roots: """ expected_output2 = """'%(root-dir-prefix)sdir2': Module for project-root is 'project-root<%(root-dir-prefix)sdir2>' Projects: '/cool-library': * Project root: %(root-dir-prefix)sdir2 * Parent project: (none) * Requirements: <include>/home/ghost/build/boost-cvs * Default build: * Source location: %(root-dir-prefix)sdir2 * Projects to build: """
#!/usr/bin/python # Copyright 2003 Dave Abrahams # Copyright 2002, 2003, 2004, 2005, 2006 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) # Test staging from BoostBuild import Tester t = Tester() t.write("project-root.jam", "import gcc ;") t.write( "Jamfile", """ lib a : a.cpp ; stage dist : a a.h auxilliary/1 ; """) t.write( "a.cpp", """ int #ifdef _WIN32 __declspec(dllexport) #endif must_export_something; """)
#!/usr/bin/python # This tests a bug where files were places to a directory corresponding to a main # target that was using its main target. from BoostBuild import Tester t = Tester() # In order to correctly link this app, 'b.cpp', created by 'make' # rule, should be compiled. t.write("project-root.jam", "import gcc ;") t.write("Jamfile", """ lib b : b.cpp : <define>BAR ; exe a : a.cpp b ; """) t.write("a.cpp", """ void foo(); int main() { foo(); } """) t.write("b.cpp", "void foo() {}\n") t.run_build_system() t.expect_addition("bin/$toolset/debug/main-target-b/b.o") # This tests another bug: when source file was used by two main targets, # one without any requirements and another with free requirements, it # was compiled twice with to the same locaiton. t.write("Jamfile", """ exe a : a.cpp ; exe b : a.cpp : <define>FOO ;
#!/usr/bin/python # Test the 'symlink' rule from BoostBuild import Tester, List import os t = Tester() if os.name != "posix": print "The symlink tests can be run on posix only" sys.exit(1) t.write("project-root.jam", "import gcc ;") t.write( "Jamfile", """ exe hello : hello.cpp ; symlink hello_release : hello/<variant>release ; symlink hello_debug : hello/<variant>debug ; symlink links/hello_release : hello/<variant>release ; """, ) t.write( "hello.cpp", """ int main() { return 0; } """,
#!/usr/bin/python from BoostBuild import Tester, List t = Tester() # Test that top-level project can affect build dir t.write("project-root.jam", "") t.write( "Jamfile", """ exe a : a.cpp ; exe b : b.cpp ; exe c : c.cpp ; alias bin1 : a ; alias bin2 : a b ; alias src : s.cpp ; exe hello : hello.cpp src ; """) t.write("a.cpp", "int main() { return 0; }\n") t.copy("a.cpp", "b.cpp") t.copy("a.cpp", "c.cpp") t.copy("a.cpp", "hello.cpp") t.write("s.cpp", "") # Check that targets to which "bin1" refers are updated, # and only those. t.run_build_system("bin1") t.ignore("*.tds")
#!/usr/bin/python # Copyright (C) Vladimir Prus 2006. # 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) # Tests for the target id resolution process. 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")
#!/usr/bin/python # Copyright 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) # Test that conditional properties work, even if property is free, and # value includes colon. from BoostBuild import Tester, List t = Tester() # Create the needed files t.write("project-root.jam", "") t.write( "Jamfile", """ exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ; """) t.write( "hello.cpp", """ namespace Foo { class Bar { } ; } int main() { CLASS c; return 0; } """) # Don't check stderr, which can include warning about unused 'c'. t.run_build_system(stdout=None, stderr=None)
#!/usr/bin/python # Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and # distribute this software is granted provided this copyright notice appears in # all copies. This software is provided "as is" without express or implied # warranty, and with no claim as to its suitability for any purpose. # Test that conditional properties work, even if property is free, and # value includes colon. from BoostBuild import Tester, List t = Tester() # Create the needed files t.write("project-root.jam", "") t.write("Jamfile", """ exe hello : hello.cpp : <variant>debug:<define>CLASS=Foo::Bar ; """) t.write("hello.cpp", """ namespace Foo { class Bar { } ; } int main() { CLASS c; return 0; } """) # Don't check stderr, which can include warning about unused 'c'. t.run_build_system(stdout=None, stderr=None)
#!/usr/bin/python # 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 t = Tester(pass_toolset=0) t.run_build_system(extra_args="--debug --build-system=test") t.cleanup()
# Niklaus Giger, 2005-03-15 # Testing whether we may run a test in a absolute directories # There are no tests for temporary directories as this is implictly tested in a lot of other cases from BoostBuild import Tester import os, string t = Tester( executable="jam" , workdir = os.getcwd() , pass_toolset=0 ) jamfile=""" actions print_pwd { pwd ; } print_pwd pwd ; Always pwd ; """ t.write("Jamfile", jamfile) t.write("project-root.jam", " ") t.run_build_system(status=0, extra_args = "pwd") if 'TMP' in os.environ: tmp_dir =os.environ.get('TMP') else: tmp_dir ="/tmp" if string.rfind(t.stdout(), tmp_dir) != -1: t.fail_test(1)
#!/usr/bin/python # Copyright 2003, 2006 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 t = Tester() t.write("Jamroot", """ project : requirements <link>static ; exe a : a.cpp [ lib helper : helper.cpp ] ; """) t.write("a.cpp", """ extern void helper(); int main() { return 0; } """) t.write("helper.cpp", """ void helper() { } """) t.run_build_system()
#!/usr/bin/python # Test usage of searched-libs: one which are found via -l # switch to the linker/compiler. from BoostBuild import Tester, get_toolset import string import os t = Tester() # To start with, we have to prepate a library to link with t.write("lib/project-root.jam", "") t.write("lib/Jamfile", "lib libtest_lib : test_lib.cpp ;") t.write("lib/test_lib.cpp", """ #ifdef _WIN32 __declspec(dllexport) #endif void foo() {} """); t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/libtest_lib.dll") # Auto adjusting of suffixes does not work, since we need to # change dll to lib. # if (os.name == 'nt' or os.uname()[0].lower().startswith('cygwin')) and get_toolset() != 'gcc': t.copy("lib/bin/$toolset/debug/libtest_lib.lib", "lib/test_lib.lib") else: t.copy("lib/bin/$toolset/debug/libtest_lib.dll", "lib/libtest_lib.dll")