From 56a111016e8b6afbc6a7ebd08292c2864078218e Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Thu, 16 Oct 2008 08:42:03 +0000 Subject: [PATCH] Wholesale Boost.Build merge from the trunk [SVN r49353] --- doc/{Jamfile.v2 => jamfile.jam} | 0 doc/src/advanced.xml | 441 +++--- doc/src/faq.xml | 550 ++++--- doc/src/reference.xml | 87 +- doc/src/tasks.xml | 929 +++++------ .../customization/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 example/customization/readme.txt | 10 +- example/customization/usage.verbatim | 5 +- example/generate/REAME.txt | 20 +- example/generate/{Jamroot => jamroot.jam} | 0 example/generator/README.txt | 7 +- example/generator/{Jamroot => jamroot.jam} | 0 example/gettext/{Jamfile => jamfile.jam} | 0 .../gettext/{project-root.jam => jamroot.jam} | 0 example/gettext/readme.txt | 13 +- example/hello/{Jamroot => jamroot.jam} | 1 - example/hello/readme.txt | 7 + .../libraries/app/{Jamfile => jamfile.jam} | 0 example/libraries/{Jamroot => jamroot.jam} | 0 .../util/foo/{Jamfile => jamfile.jam} | 0 example/make/Jamroot | 23 - example/make/foo.py | 2 + example/make/jamroot.jam | 10 + example/make/main_cpp.pro | 3 +- example/make/readme.txt | 10 +- example/pch/{Jamroot => jamroot.jam} | 0 .../python_modules/{Jamroot => jamroot.jam} | 0 example/python_modules/readme.txt | 15 +- example/qt/README.txt | 15 +- example/qt/qt3/hello/{Jamroot => jamroot.jam} | 0 .../qt3/moccable-cpp/{Jamroot => jamroot.jam} | 0 example/qt/qt3/uic/{Jamroot => jamroot.jam} | 0 example/qt/qt4/hello/{Jamroot => jamroot.jam} | 0 .../qt4/moccable-cpp/{Jamroot => jamroot.jam} | 0 example/qt/qt4/uic/{Jamroot => jamroot.jam} | 0 example/variant/Jamfile | 13 - example/variant/jamfile.jam | 11 + .../variant/{project-root.jam => jamroot.jam} | 0 example/variant/libs/{Jamfile => jamfile.jam} | 0 example/variant/readme.txt | 16 +- .../{project-root.jam => jamroot.jam} | 0 generators_prototype.py | 731 --------- scripts/nightly.sh | 2 +- scripts/roll.sh | 6 +- src/build-system.jam | 46 +- src/build/alias.jam | 18 +- src/build/build-request.jam | 47 +- src/build/feature.jam | 12 +- src/build/generators.jam | 493 +++--- src/build/project.jam | 126 +- src/build/property-set.jam | 12 +- src/build/property.jam | 49 +- src/build/targets.jam | 120 +- src/build/toolset.jam | 46 +- src/build/type.jam | 112 +- src/build/virtual-target.jam | 123 +- src/contrib/wxFormBuilder.jam | 195 +++ src/kernel/modules.jam | 2 + src/tools/acc.jam | 17 +- src/tools/boostbook-config.jam | 8 +- src/tools/builtin.jam | 117 +- src/tools/cast.jam | 64 +- src/tools/common.jam | 106 +- src/tools/cw.jam | 5 +- src/tools/darwin.jam | 6 +- src/tools/gcc.jam | 455 +++--- src/tools/generate.jam | 36 +- src/tools/hp_cxx.jam | 15 +- src/tools/intel-win.jam | 111 +- src/tools/make.jam | 29 +- src/tools/message.jam | 55 + src/tools/msvc.jam | 1359 +++++++++-------- src/tools/package.jam | 119 +- src/tools/python.jam | 9 +- src/tools/qcc.jam | 222 +-- src/tools/stage.jam | 14 +- src/tools/testing.jam | 289 ++-- src/tools/types/exe.jam | 8 +- src/tools/types/lib.jam | 22 +- src/tools/types/obj.jam | 8 +- src/tools/vacpp.jam | 2 +- src/util/doc.jam | 8 +- src/util/numbers.jam | 69 +- src/util/option.jam | 42 +- src/util/path.jam | 65 +- src/util/regex.jam | 129 +- src/util/sequence.jam | 4 +- src/util/utility.jam | 226 ++- test/BoostBuild.py | 67 +- test/abs_workdir.py | 10 +- test/absolute_sources.py | 64 +- test/alias.py | 21 +- test/alternatives.py | 79 +- test/bad_dirname.py | 19 +- test/boostbook.py | 12 +- test/boostbook/{Jamroot => jamroot.jam} | 0 test/build_dir.py | 90 +- test/build_file.py | 42 +- test/build_no.py | 27 +- test/c_file.py | 22 +- test/chain.py | 36 +- test/clean.py | 50 +- test/composite.py | 18 +- test/conditionals.py | 8 +- test/conditionals2.py | 8 +- test/conditionals3.py | 8 +- test/conditionals_multiple.py | 7 +- test/configuration.py | 5 +- test/core_d12.py | 15 +- test/core_delete_module.py | 12 +- test/core_dependencies.py | 71 +- test/core_import_module.py | 29 +- test/core_modifiers.py | 27 +- test/core_varnames.py | 9 +- test/custom_generator.py | 28 +- test/default_build.py | 64 +- test/default_features.py | 34 +- test/default_toolset.py | 6 +- test/dependency-test/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 test/dependency_property.py | 27 +- test/dependency_test.py | 53 +- .../{Jamfile => jamfile.jam} | 0 .../{Jamfile2 => jamfile2.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 test/direct_request_test.py | 44 +- test/disambiguation.py | 31 +- test/dll_path.py | 83 +- test/double_loading.py | 19 +- test/duplicate.py | 37 +- test/example_customization.py | 18 +- test/example_gettext.py | 17 +- test/example_libraries.py | 17 +- test/example_make.py | 20 +- test/example_qt4.py | 6 +- test/expansion.py | 65 +- test/explicit.py | 38 +- test/file_name_handling.py | 5 +- test/free_features_request.py | 29 +- test/gcc_runtime.py | 24 +- test/generator_selection.py | 110 ++ test/generators-test/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 .../lib/{Jamfile => jamfile.jam} | 0 test/generators_test.py | 35 +- test/implicit_dependency.py | 30 +- test/indirect_conditional.py | 34 +- test/inherit_toolset.py | 67 +- test/inherited_dependency.py | 237 +++ test/inline.py | 42 +- test/{Jamfile => jamfile.jam} | 0 test/lib_source_property.py | 30 +- test/library_chain.py | 101 +- test/library_order.py | 80 +- test/library_property.py | 42 +- test/load_dir.py | 29 +- test/load_order.py | 55 +- test/loop.py | 25 +- test/m1-01.py | 28 +- test/m1-02.py | 44 +- test/m1-03.py | 20 +- test/make_rule.py | 46 +- test/module_actions.py | 2 +- test/ndebug.py | 39 +- test/no_type.py | 15 +- test/notfile.py | 30 +- test/ordered_include.py | 41 + test/ordered_properties.py | 38 +- test/out_of_tree.py | 41 +- test/path_features.py | 40 +- test/pch.py | 69 +- test/prebuilt.py | 38 +- test/prebuilt/ext/{Jamfile => jamfile.jam} | 0 test/prebuilt/ext/{Jamfile2 => jamfile2.jam} | 0 test/prebuilt/ext/{Jamfile3 => jamfile3.jam} | 0 .../ext/{project-root.jam => jamroot.jam} | 0 test/prebuilt/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 test/print.py | 13 +- .../dir/{Jamfile => jamfile.jam} | 0 .../dir2/{Jamfile => jamfile.jam} | 0 .../dir2/{project-root.jam => jamroot.jam} | 0 test/project-test1/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 test/project-test3/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 .../lib/{Jamfile => jamfile.jam} | 0 .../lib2/helper/{Jamfile => jamfile.jam} | 0 .../lib2/{Jamfile => jamfile.jam} | 0 .../lib3/{Jamfile => jamfile.jam} | 0 .../lib3/{project-root.jam => jamroot.jam} | 0 test/project-test4/{Jamfile => jamfile.jam} | 0 test/project-test4/{Jamfile3 => jamfile3.jam} | 0 test/project-test4/{Jamfile4 => jamfile4.jam} | 0 test/project-test4/{Jamfile5 => jamfile5.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 .../lib/{Jamfile => jamfile.jam} | 0 .../lib/{Jamfile1 => jamfile1.jam} | 0 .../lib/{Jamfile2 => jamfile2.jam} | 0 .../lib/{Jamfile3 => jamfile3.jam} | 0 .../lib2/{Jamfile => jamfile.jam} | 0 .../lib2/{Jamfile2 => jamfile2.jam} | 0 test/project_dependencies.py | 44 +- test/project_glob.py | 125 +- test/project_root_constants.py | 34 +- test/project_root_rule.py | 36 +- test/project_test1.py | 17 +- test/project_test3.py | 39 +- test/project_test4.py | 29 +- test/property_expansion.py | 19 +- test/qt4.py | 17 +- test/qt4/{Jamroot => jamroot.jam} | 0 test/railsys.py | 10 +- .../libx/{project-root.jam => jamroot.jam} | 0 .../railsys/libx/src/{Jamfile => jamfile.jam} | 0 test/railsys/program/{Jamfile => jamfile.jam} | 0 .../program/{project-root.jam => jamroot.jam} | 0 .../program/liba/{Jamfile => jamfile.jam} | 0 .../program/main/{Jamfile => jamfile.jam} | 0 test/rebuilds.py | 8 +- test/regression.py | 66 +- test/relative_sources.py | 19 +- test/remove_requirement.py | 90 +- test/resolution.py | 33 +- test/searched_lib.py | 109 +- test/skipping.py | 42 +- test/sort_rule.py | 6 +- test/source_locations.py | 35 +- test/stage.py | 157 +- test/standalone.py | 34 +- test/startup_v1.py | 84 +- test/startup_v2.py | 28 +- test/suffix.py | 37 +- test/svn_tree.py | 14 +- test/symlink.py | 41 +- test/tag.py | 24 +- test/template.py | 47 +- test/test1.py | 5 +- test/test2.py | 23 +- test/test2/{Jamfile => jamfile.jam} | 0 test/test_all.py | 180 +-- test/test_result_dumping.py | 33 + test/test_system.html | 19 +- test/testing_primitives.py | 19 +- test/testing_support.py | 61 + test/timedata.py | 121 +- test/tree.py | 18 +- test/unit_test.py | 17 +- test/unit_tests.py | 5 +- test/unused.py | 19 +- test/unused/{Jamfile => jamfile.jam} | 0 test/unused/{project-root.jam => jamroot.jam} | 0 test/use_requirements.py | 258 ++-- test/using.py | 36 +- test/v1-testing/{Jamfile => jamfile.jam} | 0 test/v1_testing.py | 30 +- test/v1_testing/{Jamfile => jamfile.jam} | 0 .../{project-root.jam => jamroot.jam} | 0 test/wrapper.py | 40 +- test/wrong_project.py | 31 +- website/index.html | 2 +- 262 files changed, 6651 insertions(+), 6299 deletions(-) rename doc/{Jamfile.v2 => jamfile.jam} (100%) rename example/customization/{Jamfile => jamfile.jam} (100%) rename example/customization/{project-root.jam => jamroot.jam} (100%) rename example/generate/{Jamroot => jamroot.jam} (100%) rename example/generator/{Jamroot => jamroot.jam} (100%) rename example/gettext/{Jamfile => jamfile.jam} (100%) rename example/gettext/{project-root.jam => jamroot.jam} (100%) rename example/hello/{Jamroot => jamroot.jam} (96%) create mode 100644 example/hello/readme.txt rename example/libraries/app/{Jamfile => jamfile.jam} (100%) rename example/libraries/{Jamroot => jamroot.jam} (100%) rename example/libraries/util/foo/{Jamfile => jamfile.jam} (100%) delete mode 100644 example/make/Jamroot create mode 100644 example/make/foo.py create mode 100644 example/make/jamroot.jam rename example/pch/{Jamroot => jamroot.jam} (100%) rename example/python_modules/{Jamroot => jamroot.jam} (100%) rename example/qt/qt3/hello/{Jamroot => jamroot.jam} (100%) rename example/qt/qt3/moccable-cpp/{Jamroot => jamroot.jam} (100%) rename example/qt/qt3/uic/{Jamroot => jamroot.jam} (100%) rename example/qt/qt4/hello/{Jamroot => jamroot.jam} (100%) rename example/qt/qt4/moccable-cpp/{Jamroot => jamroot.jam} (100%) rename example/qt/qt4/uic/{Jamroot => jamroot.jam} (100%) delete mode 100644 example/variant/Jamfile create mode 100644 example/variant/jamfile.jam rename example/variant/{project-root.jam => jamroot.jam} (100%) rename example/variant/libs/{Jamfile => jamfile.jam} (100%) rename example/versioned/{project-root.jam => jamroot.jam} (100%) delete mode 100644 generators_prototype.py create mode 100644 src/contrib/wxFormBuilder.jam create mode 100644 src/tools/message.jam rename test/boostbook/{Jamroot => jamroot.jam} (100%) rename test/dependency-test/{Jamfile => jamfile.jam} (100%) rename test/dependency-test/{project-root.jam => jamroot.jam} (100%) rename test/direct-request-test/{Jamfile => jamfile.jam} (100%) rename test/direct-request-test/{Jamfile2 => jamfile2.jam} (100%) rename test/direct-request-test/{project-root.jam => jamroot.jam} (100%) create mode 100755 test/generator_selection.py rename test/generators-test/{Jamfile => jamfile.jam} (100%) rename test/generators-test/{project-root.jam => jamroot.jam} (100%) rename test/generators-test/lib/{Jamfile => jamfile.jam} (100%) create mode 100755 test/inherited_dependency.py rename test/{Jamfile => jamfile.jam} (100%) create mode 100644 test/ordered_include.py rename test/prebuilt/ext/{Jamfile => jamfile.jam} (100%) rename test/prebuilt/ext/{Jamfile2 => jamfile2.jam} (100%) rename test/prebuilt/ext/{Jamfile3 => jamfile3.jam} (100%) rename test/prebuilt/ext/{project-root.jam => jamroot.jam} (100%) rename test/prebuilt/{Jamfile => jamfile.jam} (100%) rename test/prebuilt/{project-root.jam => jamroot.jam} (100%) rename test/project-test1/dir/{Jamfile => jamfile.jam} (100%) rename test/project-test1/dir2/{Jamfile => jamfile.jam} (100%) rename test/project-test1/dir2/{project-root.jam => jamroot.jam} (100%) rename test/project-test1/{Jamfile => jamfile.jam} (100%) rename test/project-test1/{project-root.jam => jamroot.jam} (100%) rename test/project-test3/{Jamfile => jamfile.jam} (100%) rename test/project-test3/{project-root.jam => jamroot.jam} (100%) rename test/project-test3/lib/{Jamfile => jamfile.jam} (100%) rename test/project-test3/lib2/helper/{Jamfile => jamfile.jam} (100%) rename test/project-test3/lib2/{Jamfile => jamfile.jam} (100%) rename test/project-test3/lib3/{Jamfile => jamfile.jam} (100%) rename test/project-test3/lib3/{project-root.jam => jamroot.jam} (100%) rename test/project-test4/{Jamfile => jamfile.jam} (100%) rename test/project-test4/{Jamfile3 => jamfile3.jam} (100%) rename test/project-test4/{Jamfile4 => jamfile4.jam} (100%) rename test/project-test4/{Jamfile5 => jamfile5.jam} (100%) rename test/project-test4/{project-root.jam => jamroot.jam} (100%) rename test/project-test4/lib/{Jamfile => jamfile.jam} (100%) rename test/project-test4/lib/{Jamfile1 => jamfile1.jam} (100%) rename test/project-test4/lib/{Jamfile2 => jamfile2.jam} (100%) rename test/project-test4/lib/{Jamfile3 => jamfile3.jam} (100%) rename test/project-test4/lib2/{Jamfile => jamfile.jam} (100%) rename test/project-test4/lib2/{Jamfile2 => jamfile2.jam} (100%) rename test/qt4/{Jamroot => jamroot.jam} (100%) rename test/railsys/libx/{project-root.jam => jamroot.jam} (100%) rename test/railsys/libx/src/{Jamfile => jamfile.jam} (100%) rename test/railsys/program/{Jamfile => jamfile.jam} (100%) rename test/railsys/program/{project-root.jam => jamroot.jam} (100%) rename test/railsys/program/liba/{Jamfile => jamfile.jam} (100%) rename test/railsys/program/main/{Jamfile => jamfile.jam} (100%) rename test/test2/{Jamfile => jamfile.jam} (100%) create mode 100755 test/test_result_dumping.py create mode 100755 test/testing_support.py rename test/unused/{Jamfile => jamfile.jam} (100%) rename test/unused/{project-root.jam => jamroot.jam} (100%) rename test/v1-testing/{Jamfile => jamfile.jam} (100%) rename test/v1_testing/{Jamfile => jamfile.jam} (100%) rename test/v1_testing/{project-root.jam => jamroot.jam} (100%) diff --git a/doc/Jamfile.v2 b/doc/jamfile.jam similarity index 100% rename from doc/Jamfile.v2 rename to doc/jamfile.jam diff --git a/doc/src/advanced.xml b/doc/src/advanced.xml index 598848d1d..76800ae0b 100644 --- a/doc/src/advanced.xml +++ b/doc/src/advanced.xml @@ -5,60 +5,78 @@ Overview - This section will provide the information necessary to create your own - projects using Boost.Build. The information provided here is relatively - high-level, and as well as the on-line help - system must be used to obtain low-level documentation (see ). + + This section will provide the information necessary to create your own + projects using Boost.Build. The information provided here is relatively + high-level, and as well as the on-line + help system must be used to obtain low-level documentation (see ). + - Boost.Build actually consists of two parts - Boost.Jam, a build engine - with its own interpreted language, and Boost.Build itself, implemented in - Boost.Jam's language. The chain of events when you type - bjam on the command line is: + + Boost.Build actually consists of two parts - Boost.Jam, a build engine + with its own interpreted language, and Boost.Build itself, implemented in + Boost.Jam's language. The chain of events when you type + bjam on the command line is as follows: - Boost.Jam tries to find Boost.Build and loads the top-level - module. The exact process is described in - - - The top-level module loads user-defined configuration files, - user-config.jam and - site-config.jam, which define available toolsets. + + Boost.Jam tries to find Boost.Build and loads the top-level module. + The exact process is described in - The Jamfile in the current directory is read. That in turn - might cause reading of further Jamfiles. As a result, a tree of - projects is created, with targets inside projects. + + The top-level module loads user-defined configuration files, + user-config.jam and site-config.jam + , which define available toolsets. + - Finally, using the build request specified on the command line, - Boost.Build decides which targets should be built, and how. That - information is passed back to Boost.Jam, which takes care of - actually running commands. + + The Jamfile in the current directory is read. That in turn might + cause reading of further Jamfiles. As a result, a tree of projects + is created, with targets inside projects. + + + + + Finally, using the build request specified on the command line, + Boost.Build decides which targets should be built and how. That + information is passed back to Boost.Jam, which takes care of + actually running the scheduled build action commands. + - So, to be able to successfully use Boost.Build, you need to know only - four things: + + So, to be able to successfully use Boost.Build, you need to know only four + things: - - How to configure Boost.Build + + How to configure + Boost.Build + - - How to write declares targets in Jamfiles + + How to declare targets in + Jamfiles + - - How the build process works + + How the build process + works + - Some Basics about the Boost.Jam language. See - . + + Some Basics about the Boost.Jam language. See . @@ -67,153 +85,187 @@
Boost.Jam Language - This section will describe the basics of the Boost.Jam - language—just enough for writing Jamfiles. For more information, - please see the Boost.Jam documentation. - - - Boost.Jam has an interpreted, - procedural language. On the lowest level, a - Boost.Jam program consists of variables and - rule - rules (the Jam term for function). They are grouped - in modules—there's one global module and a number of named modules. - Besides that, a Boost.Jam program contains - classes and class instances. - - Syntantically, a Boost.Jam program - consists of two kind of elements—keywords (which have a special - meaning to Boost.Jam) and literals. - - Consider this code: - -a = b ; - which assigns the value b to the variable - a. Here, = and ; - are keywords, while a and b are - literals. - - All syntax elements, even keywords, must be separated by spaces. - For example, omitting the space character before ; - will lead to a syntax error. - - - If you want to use a literal value that is the same as some keyword, the - value can be quoted: - -a = "=" ; - - - All variables in Boost.Jam have the - same type—list of strings. To define a variable one assigns a value - to it, like in the previous example. An undefined variable is the same as - a variable with an empty value. Variables can be accessed using the - $(variable) syntax. For example: - -a = $(b) $(c) ; + + This section will describe the basics of the Boost.Jam language— + just enough for writing Jamfiles. For more information, please see the + Boost.Jam documentation. - Rules are defined by specifying the rule name, the parameter names, - and the allowed size of the list value for each parameter. - + Boost.Jam has an interpreted, procedural + language. On the lowest level, a Boost.Jam + program consists of variables and rule + rules (Jam term for + function). They are grouped into modules—there is one global + module and a number of named modules. Besides that, a Boost.Jam program contains classes and class + instances. + + + + Syntantically, a Boost.Jam program + consists of two kind of elements—keywords (which have a special + meaning to Boost.Jam) and literals. + Consider this code: + +a = b ; + + which assigns the value b to the variable a + . Here, = and ; are + keywords, while a and b are + literals. + + + All syntax elements, even keywords, must be separated by spaces. For + example, omitting the space character before ; + will lead to a syntax error. + + + If you want to use a literal value that is the same as some keyword, the + value can be quoted: + +a = "=" ; + + + + + All variables in Boost.Jam have the same + type—list of strings. To define a variable one assigns a value to + it, like in the previous example. An undefined variable is the same as a + variable with an empty value. Variables can be accessed using the + $(variable) syntax. For example: + +a = $(b) $(c) ; + + + + + Rules are defined by specifying the rule name, the parameter names, and + the allowed value list size for each parameter. + rule example - ( - parameter1 : - parameter2 ? : - parameter3 + : - parameter4 * - ) - { - // body - } + ( + parameter1 : + parameter2 ? : + parameter3 + : + parameter4 * + ) + { + # rule body + } + When this rule is called, the list passed as the first argument must have exactly one value. The list passed as the second argument can either have one value of be empty. The two remaining arguments can be arbitrarily long, but the third argument may not be empty. - The overview of Boost.Jam language - statements is given below: - + + The overview of Boost.Jam language + statements is given below: + helper 1 : 2 : 3 ; -x = [ helper 1 : 2 : 3 ] ; - This code calls the named rule with the specified arguments. When the - result of the call must be used inside some expression, you need to add - brackets around the call, like shown on the second line. - -if cond { statements } [ else { statements } ] - This is a regular if-statement. The condition is composed of: - - Literals (true if at least one string is not empty) - Comparisons: a - operator b where - operator is one of =, - !=, <, >, - <=, >=. The comparison is done - pairwise between each string in the left and the right arguments. - - - Logical operations: ! a, a && - b, a || b - Grouping: ( cond ) - - -for var in list { statements } - Executes statements for each element in list, setting the variable - var to the element value. - -while cond { statements } - Repeatedly execute statements while cond remains true upon entry. - +x = [ helper 1 : 2 : 3 ] ; + + This code calls the named rule with the specified arguments. When the + result of the call must be used inside some expression, you need to add + brackets around the call, like shown on the second line. + +if cond { statements } [ else { statements } ] + + This is a regular if-statement. The condition is composed of: + + + + Literals (true if at least one string is not empty) + + + + + Comparisons: a operator b + where operator is one of + =, !=, <, + >, <= or >=. The + comparison is done pairwise between each string in the left and + the right arguments. + + + + + Logical operations: ! a, a && b, + a || b + + + + + Grouping: ( cond ) + + + + +for var in list { statements } + + Executes statements for each element in list, setting the variable + var to the element value. + +while cond { statements } + + Repeatedly execute statements while cond remains true upon entry. + return values ; - This statement should be used only inside a - rule and assigns values to the return value of the - rule. - - The return statement does not exit the rule. For example: - + + This statement should be used only inside a rule and assigns + values to the return value of the rule. + + + The return statement does not exit the rule. For + example: + rule test ( ) { - if 1 = 1 { + if 1 = 1 + { return "reasonable" ; } return "strange" ; -} will return strange, not -reasonable. - - - +} + + will return strange, not + reasonable. + + + import module ; -import module : rule ; - The first form imports the specified bjam module. All rules from - that module are made available using the qualified name: - module.rule. - The second form imports the specified rules only, and they can be called - using unqualified names. +import module : rule ; + + The first form imports the specified bjam module. All rules from that + module are made available using the qualified name: + module.rule. The second + form imports the specified rules only, and they can be called using + unqualified names. Sometimes, you'd need to specify the actual command lines to be used - when creating targets. In jam language, you use named actions to do this. - For example: + when creating targets. In jam language, you use named actions to do + this. For example: actions create-file-from-another { create-file-from-another $(<) $(>) } - This specifies a named action called - create-file-from-another. The text inside braces is - the command to invoke. The $(<) variable will be - expanded to a list of generated files, and the - $(>) variable will be expanded to a list of - source files. + This specifies a named action called + create-file-from-another. The text inside braces is the + command to invoke. The $(<) variable will be + expanded to a list of generated files, and the $(>) + variable will be expanded to a list of source files. - To flexibly adjust command line, you can define a rule with the same - name as the action, and taking three parameters -- targets, sources and - properties. For example: + + To flexibly adjust the command line, you can define a rule with the same + name as the action and taking three parameters -- targets, sources and + properties. For example: rule create-file-from-another ( targets * : sources * : properties * ) { @@ -227,18 +279,18 @@ actions create-file-from-another create-file-from-another $(OPTIONS) $(<) $(>) } - In this example, the rule checks if certain build property is specified. - If so, it sets variable OPIONS that is then used inside - the action. Note that the variables set "on a target" will be visible only - inside actions building that target, not globally. Were they set globally, - using variable named OPTIONS in two unrelated actions - would be impossible. + In this example, the rule checks if certain build property is specified. + If so, it sets variable OPIONS that is then used + inside the action. Note that the variables set "on a target" will be + visible only inside actions building that target, not globally. Were + they set globally, using variable named OPTIONS in + two unrelated actions would be impossible. - More details can be found in Jam reference, - + + More details can be found in Jam reference, . -
@@ -265,7 +317,7 @@ using tool-name ; default settings. For example, it will use the gcc executable found in the PATH, or look in some known installation locations. In most cases, this strategy works automatically. - In case you have several versions of a compiler, it's installed in some + In case you have several versions of a compiler, it is installed in some unusual location, or you need to tweak its configuration, you'll need to pass additional parameters to the using rule. The parameters to using can be different for @@ -310,39 +362,39 @@ bjam --help tool-name.init using msvc : 7.1 ; using gcc ; -If the compiler can be found in the PATH but only by a -nonstandard name, you can just supply that name: + If the compiler can be found in the PATH but only by a + nonstandard name, you can just supply that name: using gcc : : g++-3.2 ; -Otherwise, it might be necessary to supply the complete path to the -compiler executable: + Otherwise, it might be necessary to supply the complete path to the + compiler executable: using msvc : : "Z:/Programs/Microsoft Visual Studio/vc98/bin/cl" ; -Some Boost.Build toolsets will use that path to take additional -actions required before invoking the compiler, such as calling -vendor-supplied scripts to set up its required environment variables. -When compiler executables for C and C++ are different, path to the C++ -compiler executable must be specified. The “invocation command” -can be any command allowed by the operating system. For example: + Some Boost.Build toolsets will use that path to take additional actions + required before invoking the compiler, such as calling vendor-supplied + scripts to set up its required environment variables. When compiler + executables for C and C++ are different, path to the C++ compiler + executable must be specified. The “invocation command” can + be any command allowed by the operating system. For example: using msvc : : echo Compiling && foo/bar/baz/cl ; -will work. + will work. - To configure several versions of a toolset, simply invoke - the using rule multiple times: + + To configure several versions of a toolset, simply invoke the + using rule multiple times: using gcc : 3.3 ; using gcc : 3.4 : g++-3.4 ; using gcc : 3.2 : g++-3.2 ; - Note that in the first call to - using, the compiler found in the - PATH will be used, and there's no need to - explicitly specify the command. + Note that in the first call to using, the + compiler found in the PATH will be used, and there is no + need to explicitly specify the command. As shown above, both the - The list of sources can also refer to other main targets. - Targets in the same project can be referred to by name, while - targets in other projects must be qualified with a directory or a - symbolic project name. The directory/project name is separated from - the target name by a double forward slash. There's no special syntax to - distinguish the directory name from the project name—the part before - the double slash is first looked up as project name, and then as directory - name. For example: + The list of sources can also refer to other main targets. Targets in + the same project can be referred to by name, while targets in other + projects must be qualified with a directory or a symbolic project + name. The directory/project name is separated from the target name by + a double forward slash. There is no special syntax to distinguish the + directory name from the project name—the part before the double + slash is first looked up as project name, and then as directory name. + For example: - lib helper : helper.cpp ; exe a : a.cpp helper ; -# Since all project ids start with slash, ".." is directory name. +# Since all project ids start with slash, ".." is a directory name. exe b : b.cpp ..//utils ; exe c : c.cpp /boost/program_options//program_options ; - The first exe uses the library defined in the same - project. The second one uses some target (most likely library) - defined by Jamfile one level higher. Finally, the third target - uses some C++ Boost - library, referring to it by absolute symbolic name. More - information about target references can be found in and C++ Boost library, referring to it using + its absolute symbolic name. More information about target references + can be found in and . -
diff --git a/doc/src/faq.xml b/doc/src/faq.xml index 4172479c1..fe1bd5a81 100644 --- a/doc/src/faq.xml +++ b/doc/src/faq.xml @@ -2,191 +2,232 @@ - - Frequently Asked Questions + + Frequently Asked Questions -
- - How do I get the current value of feature in Jamfile? - +
+ + How do I get the current value of feature in Jamfile? + - - This is not possible, since Jamfile does not have "current" value of any - feature, be it toolset, build variant or anything else. For a single invocation of - bjam, any given main target can be built with several property sets. - For example, user can request two build variants on the command line. Or one library - is built as shared when used from one application, and as static when used from another. - Obviously, Jamfile is read only once, so generally, there's no single value of a feature - you can access in Jamfile. - + + This is not possible, since Jamfile does not have "current" value of any + feature, be it toolset, build variant or anything else. For a single + invocation of bjam, any given main target can be + built with several property sets. For example, user can request two build + variants on the command line. Or one library is built as shared when used + from one application, and as static when used from another. Each Jamfile + is read only once so generally there is no single value of a feature you + can access in Jamfile. + - A feature has a specific value only when building a target, and there are two ways how you - can use that value: - - Use conditional requirements or indirect conditional requirements. See - . - - Define a custom generator and a custom main target type. The custom generator can do arbitrary processing - or properties. See the extender manual. - - + + A feature has a specific value only when building a target, and there are + two ways you can use that value: + -
+ + + + Use conditional requirements or indirect conditional requirements. See + . + + + + Define a custom generator and a custom main target type. The custom + generator can do arbitrary processing or properties. See the extender manual. + + +
-
- - I'm getting "Duplicate name of actual target" error. What - does it mean? - - - - The most likely case is that you're trying to - compile the same file twice, with almost the same, - but differing properties. For example: +
+ + I am getting a "Duplicate name of actual target" error. What does that + mean? + + + The most likely case is that you are trying to compile the same file + twice, with almost the same, but differing properties. For example: exe a : a.cpp : <include>/usr/local/include ; exe b : a.cpp ; - - + - The above snippet requires two different compilations - of 'a.cpp', which differ only in 'include' property. - Since the 'include' property is free, Boost.Build - can't generate two objects files into different directories. - On the other hand, it's dangerous to compile the file only - once -- maybe you really want to compile with different - includes. + The above snippet requires two different compilations of + a.cpp, which differ only in their include + property. Since the include feature is declared as + free Boost.Build does not create a separate build + directory for each of its values and those two builds would both produce + object files generated in the same build directory. Ignoring this and + compiling the file only once would be dangerous as different includes + could potentially cause completely different code to be compiled. - To solve this issue, you need to decide if file should - be compiled once or twice. + To solve this issue, you need to decide if the file should be compiled + once or twice. + - - Two compile file only once, make sure that properties - are the same: - + + + To compile the file only once, make sure that properties are the same + for both target requests: exe a : a.cpp : <include>/usr/local/include ; exe b : a.cpp : <include>/usr/local/include ; - - - - If changing the properties is not desirable, for example - if 'a' and 'b' target have other sources which need - specific properties, separate 'a.cpp' into it's own target: - + + or: -obj a_obj : a.cpp : <include>/usr/local/include ; -exe a : a_obj ; - - - - To compile file twice, you can make the object file local - to the main target: - +alias a-with-include : a.cpp : <include>/usr/local/include ; +exe a : a-with-include ; +exe b : a-with-include ; + + or if you want the includes property not to affect + how any other sources added for the built a and + b executables would be compiled: - exe a : [ obj a_obj : a.cpp ] : <include>/usr/local/include ; +obj a-obj : a.cpp : <include>/usr/local/include ; +exe a : a-obj ; +exe b : a-obj ; + + + + Note that in both of these cases the include + property will be applied only for building these object files and not + any other sources that might be added for targets a and + b. + + + + + + To compile the file twice, you can tell Boost.Build to compile it to + two separate object files like so: + + obj a_obj : a.cpp : <include>/usr/local/include ; + obj b_obj : a.cpp ; + exe a : a_obj ; + exe b : b_obj ; + + or you can make the object file targets local to the main target: + + exe a : [ obj a_obj : a.cpp : <include>/usr/local/include ] ; exe b : [ obj a_obj : a.cpp ] ; - + + which will cause Boost.Build to actually change the generated object + file names a bit for you and thus avoid any conflicts. + + + Note that in both of these cases the include + property will be applied only for building these object files and not + any other sources that might be added for targets a and + b. + + + - + + A good question is why Boost.Build can not use some of the above + approaches automatically. The problem is that such magic would only help + in half of the cases, while in the other half it would be silently doing + the wrong thing. It is simpler and safer to ask the user to clarify his + intention in such cases. + +
- - A good question is why Boost.Build can't use some of the above - approaches automatically. The problem is that such magic would - require additional implementation complexities and would only - help in half of the cases, while in other half we'd be silently - doing the wrong thing. It's simpler and safe to ask user to - clarify his intention in such cases. - - -
- -
- + <section id="bbv2.faq.envar"> + <title> Accessing environment variables - + - + Many users would like to use environment variables in Jamfiles, for - example, to control location of external libraries. In many cases you - better declare those external libraries in the site-config.jam file, as - documented in the recipes - section. However, if the users already have the environment variables set - up, it's not convenient to ask them to set up site-config.jam files as - well, and using environment variables might be reasonable. + example, to control the location of external libraries. In many cases it + is better to declare those external libraries in the site-config.jam file, + as documented in the recipes + section. However, if the users already have the environment + variables set up, it may not be convenient for them to set up their + site-config.jam files as well and using the environment variables might be + reasonable. - In Boost.Build V2, each Jamfile is a separate namespace, and the - variables defined in environment is imported into the global - namespace. Therefore, to access environment variable from Jamfile, you'd - need the following code: + + Boost.Jam automatically imports all environment variables into its + built-in .ENVIRON module so user can read them from there directly or by + using the helper os.environ rule. For example: + +import os ; +local unga-unga = [ os.environ UNGA_UNGA ] ; +ECHO $(unga-unga) ; + + or a bit more realistic: import os ; local SOME_LIBRARY_PATH = [ os.environ SOME_LIBRARY_PATH ] ; exe a : a.cpp : <include>$(SOME_LIBRARY_PATH) ; -
- -
- - How to control properties order? - - - For internal reasons, Boost.Build sorts all the properties - alphabetically. This means that if you write: - -exe a : a.cpp : <include>b <include>a ; - - then the command line with first mention the "a" include directory, and - then "b", even though they are specified in the opposite order. In most - cases, the user doesn't care. But sometimes the order of includes, or - other properties, is important. For example, if one uses both the C++ - Boost library and the "boost-sandbox" (libraries in development), then - include path for boost-sandbox must come first, because some headers may - override ones in C++ Boost. For such cases, a special syntax is - provided: - -exe a : a.cpp : <include>a&&b ; - - - - The && symbols separate values of an - property, and specify that the order of the values should be preserved. You - are advised to use this feature only when the order of properties really - matters, and not as a convenient shortcut. Using it everywhere might - negatively affect performance. - -
- How to control the library order on Unix? + How to control properties order? - On the Unix-like operating systems, the order in which static - libraries are specified when invoking the linker is important, because by - default, the linker uses one pass though the libraries list. Passing the - libraries in the incorrect order will lead to a link error. Further, this - behaviour is often used to make one library override symbols from - another. So, sometimes it's necessary to force specific order of - libraries. + + For internal reasons, Boost.Build sorts all the properties alphabetically. + This means that if you write: + +exe a : a.cpp : <include>b <include>a ; + + then the command line with first mention the a include + directory, and then b, even though they are specified in the + opposite order. In most cases, the user does not care. But sometimes the + order of includes, or other properties, is important. For such cases, a + special syntax is provided: + +exe a : a.cpp : <include>a&&b ; + - Boost.Build tries to automatically compute the right order. The - primary rule is that if library a "uses" library b, then library a will - appear on the command line before library b. Library a is considered to - use b is b is present either in the sources of a or in its - requirements. To explicitly specify the use relationship one can use the - <use> feature. For example, both of the following lines will cause - a to appear before b on the command line: + + The && symbols separate property values and specify + that their order should be preserved. You are advised to use this feature + only when the order of properties really matters and not as a convenient + shortcut. Using it everywhere might negatively affect performance. + +
+ +
+ + How to control the library linking order on Unix? + + + + On Unix-like operating systems, the order in which static libraries are + specified when invoking the linker is important, because by default, the + linker uses one pass though the libraries list. Passing the libraries in + the incorrect order will lead to a link error. Further, this behaviour is + often used to make one library override symbols from another. So, + sometimes it is necessary to force specific library linking order. + + + + Boost.Build tries to automatically compute the right order. The primary + rule is that if library a "uses" library b, then + library a will appear on the command line before library + b. Library a is considered to use b + if b is present either in the a library's + sources or its usage is listed in its requirements. To explicitly specify + the use relationship one can use the + <use> feature. For example, both of the following + lines will cause a to appear before b on the + command line: lib a : a.cpp b ; lib a : a.cpp : <use>b ; @@ -194,21 +235,22 @@ lib a : a.cpp : <use>b ; - The same approach works for searched libraries, too: + The same approach works for searched libraries as well: lib z ; lib png : : <use>z ; exe viewer : viewer png z ; -
- Can I get output of external program as a variable in a Jamfile? + <title> + Can I get capture external program output using a Boost.Jam variable? - The SHELL builtin can be used for the purpose: + + The SHELL builtin rule may be used for this purpose: local gtk_includes = [ SHELL "gtk-config --cflags" ] ; @@ -216,7 +258,8 @@ local gtk_includes = [ SHELL "gtk-config --cflags" ] ;
- How to get the project root (a.k.a. Jamroot.jam) location? + <title> + How to get the project root (a.k.a. Jamroot) location? @@ -230,18 +273,20 @@ path-constant TOP : . ;
- How to change compilation flags for one file? + <title> + How to change compilation flags for one file? - If one file must be compiled with special options, you need to - explicitly declare an obj target for that file and then use - that target in your exe or lib target: + + If one file must be compiled with special options, you need to explicitly + declare an obj target for that file and then use that target + in your exe or lib target: exe a : a.cpp b ; obj b : b.cpp : <optimization>off ; Of course you can use other properties, for example to specify specific - compiler options: + C/C++ compiler options: exe a : a.cpp b ; obj b : b.cpp : <cflags>-g ; @@ -252,149 +297,162 @@ obj b : b.cpp : <cflags>-g ; exe a : a.cpp b ; obj b : b.cpp : <variant>release:<optimization>off ; -
- Why are the <code>dll-path</code> and - <code>hardcode-dll-paths</code> properties useful? + <title> + Why are the <literal>dll-path</literal> and <literal>hardcode-dll-paths + </literal> properties useful? - - (This entry is specific to Unix system.)Before answering the - questions, let's recall a few points about shared libraries. Shared - libraries can be used by several applications, or other libraries, - without physically including the library in the application. This can - greatly decrease the total size of applications. It's also possible to - upgrade a shared library when the application is already - installed. Finally, shared linking can be faster. - - - However, the shared library must be found when the application is - started. The dynamic linker will search in a system-defined list of - paths, load the library and resolve the symbols. Which means that you - should either change the system-defined list, given by the - LD_LIBRARY_PATH environment variable, or install the - libraries to a system location. This can be inconvenient when - developing, since the libraries are not yet ready to be installed, and - cluttering system paths is undesirable. Luckily, on Unix there's another - way. - - - An executable can include a list of additional library paths, which - will be searched before system paths. This is excellent for development, - because the build system knows the paths to all libraries and can include - them in executables. That's done when the hardcode-dll-paths - feature has the true value, which is the - default. When the executables should be installed, the story is - different. + + + This entry is specific to Unix systems. + + + + Before answering the questions, let us recall a few points about shared + libraries. Shared libraries can be used by several applications, or other + libraries, without physically including the library in the application + which can greatly decrease the total application size. It is also possible + to upgrade a shared library when the application is already installed. - Obviously, installed executable should not hardcode paths to your - development tree. (The stage rule explicitly disables the - hardcode-dll-paths feature for that reason.) However, you - can use the dll-path feature to add explicit paths + However, in order for application depending on shared libraries to be + started the OS may need to find the shared library when the application is + started. The dynamic linker will search in a system-defined list of paths, + load the library and resolve the symbols. Which means that you should + either change the system-defined list, given by the LD_LIBRARY_PATH + environment variable, or install the libraries to a system + location. This can be inconvenient when developing, since the libraries + are not yet ready to be installed, and cluttering system paths may be + undesirable. Luckily, on Unix there is another way. + + + + An executable can include a list of additional library paths, which will + be searched before system paths. This is excellent for development because + the build system knows the paths to all libraries and can include them in + the executables. That is done when the hardcode-dll-paths + feature has the true value, which is the + default. When the executables should be installed, the story is different. + + + + Obviously, installed executable should not contain hardcoded paths to your + development tree. (The install rule explicitly disables the + hardcode-dll-paths feature for that reason.) However, + you can use the dll-path feature to add explicit paths manually. For example: -stage installed : application : <dll-path>/usr/lib/snake - <location>/usr/bin ; +install installed : application : <dll-path>/usr/lib/snake + <location>/usr/bin ; - will allow the application to find libraries placed to - /usr/lib/snake. + will allow the application to find libraries placed in the + /usr/lib/snake directory. - If you install libraries to a nonstandard location and add an - explicit path, you get more control over libraries which will be used. A - library of the same name in a system location will not be inadvertently - used. If you install libraries to a system location and do not add any - paths, the system administrator will have more control. Each library can - be individually upgraded, and all applications will use the new library. + + If you install libraries to a nonstandard location and add an explicit + path, you get more control over libraries which will be used. A library of + the same name in a system location will not be inadvertently used. If you + install libraries to a system location and do not add any paths, the + system administrator will have more control. Each library can be + individually upgraded, and all applications will use the new library. - Which approach is best depends on your situation. If the libraries - are relatively standalone and can be used by third party applications, - they should be installed in the system location. If you have lots of - libraries which can be used only by your application, it makes sense to - install it to a nonstandard directory and add an explicit path, like the - example above shows. Please also note that guidelines for different - systems differ in this respect. The Debian guidelines prohibit any - additional search paths, and Solaris guidelines suggest that they should + + Which approach is best depends on your situation. If the libraries are + relatively standalone and can be used by third party applications, they + should be installed in the system location. If you have lots of libraries + which can be used only by your application, it makes sense to install them + to a nonstandard directory and add an explicit path, like the example + above shows. Please also note that guidelines for different systems differ + in this respect. For example, the Debian GNU guidelines prohibit any + additional search paths while Solaris guidelines suggest that they should always be used. -
Targets in site-config.jam - It is desirable to declare standard libraries available on a - given system. Putting target declaration in Jamfile is not really - good, since locations of the libraries can vary. The solution is - to declare the targets in site-config.jam: + + It is desirable to declare standard libraries available on a given system. + Putting target declaration in a specific project's Jamfile is not really + good, since locations of the libraries can vary between different + development machines and then such declarations would need to be + duplicated in different projects. The solution is to declare the targets + in Boost.Build's site-config.jam configuration file: project site-config ; lib zlib : : <name>z ; + - Recall that both site-config.jam and - user-config.jam are projects, and everything - you can do in a Jamfile you can do in those files. So, you declare - a project id and a target. Now, one can write: + + Recall that both site-config.jam and + user-config.jam are projects, and everything you can + do in a Jamfile you can do in those files as well. So, you declare a + project id and a target. Now, one can write: exe hello : hello.cpp /site-config//zlib ; - in any Jamfile. - + in any Jamfile. +
Header-only libraries - In modern C++, libraries often consist of just header files, without - any source files to compile. To use such libraries, you need to add proper - includes and, maybe, defines, to your project. But with large number of - external libraries it becomes problematic to remember which libraries are - header only, and which are "real" ones. However, with Boost.Build a - header-only library can be declared as Boost.Build target and all - dependents can use such library without remebering if it's header-only or not. - - - Header-only libraries are declared using the alias rule, - that specifies only usage requirements, for example: - -alias mylib - : # no sources - : # no build requirements - : # no default build - : <include>whatever - ; - - The includes specified in usage requirements of mylib are - automatically added to build properties of all dependents. The dependents - need not care if mylib is header-only or not, and it's possible - to later make mylib into a regular compiled library. + + In modern C++, libraries often consist of just header files, without any + source files to compile. To use such libraries, you need to add proper + includes and possibly defines to your project. But with a large number of + external libraries it becomes problematic to remember which libraries are + header only, and which ones you have to link to. However, with Boost.Build + a header-only library can be declared as Boost.Build target and all + dependents can use such library without having to remeber whether it is a + header-only library or not. - If you already have proper usage requirements declared for project where - header-only library is defined, you don't need to duplicate them for + Header-only libraries may be declared using the alias rule, + specifying their include path as a part of its usage requirements, for + example: + +alias my-lib + : # no sources + : # no build requirements + : # no default build + : <include>whatever ; + + The includes specified in usage requirements of my-lib are + automatically added to all of its dependants' build properties. The + dependants need not care if my-lib is a header-only or not, + and it is possible to later make my-lib into a regular + compiled library without having to that its dependants' declarations. + + + + If you already have proper usage requirements declared for a project where + a header-only library is defined, you do not need to duplicate them for the alias target: project my : usage-requirements <include>whatever ; alias mylib ; - + -
+
- -
\ No newline at end of file +--> diff --git a/doc/src/reference.xml b/doc/src/reference.xml index 7f16230e0..449f6925c 100644 --- a/doc/src/reference.xml +++ b/doc/src/reference.xml @@ -420,41 +420,55 @@ path-constant DATA : data/a.txt ; - A feature that combines several low-level features, making - it easy to request common build configurations. + A feature combining several low-level features, making it easy to + request common build configurations. - Allowed values: debug, release, - profile. + + Allowed values: + debug, release, + profile. + - The value debug expands to + + The value debug expands to + <optimization>off <debug-symbols>on <inlining>off <runtime-debugging>on - The value release expands to + + The value release expands to + <optimization>speed <debug-symbols>off <inlining>full <runtime-debugging>off - The value profile expands to the same as - release, plus: + + The value profile expands to the same as + release, plus: + <profiling>on <debug-symbols>on - User can define his own build variants using the variant rule from the common - module. - - Notee: Runtime - debugging is on in debug builds to suit the expectations of - people used to various IDEs. - + + Users can define their own build variants using the + variant rule from the common module. - + + + Note: Runtime debugging is on in + debug builds to suit the expectations of people used to various + IDEs. + + + + link @@ -465,10 +479,11 @@ path-constant DATA : data/a.txt ; static - A feature that controls how libraries are built. + A feature controling how libraries are built. - + + runtime linking @@ -720,7 +735,10 @@ path-constant DATA : data/a.txt ; instruction-set instruction-set - Allowed values for this feature depend on used toolset. + + Allowed values: depend on the used + toolset. + The instruction-set specifies for which specific instruction set the code should be generated. The @@ -751,6 +769,31 @@ path-constant DATA : data/a.txt ; + c++-template-depth + + + Allowed values: Any positive + integer. + + + + This feature allows configuring a C++ compiler with the maximal + template instantiation depth parameter. Specific toolsets may or may + not provide support for this feature depending on whether their + compilers provide a corresponding command-line option. + + + + Note: Due to some internal details + in the current Boost Build implementation it is not possible to have + features whose valid values are all positive integer. As a + workaround a large set of allowed values has been defined for this + feature and, if a different one is needed, user can easily add it by + calling the feature.extend rule. + + + +
@@ -970,9 +1013,9 @@ using msvc : &toolset_ops; ; - setup-amd64> - setup-i386> - setup-ia64> + setup-amd64 + setup-i386 + setup-ia64 The filename of the target platform specific environment setup script to run before invoking any of the tools diff --git a/doc/src/tasks.xml b/doc/src/tasks.xml index c6889b49e..6ae6f4c58 100644 --- a/doc/src/tasks.xml +++ b/doc/src/tasks.xml @@ -9,328 +9,339 @@ Common tasks - This section describes main targets types that Boost.Build supports - out-of-the-box. Unless otherwise noted, all mentioned main target rules have - the common signature, described in . + + This section describes main targets types that Boost.Build supports + out-of-the-box. Unless otherwise noted, all mentioned main target rules have + the common signature, described in .
Programs - exe - Programs are created using the exe rule, which follows - the common syntax. - For example: + exe + + Programs are created using the exe rule, which follows the + common syntax. For + example: exe hello : hello.cpp some_library.lib /some_project//library : <threading>multi ; - This will create an executable file from the sources -- in this case, - one C++ file, one library file present in the same directory, and - another library that is created by Boost.Build. Generally, sources - can include C and C++ files, object files and libraries. Boost.Build - will automatically try to convert targets of other types. + This will create an executable file from the sources -- in this case, one + C++ file, one library file present in the same directory, and another + library that is created by Boost.Build. Generally, sources can include C + and C++ files, object files and libraries. Boost.Build will automatically + try to convert targets of other types. + + + + + On Windows, if an application uses shared libraries, and both the + application and the libraries are built using Boost.Build, it is not + possible to immediately run the application, because the PATH + environment variable should include the path to the + libraries. It means you have to either add the paths manually, or have + the build place the application and the libraries into the same + directory. See . + + +
- - - On Windows, if an application uses dynamic libraries, and both - the application and the libraries are built by Boost.Build, its not - possible to immediately run the application, because the - PATH environment variable should include the path - to the libraries. It means you have to either add the paths - manually, or place the application and the libraries to the same - directory. See . - - - - +
+ Libraries -
- Libraries - - Libraries are created using the lib rule, which - follows the common - syntax. For example: + + Library targets are created using the lib rule, which + follows the common syntax + . For example: -lib helpers : helpers.cpp : <include>boost : : <include>. ; +lib helpers : helpers.cpp ; - - - - In the most common case, the lib creates a library from the - specified sources. Depending on the value of <link> feature the - library will be either static or shared. There are two other cases. - First is when the library is installed somewhere in compiler's search - paths, and should be searched by the compiler (typically, using the - option). The second case is where the library is - available as a prebuilt file and the full path is known. - - + This will define a library target named helpers built from + the helpers.cpp source file. + + + Depending on the given <link> feature value the library will be + either static or shared. + + + Library targets may be used to represent: + + + + Built libraries that get built from specified sources, + as is the one in the example above. + + + + + Prebuilt libraries which already exist on the system + and are just supposed to be used by the build system. Such + libraries may be searched for by the tools using them (typically + linkers referencing the library using the + option) or their path may be known in advance by the build system. + + + + + - - The syntax for these case is given below: + + The syntax for these case is given below: lib z : : <name>z <search>/home/ghost ; lib compress : : <file>/opt/libs/compress.a ; - The name property specifies the name that should be - passed to the option, and the file - property specifies the file location. The search feature - specifies paths in which to search for the library. That feature can - be specified several times, or it can be omitted, in which case only - default compiler paths will be searched. - + The name property specifies the name that should be passed to + the option, and the file property + specifies the file location. The search feature + specifies paths in which to search for the library. That feature can be + specified several times or it can be omitted, in which case only the + default compiler paths will be searched. + - The difference between using the file feature as - opposed to the name feature together with the - search feature is that file is more - precise. A specific file will be used. On the other hand, the - search feature only adds a library path, and the - name feature gives the basic name of the library. The - search rules are specific to the linker. For example, given these - definition: + + The difference between using the file feature as + opposed to the name feature together with the + search feature is that file is more precise. + A specific file will be used as opposed to the search + feature only adding a library path, or the name feature + giving only the basic name of the library. The search rules are specific + to the linker used. For example, given these definition: lib a : : <variant>release <file>/pool/release/a.so ; lib a : : <variant>debug <file>/pool/debug/a.so ; lib b : : <variant>release <file>/pool/release/b.so ; lib b : : <variant>debug <file>/pool/debug/b.so ; - It's possible to use release version of a and debug - version of b. Had we used the name and - search features, the linker would always pick either - release or debug versions. - - + It is possible to use a release version of a and debug + version of b. Had we used the name and + search features, the linker would have always picked + either the release or the debug versions. + + - - For convenience, the following syntax is allowed: + + For convenience, the following syntax is allowed: lib z ; lib gui db aux ; - and is does exactly the same as: + which has exactly the same effect as: lib z : : <name>z ; lib gui : : <name>gui ; lib db : : <name>db ; lib aux : : <name>aux ; - + - - When a library uses another library you should put that other library in - the list of sources. This will do the right thing in all cases. For - portability, you should specify library dependencies even for searched - and prebuilt libraries, othewise, static linking on Unix will not work. - For example: + + When a library references another library you should put that other + library in its list of sources. This will do the right thing in all cases. + For portability, you should specify + library dependencies even for searched and prebuilt libraries, othewise, + static linking on Unix will not work. For example: lib z ; lib png : z : <name>png ; - - - - - When a library (say, a), that has another library, (say, - b) - - is linked dynamically, the b - library will be incorporated - - in a. (If b - is dynamic library as well, then a will only refer to it, - and not include any extra code.) - - When the a - library is linked statically, Boost.Build will assure that all - executables that link to a will also link to - b. - - + + - One feature of Boost.Build that is very important for libraries is usage - requirements. - - For example, if you write: - -lib helpers : helpers.cpp : : : <include>. ; - - then the compiler include path for all targets that use - helpers will contain the directory - - where the target is defined.path to "helpers.cpp". The user - only needs to add helpers to the list of sources, - and needn't consider the requirements its use imposes on a - dependent target. This feature greatly simplifies Jamfiles. - + When a library has a shared library defined as its source, or a static + library has another static library defined as its source then any target + linking to the first library with automatically link to its source + library as well. - - - If you don't want shared libraries to include all libraries - that are specified in sources (especially statically linked ones), - you'd need to use the following: + + On the other hand, when a shared library has a static library defined as + its source then the first library will be built so that it completely + includes the second one. + + + If you do not want shared libraries to include all libraries specified + in its sources (especially statically linked ones), you would need to + use the following: lib b : a.cpp ; lib a : a.cpp : <use>b : : <library>b ; - This specifies that a uses b, and causes - all executables that link to a also link to - b. In this case, even for shared linking, the - a library won't even refer to b. - - - -
- -
- Alias - - - The alias rule gives an alternative name to - a group of targets. For example, to give the name - core to a group of three other targets with the - following code: - -alias core : im reader writer ; - Using core on the command line, or in the source - list of any other target is the same as explicitly using - im, reader, and - writer, but it is just more convenient. + This specifies that library a uses library b, + and causes all executables that link to a also link to + b. In this case, even for shared linking, the + a library will not even refer to b. + + + One Boost.Build feature that is often very useful for defining library + targets are usage requirements. For example, imagine that + you want you build a helpers library and its interface is + described in its helpers.hpp header file located in the same + directory as the helpers.cpp source file. Then you could add + the following to the Jamfile located in that same directory: + +lib helpers : helpers.cpp : : : <include>. ; + + which would automatically add the directory where the target has been + defined (and where the library's header file is located) to the compiler's + include path for all targets using the helpers library. This + feature greatly simplifies Jamfiles. + +
- - Another use of the alias rule is to change build - properties. For example, if you always want static linking for a - specific C++ Boost library, you can write the following: +
+ Alias + + + The alias rule gives an alternative name to a + group of targets. For example, to give the name core + to a group of three other targets with the following code: + +alias core : im reader writer ; + + Using core on the command line, or in the source list + of any other target is the same as explicitly using im + , reader, and writer. + + + + Another use of the alias rule is to change build properties. + For example, if you want to use link statically to the Boost Threads + library, you can write the following: alias threads : /boost/thread//boost_thread : <link>static ; - and use only the threads alias in your Jamfiles. - + and use only the threads alias in your Jamfiles. + - - You can also specify usage requirements for the - alias target. If you write the following: + + You can also specify usage requirements for the alias target. + If you write the following: alias header_only_library : : : : <include>/usr/include/header_only_library ; - then using header_only_library in sources will only add an - include path. Also note that when an alias has sources, their usage - requirements are propagated as well. For example: + then using header_only_library in sources will only add an + include path. Also note that when an alias has sources, their usage + requirements are propagated as well. For example: lib library1 : library1.cpp : : : <include>/library/include1 ; lib library2 : library2.cpp : : : <include>/library/include2 ; alias static_libraries : library1 library2 : <link>static ; exe main : main.cpp static_libraries ; - will compile main.cpp with additional includes - required for using the specified static libraries. - + will compile main.cpp with additional includes + required for using the specified static libraries. + +
-
+
+ Installing -
- Installing + + This section describes various ways to install built target and arbitrary + files. + - This section describes various ways to install built target - and arbitrary files. + Basic install - Basic install - - For installing a built target you should use the - install rule, which follows the common syntax. For - example: + + For installing a built target you should use the install + rule, which follows the + common syntax. For example: install dist : hello helpers ; - will cause the targets hello and helpers to - be moved to the dist directory, relative to - Jamfile's directory. The directory can - be changed with the location property: + will cause the targets hello and helpers to be + moved to the dist directory, relative to the + Jamfile's directory. The directory can be changed using the + location property: install dist : hello helpers : <location>/usr/bin ; - While you can achieve the same effect by changing the target name to - /usr/bin, using the location - property is better, because it allows you to use a mnemonic target - name. - + While you can achieve the same effect by changing the target name to + /usr/bin, using the location property is + better as it allows you to use a mnemonic target name. + - The location property is especially handy when the location - is not fixed, but depends on build variant or environment variables: + + The location property is especially handy when the location + is not fixed, but depends on the build variant or environment variables: -install dist : hello helpers : <variant>release:<location>dist/release - <variant>debug:<location>dist/debug ; +install dist : hello helpers : + <variant>release:<location>dist/release + <variant>debug:<location>dist/debug ; install dist2 : hello helpers : <location>$(DIST) ; - See also conditional - properties and environment variables - + See also conditional + properties and environment + variables + - Installing with all dependencies + Installing with all dependencies - - Specifying the names of all libraries to install can be boring. The - install allows you to specify only the top-level executable - targets to install, and automatically install all dependencies: + + Specifying the names of all libraries to install can be boring. The + install allows you to specify only the top-level executable + targets to install, and automatically install all dependencies: install dist : hello : <install-dependencies>on <install-type>EXE <install-type>LIB ; - will find all targets that hello depends on, and install - all of those which are either executables or libraries. More - specifically, for each target, other targets that were specified as - sources or as dependency properties, will be recursively found. One - exception is that targets referred with the use feature - are not considered, because that feature is typically used to refer to - header-only libraries. - If the set of target types is specified, only targets of that type - will be installed, otherwise, all found target will be installed. - + will find all targets that hello depends on, and install all + of those which are either executables or libraries. More specifically, for + each target, other targets that were specified as sources or as dependency + properties, will be recursively found. One exception is that targets + referred with the + use feature are not considered, as that feature is + typically used to refer to header-only libraries. If the set of target + types is specified, only targets of that type will be installed, + otherwise, all found target will be installed. + - Preserving Directory Hierarchy + Preserving Directory Hierarchy - install-source-root - By default, the install rules will stip paths from - it's sources. So, if sources include a/b/c.hpp, - the a/b part will be ignored. To make the - install rule preserve the directory hierarchy you need - to use the install-source-root feature to specify the - root of the hierarchy you are installing. Relative paths from that + install-source-root + + + By default, the install rule will strip paths from its + sources. So, if sources include a/b/c.hpp, the + a/b part will be ignored. To make the + install rule preserve the directory hierarchy you need to + use the <install-source-root> feature to specify + the root of the hierarchy you are installing. Relative paths from that root will be preserved. For example, if you write: - install headers : a/b/c.h : <location>/tmp <install-source-root>a ; - the a file named /tmp/b/c.h will be created. - + - The glob-tree rule - can be used to find all files below a given directory, making - it easy to install entire directory tree. + + The glob-tree rule can be + used to find all files below a given directory, making it easy to install + an entire directory tree. + - Installing into Several Directories + Installing into Several Directories - The alias - rule can be used when targets must be installed into several - directories: + + The alias rule can be + used when targets need to be installed into several directories: alias install : install-bin install-lib ; install install-bin : applications : /usr/bin ; @@ -340,178 +351,180 @@ install install-lib : helper : /usr/lib ; Because the install rule just copies targets, most free - features see the definition of "free" in - . - have no effect when used in requirements of the install rule. - The only two which matter are dependency - and, on Unix, - dll-path. + features see the definition of "free" in . have no + effect when used in requirements of the install rule. The + only two that matter are + dependency and, on Unix, dll-path + . - (Unix specific). On Unix, executables built with Boost.Build typically - contain the list of paths to all used dynamic libraries. For installing, + (Unix specific) On Unix, executables built using Boost.Build typically + contain the list of paths to all used shared libraries. For installing, this is not desired, so Boost.Build relinks the executable with an empty list of paths. You can also specify additional paths for installed - executables with the dll-path feature. + executables using the dll-path feature. +
-
+
+ Testing -
- - Testing - - - Boost.Build has convenient support for running unit tests. The simplest - way is the unit-test rule, which follows the common syntax. For - example: + + Boost.Build has convenient support for running unit tests. The simplest + way is the unit-test rule, which follows the common syntax. For example: unit-test helpers_test : helpers_test.cpp helpers ; - + - The unit-test rule behaves like the - exe rule, but after the executable is created it is - run. If the executable returns an error code, the build system will also - return an error and will try running the executable on the next - invocation until it runs successfully. This behaviour ensures that you - can't miss a unit test failure. - + + The unit-test rule behaves like the + exe rule, but after the executable is created + it is also run. If the executable returns an error code, the build system + will also return an error and will try running the executable on the next + invocation until it runs successfully. This behaviour ensures that you can + not miss a unit test failure. + - By default, the executable is run directly. Sometimes, it's - desirable to run the executable using some helper command. You should use the - testing.launcher property to specify the name of the - helper command. For example, if you write: - + + By default, the executable is run directly. Sometimes, it is desirable to + run the executable using some helper command. You should use the + testing.launcher property to specify the name of the helper + command. For example, if you write: unit-test helpers_test : helpers_test.cpp helpers : <testing.launcher>valgrind ; - The command used to run the executable will be: + The command used to run the executable will be: valgrind bin/$toolset/debug/helpers_test + - There are few specialized testing rules, listed below: - + + There are few specialized testing rules, listed below: + rule compile ( sources : requirements * : target-name ? ) rule compile-fail ( sources : requirements * : target-name ? ) rule link ( sources + : requirements * : target-name ? ) rule link-fail ( sources + : requirements * : target-name ? ) - - They are are given a list of sources and requirements. - If the target name is not provided, the name of the first - source file is used instead. The compile* - tests try to compile the passed source. The link* - rules try to compile and link an application from all the passed sources. - The compile and link rules expect - that compilation/linking succeeds. The compile-fail - and link-fail rules, on the opposite, expect that + + They are given a list of sources and requirements. If the target name is + not provided, the name of the first source file is used instead. The + compile* tests try to compile the passed source. The + link* rules try to compile and link an application from + all the passed sources. The compile and link + rules expect that compilation/linking succeeds. The + compile-fail and link-fail rules expect that the compilation/linking fails. - + - There are two specialized rules for running applications, which - are more powerful than the unit-test rule. The - run rule has the following signature: - + + There are two specialized rules for running applications, which are more + powerful than the unit-test rule. The run rule + has the following signature: + rule run ( sources + : args * : input-files * : requirements * : target-name ? : default-build * ) - - The rule builds application from the provided sources and runs it, - passing args and input-files - as command-line arguments. The args parameter - is passed verbatim and the values of the input-files - parameter are treated as paths relative to containing Jamfile, and are - adjusted if bjam is invoked from a different - directory. The run-fail rule is identical to the - run rule, except that it expects that the run fails. - + + The rule builds application from the provided sources and runs it, passing + args and input-files as command-line + arguments. The args parameter is passed verbatim and + the values of the input-files parameter are treated as + paths relative to containing Jamfile, and are adjusted if bjam + is invoked from a different directory. The + run-fail rule is identical to the run rule, + except that it expects that the run fails. + - All rules described in this section, if executed successfully, - create a special manifest file to indicate that the test passed. - For the unit-test rule the files is named - target-name.passed and - for the other rules it is called - target-name.test. - The run* rules also capture all output from the program, - and store it in a file named - target-name.output. + + All rules described in this section, if executed successfully, create a + special manifest file to indicate that the test passed. For the + unit-test rule the files is named + target-name.passed and for the other rules it is + called target-name.test. + The run* rules also capture all output from the program, and + store it in a file named + target-name.output. + - The run and the run-fail rules, if - the test passes, automatically delete the linked executable, to - save space. This behaviour can be suppressed by passing the - --preserve-test-targets command line option. + + The run and the run-fail rules, if the test + passes, automatically delete the linked executable, to save space. This + behaviour can be suppressed by passing the + --preserve-test-targets command line option. + - It is possible to print the list of all test targets (except for - unit-test) declared in your project, by passing - the --dump-tests command-line option. The output - will consist of lines of the form: - + + It is possible to print the list of all test targets (except for + unit-test) declared in your project, by passing the + --dump-tests command-line option. The output will consist of + lines of the form: + boost-test(test-type) path : sources - - + + - It is possible to process the list of tests, the output of - bjam during command run, and the presense/absense of the - *.test files created when test passes into - human-readable status table of tests. Such processing utilities - are not included in Boost.Build. + + It is possible to process the list of tests, the output of bjam during + command run, and the presense/absense of the *.test + files created when test passes into human-readable status table of tests. + Such processing utilities are not included in Boost.Build. + +
-
+
+ Custom commands -
+ + When you use most of main target rules, Boost.Build automatically figures + what commands to run and it what order. As soon as you want to use new + file types or support new tools, one approach is to extend Boost.Build to + smoothly support them, as documented in . + However, if there is only a single place where the new tool is used, it + might be easier to just explicitly specify the commands to run. + - Custom commands + + + Three main target rules can be used for that. The make + rule allows you to construct a single file from any number + of source file, by running a command you specify. The + notfile rule allows you to run an arbitrary command, + without creating any files. And finaly, the generate + rule allows you to describe transformation using + Boost.Build's virtual targets. This is higher-level than file names that + the make rule operates with and allows you to + create more than one target, create differently named targets depending on + properties or use more than one tool. + - - When you use most of main target rules, Boost.Build automatically - figures what commands to run and it what order. As soon as you want to - use new file types, or support new tools, one approach is to extend - Boost.Build to smoothly support them, as documented in - . However, if there's a single place - where the new tool is used, it might be easier to just explicitly - specify the commands to run. - + + The make rule is used when you want to create + one file from a number of sources using some specific command. The + notfile is used to unconditionally run a + command. + - - - Three main target rules can be used for that. The make - rule allows you to construct a single file from any - number of source file, by running a command you specify. The - notfile rule allows you to run an arbitrary - command, without creating any files. And finaly, the - generate rule allows you to describe transformation using - Boost.Build's virtual targets. This is higher-level than file names that - the make rule operates with and allows you - to create more than one target, create differently named targets - depending on properties or use more than one tool. - + - - The make rule is used when you want to - create one file from a number of sources using some specific command. - The notfile is used to unconditionally run - a command. - - - - - - Suppose you want to create file file.out from file - file.in by running command - in2out. Here is how you would do this in Boost.Build: + + Suppose you want to create file file.out from file + file.in by running command + in2out. Here is how you would do this in Boost.Build: make file.out : file.in : @in2out ; actions in2out @@ -519,16 +532,16 @@ actions in2out in2out $(<) $(>) } - If you run bjam and file.out - does not exist, Boost.Build will run the in2out - command to create that file. For more details on specifying actions, see - . - + If you run bjam and file.out does + not exist, Boost.Build will run the in2out command to + create that file. For more details on specifying actions, see . + - - It could be that you just want to run some command unconditionally, and - that command does not create any specific files. For that you can use - the notfile rule. For example: + + It could be that you just want to run some command unconditionally, and + that command does not create any specific files. For that you can use the + notfile rule. For example: notfile echo_something : @echo ; actions echo @@ -536,56 +549,56 @@ actions echo echo "something" } - The only difference from the make rule is - that the name of the target is not considered a name of a file, so - Boost.Build will unconditionally run the action. - + The only difference from the make rule is + that the name of the target is not considered a name of a file, so + Boost.Build will unconditionally run the action. + - - - The generate rule is used when you want to - express transformations using Boost.Build's virtual targets, as opposed - to just filenames. The generate rule has - the standard main target rule signature, but you are required to specify - the generating-rule property. The value of the - property should be in the form - @rule-name, the named rule - should have the following signature: + + + The generate rule is used when you want to + express transformations using Boost.Build's virtual targets, as opposed to + just filenames. The generate rule has the + standard main target rule signature, but you are required to specify the + generating-rule property. The value of the property + should be in the form + @rule-name, the named rule should + have the following signature: rule generating-rule ( project name : property-set : sources * ) - and will be called with an instance of the project-target - class, the name of the main target, an instance of the - property-set class containing build properties, and the - list of instances of the virtual-target class corresponding - to sources. The rule must return a list of virtual-target - instances. The interface of the virtual-target class can be - learned by looking at the build/virtual-target.jam - file. The generate example contained in the - Boost.Build distribution illustrates how the generate - rule can be used. - + and will be called with an instance of the project-target + class, the name of the main target, an instance of the + property-set class containing build properties, and the list + of instances of the virtual-target class corresponding to + sources. The rule must return a list of virtual-target + instances. The interface of the virtual-target class can be + learned by looking at the build/virtual-target.jam + file. The generate example contained in the + Boost.Build distribution illustrates how the generate + rule can be used. + +
-
+
+ Precompiled Headers -
- Precompiled Headers + + Precompiled headers is a mechanism to speed up compilation by creating a + partially processed version of some header files, and then using that + version during compilations rather then repeatedly parsing the original + headers. Boost.Build supports precompiled headers with gcc and msvc + toolsets. + - - Precompiled headers is a mechanism to speed up compilation by creating a - partially processed version of some header files, and then using that - version during compilations rather then repeatedly parsing the original - headers. Boost.Build supports precompiled headers with gcc and msvc - toolsets. - + + To use precompiled headers, follow the following steps: + - - To use precompiled headers, follow the following steps: - - - - + + + Create a header that includes headers used by your project that you want precompiled. It is better to include only headers that are sufficiently stable — like headers from the compiler and @@ -593,9 +606,11 @@ rule generating-rule ( project name : property-set : sources * ) BOOST_BUILD_PCH_ENABLED, so that the potentially expensive inclusion of headers is not done when PCH is not enabled. Include the new header at the top of your source files. - + + - + + Declare a new Boost.Build target for the precompiled header and add that precompiled header to the sources of the target whose compilation you want to speed up: @@ -606,91 +621,99 @@ exe main : main.cpp pch ; You can use the c-pch rule if you want to use the precompiled header in C programs. - + - - The pch example in Boost.Build distribution can be - used as reference. - + + The pch example in Boost.Build distribution can be + used as reference. + - - Please note the following: - + + Please note the following: + - - + + + The inclusion of the precompiled header must be the first thing in a source file, before any code or preprocessor directives. - + + - + + The build properties used to compile the source files and the precompiled header must be the same. Consider using project requirements to assure this. - + + - + + Precompiled headers must be used purely as a way to improve compilation time, not to save the number of #include statements. If a source file needs to include some header, explicitly include it in the source file, even if the same header is included from the precompiled header. This makes sure that your project will build even if precompiled headers are not supported. - + + - + + On the gcc compiler, the name of the header being precompiled must be equal to the name of the cpp-pch target. This is a gcc requirement. - + + - + + Prior to version 4.2, the gcc compiler did not allow anonymous namespaces in precompiled headers, which limits their utility. See the - bug + bug report for details. - - -
+ + + +
-
- Generated headers +
+ Generated headers - Usually, Boost.Build handles implicit dependendies completely - automatically. For example, for C++ files, all #include - statements are found and handled. The only aspect where user help - might be needed is implicit dependency on generated files. + + Usually, Boost.Build handles implicit dependendies completely + automatically. For example, for C++ files, all #include + statements are found and handled. The only aspect where user help might be + needed is implicit dependency on generated files. + - By default, Boost.Build handles such dependencies within one - main target. For example, assume that main target "app" has two - sources, "app.cpp" and "parser.y". The latter source is converted - into "parser.c" and "parser.h". Then, if "app.cpp" includes - "parser.h", Boost.Build will detect this dependency. Moreover, - since "parser.h" will be generated into a build directory, the - path to that directory will automatically added to include - path. - - Making this mechanism work across main target boundaries is - possible, but imposes certain overhead. For that reason, if - there's implicit dependency on files from other main targets, the - <implicit-dependency> [ link ] feature must - be used, for example: + + By default, Boost.Build handles such dependencies within one main target. + For example, assume that main target "app" has two sources, "app.cpp" and + "parser.y". The latter source is converted into "parser.c" and "parser.h". + Then, if "app.cpp" includes "parser.h", Boost.Build will detect this + dependency. Moreover, since "parser.h" will be generated into a build + directory, the path to that directory will automatically added to include + path. + + + Making this mechanism work across main target boundaries is possible, but + imposes certain overhead. For that reason, if there is implicit dependency + on files from other main targets, the <implicit-dependency> + [ link ] feature must be used, for example: lib parser : parser.y ; exe app : app.cpp : <implicit-dependency>parser ; - - - The above example tells the build system that when scanning - all sources of "app" for implicit-dependencies, it should consider - targets from "parser" as potential dependencies. - -
- + The above example tells the build system that when scanning all sources of + "app" for implicit-dependencies, it should consider targets from "parser" + as potential dependencies. + +
- OBJ generator that could potentially cover the +# Boost Build bug by clearing its internal viable source target type state. +obj other-obj : source.unga_cpp ; +""") + + t.run_build_system() + t.expect_addition("bin/$toolset/debug/dummy.obj") + t.expect_addition("Other/bin/$toolset/debug/other-obj.obj") + t.expect_nothing_more() + + t.cleanup() + + +################################################################################ +# +# main() +# ------ +# +################################################################################ + +test_generator_added_after_already_building_a_target_of_its_target_type() +test_using_a_derived_source_type_created_after_generator_already_used() diff --git a/test/generators-test/Jamfile b/test/generators-test/jamfile.jam similarity index 100% rename from test/generators-test/Jamfile rename to test/generators-test/jamfile.jam diff --git a/test/generators-test/project-root.jam b/test/generators-test/jamroot.jam similarity index 100% rename from test/generators-test/project-root.jam rename to test/generators-test/jamroot.jam diff --git a/test/generators-test/lib/Jamfile b/test/generators-test/lib/jamfile.jam similarity index 100% rename from test/generators-test/lib/Jamfile rename to test/generators-test/lib/jamfile.jam diff --git a/test/generators_test.py b/test/generators_test.py index 209960845..549a8e0ac 100644 --- a/test/generators_test.py +++ b/test/generators_test.py @@ -1,41 +1,30 @@ #!/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) +# 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) -from BoostBuild import Tester, List -import os +import BoostBuild -t = Tester() +t = BoostBuild.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/" * BoostBuild.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")) t.expect_addition("bin/$toolset/debug/a.exe") - t.expect_addition(["lib/bin/$toolset/debug/c.obj", - "lib/bin/$toolset/debug/auxilliary.lib", - ]) - + "lib/bin/$toolset/debug/auxilliary.lib"]) t.run_build_system(subdir='lib') - t.expect_addition(["lib/bin/$toolset/debug/auxilliary2.dll"]) t.run_build_system(subdir='lib', extra_args="link=static") - t.expect_addition(["lib/bin/$toolset/debug/link-static/auxilliary2.lib"]) t.cleanup() diff --git a/test/implicit_dependency.py b/test/implicit_dependency.py index 5fecdd23a..4fc103ac6 100644 --- a/test/implicit_dependency.py +++ b/test/implicit_dependency.py @@ -1,20 +1,18 @@ #!/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) +# 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 is respected even if the -# target referred-to is not build itself, but only referred -# to by . +# Test the is respected even if the target referred to is +# not built itself, but only referred to by . -from BoostBuild import Tester, List -import string +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ +t.write("jamroot.jam", """ make a.h : : gen-header ; explicit a.h ; @@ -37,20 +35,14 @@ else } """) -t.write("hello.cpp", """ +t.write("hello.cpp", """ #include "a.h" - -int main() -{ - return i; -} +int main() { return i; } """) - t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.exe") t.cleanup() - diff --git a/test/indirect_conditional.py b/test/indirect_conditional.py index b877e37cc..6e9c18141 100644 --- a/test/indirect_conditional.py +++ b/test/indirect_conditional.py @@ -1,16 +1,15 @@ #!/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) +# 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 +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ +t.write("jamroot.jam", """ exe a1 : a1.cpp : @a1-rule ; rule a1-rule ( properties * ) @@ -21,7 +20,8 @@ rule a1-rule ( properties * ) } } -exe a2 : a2.cpp : @$(__name__).a2-rule debug:speed ; +exe a2 : a2.cpp : @$(__name__).a2-rule + debug:speed ; rule a2-rule ( properties * ) { @@ -31,7 +31,8 @@ rule a2-rule ( properties * ) } } -exe a3 : a3.cpp : @$(__name__).a3-rule-1 @$(__name__).a3-rule-2 ; +exe a3 : a3.cpp : @$(__name__).a3-rule-1 + @$(__name__).a3-rule-2 ; rule a3-rule-1 ( properties * ) { @@ -48,32 +49,26 @@ rule a3-rule-2 ( properties * ) return speed ; } } - """) -t.write("a1.cpp", """ +t.write("a1.cpp", """ #ifdef OK int main() {} #endif - """) -t.write("a2.cpp", """ +t.write("a2.cpp", """ #ifdef OK int main() {} #endif - """) -t.write("a3.cpp", """ +t.write("a3.cpp", """ #ifdef OK int main() {} #endif - """) - - t.run_build_system() t.expect_addition("bin/$toolset/debug/a1.exe") @@ -81,4 +76,3 @@ t.expect_addition("bin/$toolset/debug/optimization-speed/a2.exe") t.expect_addition("bin/$toolset/debug/optimization-speed/a3.exe") t.cleanup() - diff --git a/test/inherit_toolset.py b/test/inherit_toolset.py index dfb4e1a26..ca050d2c4 100644 --- a/test/inherit_toolset.py +++ b/test/inherit_toolset.py @@ -1,76 +1,59 @@ #!/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) +# 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 -from string import find +import BoostBuild +import string -t = Tester(pass_toolset=0) +t = BoostBuild.Tester(pass_toolset=0) -t.write("a.cpp", """ +t.write("a.cpp", """ """) -t.write("yfc1.jam", """ -import feature : extend ; -import generators : register-standard ; +t.write("yfc1.jam", """ +import feature ; +import generators ; feature.extend toolset : yfc1 ; - -rule init ( ) -{ -} +rule init ( ) { } generators.register-standard yfc1.compile : CPP : OBJ : yfc1 ; generators.register-standard yfc1.link : OBJ : EXE : yfc1 ; -actions compile -{ - yfc1-compile -} - -actions link -{ - yfc1-link -} +actions compile { yfc1-compile } +actions link { yfc1-link } """) -t.write("yfc2.jam", """ -import feature : extend ; -import toolset : inherit ; +t.write("yfc2.jam", """ +import feature ; +import toolset ; feature.extend toolset : yfc2 ; toolset.inherit yfc2 : yfc1 ; +rule init ( ) { } -rule init ( ) -{ -} - -actions link -{ - yfc2-link -} +actions link { yfc2-link } """) -t.write("Jamfile", """ -exe a : a.cpp ; +t.write("jamfile.jam", """ +exe a : a.cpp ; """) -t.write("project-root.jam", """ +t.write("jamroot.jam", """ using yfc1 ; """) t.run_build_system("-n -d2 yfc1") -t.fail_test(find(t.stdout(), "yfc1-link") == -1) +t.fail_test(string.find(t.stdout(), "yfc1-link") == -1) -# Make sure we don't have to explicit 'use' yfc1. -t.write("project-root.jam", """ +# Make sure we do not have to explicitly 'use' yfc1. +t.write("jamroot.jam", """ using yfc2 ; """) t.run_build_system("-n -d2 yfc2") -t.fail_test(find(t.stdout(), "yfc2-link") == -1) +t.fail_test(string.find(t.stdout(), "yfc2-link") == -1) t.cleanup() - diff --git a/test/inherited_dependency.py b/test/inherited_dependency.py new file mode 100755 index 000000000..7d4895e07 --- /dev/null +++ b/test/inherited_dependency.py @@ -0,0 +1,237 @@ +#!/usr/bin/python +# +# Copyright (c) 2008 Steven Watanabe +# +# 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 + +tester = BoostBuild.Tester() + + +################################################################################ +# +# Test without giving the project an explicit id. +# +################################################################################ + +tester.write("jamroot.jam", """ +lib test : test.cpp ; +project : requirements test ; +build-project a ; +""") + +tester.write("test.cpp", """ +#ifdef _WIN32 + __declspec(dllexport) +#endif +void foo() {} +""") + +tester.write("a/test1.cpp", """ +int main() {} +""") + +tester.write("a/jamfile.jam", """ +exe test1 : test1.cpp ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Run the same test from the "a" directory. +# +################################################################################ + +tester.run_build_system(subdir="a") + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# This time, do give the project an id. +# +################################################################################ + +tester.write("jamroot.jam", """ +lib test : test.cpp ; +project test_project : requirements test ; +build-project a ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Now, give the project an id in its attributes. +# +################################################################################ + +tester.write("jamroot.jam", """ +lib test : test.cpp ; +project : id test_project : requirements test ; +build-project a ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Give the project an id in both ways at once. +# +################################################################################ + +tester.write("jamroot.jam", """ +lib test : test.cpp ; +project test_project1 : id test_project : requirements test ; +build-project a ; +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") +tester.expect_addition("a/bin/$toolset/debug/test1.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Test an absolute path in native format. +# +################################################################################ + +tester.write("jamroot.jam", """ +import path ; +path-constant here : . ; +current-location = [ path.native [ path.root [ path.make $(here) ] [ path.pwd ] + ] ] ; +project test : requirements $(current-location)/a/test1.cpp ; +exe test : test.cpp ; +""") + +tester.run_build_system() +tester.expect_addition("bin/$toolset/debug/test.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Test an absolute path in canonical format. +# +################################################################################ + +tester.write("jamroot.jam", """ +import path ; +path-constant here : . ; +current-location = [ path.root [ path.make $(here) ] [ path.pwd ] ] ; +project test : requirements $(current-location)/a/test1.cpp ; +exe test : test.cpp ; +""") + +tester.run_build_system() +tester.expect_addition("bin/$toolset/debug/test.exe") + +tester.rm("bin") +tester.rm("a/bin") + + +################################################################################ +# +# Test dependency properties (e.g. ) whose targets are specified using a +# relative path. +# +################################################################################ + +# Use jamroot.jam rather than jamfile.jam to avoid inheriting the from +# the parent as that would would make test3 a source of itself. +tester.write("b/jamroot.jam", """ +obj test3 : test3.cpp ; +""") + +tester.write("b/test3.cpp", """ +void bar() {} +""") + +tester.write("jamroot.jam", """ +project test : requirements b//test3 ; +build-project a ; +""") + +tester.write("a/jamfile.jam", """ +exe test : test1.cpp ; +""") + +tester.write("a/test1.cpp", """ +void bar(); +int main() { bar(); } +""") + +tester.run_build_system() +tester.expect_addition("b/bin/$toolset/debug/test3.obj") +tester.expect_addition("a/bin/$toolset/debug/test.exe") + +tester.rm("bin") +tester.rm("a") +tester.rm("jamroot.jam") +tester.rm("test.cpp") + + +################################################################################ +# +# Test that source-location is respected. +# +################################################################################ + +tester.write("build/jamroot.jam", """ +project : requirements test.cpp : source-location ../src ; +""") + +tester.write("src/test.cpp", """ +int main() {} +""") + +tester.write("build/a/jamfile.jam", """ +project : source-location ../../a_src ; +exe test : test1.cpp ; +""") + +tester.write("a_src/test1.cpp", """ +""") + +tester.run_build_system(subdir="build/a") +tester.expect_addition("build/a/bin/$toolset/debug/test.exe") + +tester.cleanup() diff --git a/test/inline.py b/test/inline.py index 39bfecd75..df6c09892 100644 --- a/test/inline.py +++ b/test/inline.py @@ -1,31 +1,25 @@ #!/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) +# 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 +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ +t.write("jamroot.jam", """ project : requirements static ; -exe a : a.cpp [ lib helper : helper.cpp ] ; +exe a : a.cpp [ lib helper : helper.cpp ] ; """) t.write("a.cpp", """ extern void helper(); -int main() -{ - return 0; -} - +int main() {} """) t.write("helper.cpp", """ -void helper() -{ -} +void helper() {} """) t.run_build_system() @@ -37,13 +31,13 @@ t.expect_addition("bin/$toolset/debug/link-static/a__helper.lib") t.rm("bin") -# Now check that inline targets with the same name but -# present in different places are not confused between -# each other, and with top-level targets. -t.write("Jamroot", """ + +# Now check that inline targets with the same name but present in different +# places are not confused between each other, and with top-level targets. +t.write("jamroot.jam", """ project : requirements static ; exe a : a.cpp [ lib helper : helper.cpp ] ; -exe a2 : a.cpp [ lib helper : helper.cpp ] ; +exe a2 : a.cpp [ lib helper : helper.cpp ] ; """) t.run_build_system() @@ -51,9 +45,10 @@ t.expect_addition("bin/$toolset/debug/link-static/a.exe") t.expect_addition("bin/$toolset/debug/link-static/a__helper.lib") t.expect_addition("bin/$toolset/debug/link-static/a2__helper.lib") -# Check that the 'alias' target does not change name of -# inline targets, and that inline targets are explicit. -t.write("Jamroot", """ + +# Check that the 'alias' target does not change the name of inline targets, and +# that inline targets are explicit. +t.write("jamroot.jam", """ project : requirements static ; alias a : [ lib helper : helper.cpp ] ; explicit a ; @@ -67,4 +62,3 @@ t.run_build_system("a") t.expect_addition("bin/$toolset/debug/link-static/helper.lib") t.cleanup() - diff --git a/test/Jamfile b/test/jamfile.jam similarity index 100% rename from test/Jamfile rename to test/jamfile.jam diff --git a/test/lib_source_property.py b/test/lib_source_property.py index 34568a4b1..2290c1fbf 100644 --- a/test/lib_source_property.py +++ b/test/lib_source_property.py @@ -1,28 +1,27 @@ #!/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) +# 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) -# Regression test: if a library had no explicit sources, but -# only properties, it was built as it it were searched -# library, and the specified sources were not compiled. -from BoostBuild import Tester, List +# Regression test: if a library had no explicit sources, but only +# properties, it was built as if it were a searched library, and the specified +# sources were not compiled. -# Create a temporary working directory -t = Tester() +import BoostBuild -# Create the needed files -t.write("Jamroot", """ +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ lib a : : a.cpp ; """) + t.write("a.cpp", """ #ifdef _WIN32 __declspec(dllexport) #endif void foo() {} - """) t.run_build_system() @@ -30,8 +29,9 @@ t.expect_addition("bin/$toolset/debug/a.obj") t.rm("bin") -# Now try with -t.write("Jamroot", """ + +# Now try with . +t.write("jamroot.jam", """ rule test ( properties * ) { return a.cpp ; diff --git a/test/library_chain.py b/test/library_chain.py index f8ecb84be..6df744727 100644 --- a/test/library_chain.py +++ b/test/library_chain.py @@ -1,34 +1,31 @@ #!/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) +# 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 +# Test that a chain of libraries works ok, no matter if we use static or shared +# linking. + +import BoostBuild import string import os -t = Tester() +t = BoostBuild.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. +t.write("jamfile.jam", """ +# 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 ; +exe main : main.cpp b ; """) -t.write("main.cpp", """ +t.write("main.cpp", """ void foo(); - -int main() { foo(); return 0; } - +int main() { foo(); } """) -t.write("project-root.jam", """ +t.write("jamroot.jam", """ """) t.write("a/a.cpp", """ @@ -41,26 +38,24 @@ void #if defined(_WIN32) __declspec(dllexport) #endif -geek() {} +geek() {} """) -t.write("a/Jamfile", """ -lib a : a.cpp ; +t.write("a/jamfile.jam", """ +lib a : a.cpp ; """) -t.write("b/b.cpp", """ +t.write("b/b.cpp", """ void geek(); - -void +void #if defined(_WIN32) __declspec(dllexport) #endif foo() { geek(); } - """) -t.write("b/Jamfile", """ -lib b : b.cpp ../a//a ; +t.write("b/jamfile.jam", """ +lib b : b.cpp ../a//a ; """) t.run_build_system(stderr=None) @@ -71,84 +66,92 @@ t.run_build_system("link=static") t.expect_addition("bin/$toolset/debug/link-static/main.exe") t.rm(["bin", "a/bin", "b/bin"]) -# Check that works for static linking. -t.write("b/Jamfile", """ -lib b : b.cpp : ../a//a ; +# Check that works for static linking. +t.write("b/jamfile.jam", """ +lib b : b.cpp : ../a//a ; """) + t.run_build_system("link=static") t.expect_addition("bin/$toolset/debug/link-static/main.exe") t.rm(["bin", "a/bin", "b/bin"]) -t.write("b/Jamfile", """ -lib b : b.cpp ../a//a/shared : static ; + +t.write("b/jamfile.jam", """ +lib b : b.cpp ../a//a/shared : static ; """) t.run_build_system() t.expect_addition("bin/$toolset/debug/main.exe") + t.rm(["bin", "a/bin", "b/bin"]) -# Test that putting library in sources of a searched library -# works. -t.write("Jamfile", """ + +# Test that putting a library in sources of a searched library works. +t.write("jamfile.jam", """ exe main : main.cpp png ; lib png : z : png ; lib z : : zzz ; """) + t.run_build_system("-a -d+2", status=None, stderr=None) -# Try to find the "zzz" string either in response file -# (for Windows compilers), or in standard output. +# Try to find the "zzz" string either in response file (for Windows compilers), +# or in the standard output. rsp = t.adjust_names("bin/$toolset/debug/main.exe.rsp")[0] -if os.path.exists(rsp) and string.find(open(rsp).read(), "zzz") != -1: +if os.path.exists(rsp) and ( string.find(open(rsp).read(), "zzz") != -1 ): pass elif string.find(t.stdout(), "zzz") != -1: pass else: t.fail_test(1) -# -# Test main -> libb -> liba chain -# in the case where liba is a file, not a Boost.Build target. -# +# Test main -> libb -> liba chain in the case where liba is a file and not a +# Boost.Build target. t.rm(".") -t.write("Jamroot", "") -t.write("a/Jamfile", """ + +t.write("jamroot.jam", "") + +t.write("a/jamfile.jam", """ lib a : a.cpp ; install dist : a ; """) + t.write("a/a.cpp", """ #if defined(_WIN32) __declspec(dllexport) #endif void a() {} """) + t.run_build_system(subdir="a") t.expect_addition("a/dist/a.dll") -if (os.name == 'nt' or os.uname()[0].lower().startswith('cygwin')) and get_toolset() != 'gcc': +if ( ( os.name == 'nt' ) or os.uname()[0].lower().startswith('cygwin') ) and \ + ( BoostBuild.get_toolset() != 'gcc' ): # This is windows import library -- we know the exact name. file = "a/dist/a.lib" else: file = t.adjust_names(["a/dist/a.dll"])[0] -t.write("b/Jamfile", """ +t.write("b/jamfile.jam", """ lib b : b.cpp ../%s ; """ % file) + t.write("b/b.cpp", """ #if defined(_WIN32) __declspec(dllimport) #endif void a(); - #if defined(_WIN32) __declspec(dllexport) #endif void b() { a(); } """) -t.write("Jamroot", """ +t.write("jamroot.jam", """ exe main : main.cpp b//b ; """) + t.write("main.cpp", """ #if defined(_WIN32) __declspec(dllimport) @@ -160,6 +163,4 @@ int main() { b(); } t.run_build_system() t.expect_addition("bin/$toolset/debug/main.exe") - - t.cleanup() diff --git a/test/library_order.py b/test/library_order.py index f5638a7ba..3a92d2473 100644 --- a/test/library_order.py +++ b/test/library_order.py @@ -1,81 +1,61 @@ #!/usr/bin/python -# Copyright 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) +# Copyright 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) -from BoostBuild import Tester, List +# Test that on compilers sensitive to library order on linker's command line, we +# generate the correct order. + +import BoostBuild import string -# Test that on compilers which are sensitive to library order on -# linker's command line, we generate the right order. -t = Tester() +t = BoostBuild.Tester() -t.write("a.cpp", """ +t.write("a.cpp", """ void b(); - -void a() -{ - b(); -} - +void a() { b(); } """) -t.write("b.cpp", """ +t.write("b.cpp", """ void c(); - -void b() -{ - c(); -} +void b() { c(); } """) -t.write("c.cpp", """ +t.write("c.cpp", """ void d(); - -void c() -{ - d(); -} - +void c() { d(); } """) -t.write("d.cpp", """ +t.write("d.cpp", """ void d() {} - """) -# The order of libraries in 'main' is crafted so that -# we get error unless we do something about the order ourselfs. -t.write("Jamfile", """ +# The order of libraries in 'main' is crafted so that we get error unless we do +# something about the order ourselves. +t.write("jamfile.jam", """ exe main : main.cpp libd libc libb liba ; lib libd : d.cpp ; lib libc : c.cpp : static libd ; lib libb : b.cpp : libc ; lib liba : a.cpp : libb ; - """) -t.write("main.cpp", """ +t.write("main.cpp", """ void a(); - -int main() -{ - a(); - return 0; -} - +int main() { a(); } """) -t.write("project-root.jam", """ +t.write("jamroot.jam", """ """) t.run_build_system() t.expect_addition("bin/$toolset/debug/main.exe") -# Test the order between searched libraries -t.write("Jamfile", """ + +# Test the order between searched libraries. +t.write("jamfile.jam", """ exe main : main.cpp png z ; lib png : z : png ; lib z : : zzz ; @@ -84,7 +64,7 @@ lib z : : zzz ; t.run_build_system("-a -n -d+2") t.fail_test(string.find(t.stdout(), "png") > string.find(t.stdout(), "zzz")) -t.write("Jamfile", """ +t.write("jamfile.jam", """ exe main : main.cpp png z ; lib png : : png ; lib z : png : zzz ; @@ -93,12 +73,13 @@ lib z : png : zzz ; t.run_build_system("-a -n -d+2") t.fail_test(string.find(t.stdout(), "png") < string.find(t.stdout(), "zzz")) -# Test the order between prebuilt libraries +# Test the order between prebuilt libraries. t.write("first.a", "") + t.write("second.a", "") -t.write("Jamfile", """ +t.write("jamfile.jam", """ exe main : main.cpp first second ; lib first : second : first.a ; lib second : : second.a ; @@ -107,7 +88,7 @@ lib second : : second.a ; t.run_build_system("-a -n -d+2") t.fail_test(string.find(t.stdout(), "first") > string.find(t.stdout(), "second")) -t.write("Jamfile", """ +t.write("jamfile.jam", """ exe main : main.cpp first second ; lib first : : first.a ; lib second : first : second.a ; @@ -116,7 +97,4 @@ lib second : first : second.a ; t.run_build_system("-a -n -d+2") t.fail_test(string.find(t.stdout(), "first") < string.find(t.stdout(), "second")) - - - t.cleanup() diff --git a/test/library_property.py b/test/library_property.py index fb9e230ce..9430bb705 100644 --- a/test/library_property.py +++ b/test/library_property.py @@ -1,28 +1,26 @@ #!/usr/bin/python -# Copyright 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) +# Copyright 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 the property has no effect on "obj" targets. -# Previously, it affected all targets, so +# Test that the property has no effect on "obj" targets. Previously, +# it affected all targets, so # -# project : requirements foo ; -# exe a : a.cpp helper ; -# obj helper : helper.cpp : off ; +# project : requirements foo ; +# exe a : a.cpp helper ; +# obj helper : helper.cpp : off ; # -# caused 'foo' to be built with and without optimization. -from BoostBuild import Tester, List +# caused 'foo' to be built with and without optimization. -# Create a temporary working directory -t = Tester() +import BoostBuild -t.write("Jamfile", """ -project - : requirements lib//x - ; +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ +project : requirements lib//x ; exe a : a.cpp foo ; -obj foo : foo.cpp : release ; +obj foo : foo.cpp : release ; """) t.write("a.cpp", """ @@ -35,9 +33,6 @@ void gee(); void aux() { gee(); } """) -t.write("project-root.jam", """ -""") - t.write("lib/x.cpp", """ void #if defined(_WIN32) @@ -46,17 +41,16 @@ __declspec(dllexport) gee() {} """) -t.write("lib/Jamfile", """ +t.write("lib/jamfile.jam", """ lib x : x.cpp ; """) -t.write("lib/project-root.jam", """ +t.write("lib/jamroot.jam", """ """) t.run_build_system() t.expect_addition("bin/$toolset/debug/a.exe") t.expect_nothing("lib/bin/$toolset/release/x.obj") + t.cleanup() - - diff --git a/test/load_dir.py b/test/load_dir.py index 6ee5376d3..09a59f951 100644 --- a/test/load_dir.py +++ b/test/load_dir.py @@ -1,9 +1,8 @@ #!/usr/bin/python """ -Traverses a directory and output the code that would -create the same directory structure during testing. -Assumes that the instance of Tester is called 't'. +Traverses a directory and output the code that would create the same directory +structure during testing. Assumes that the instance of Tester is called 't'. """ import sys @@ -14,6 +13,7 @@ import string def usage(): print "usage: load_dir.py directory" + def remove_first_component(path): result = [path] while 1: @@ -22,8 +22,7 @@ def remove_first_component(path): break result[:1] = list(s) return apply(os.path.join, result[1:]) - - + def create_file(arg, dirname, fnames): for n in fnames: @@ -35,17 +34,17 @@ def create_file(arg, dirname, fnames): print l, print '\n""")\n' -header = """#!/usr/bin/python + +header = """#!/usr/bin/python # Copyright (C) FILL SOMETHING HERE 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) -from BoostBuild import Tester, List -import string +import BoostBuild -t = Tester() +t = BoostBuild.Tester() """ footer = """ @@ -56,7 +55,8 @@ t.expect_addition("bin/$toolset/debug/FILL_SOME_HERE.exe") t.cleanup() """ - + + def main(): if len(sys.argv) != 2: usage() @@ -69,16 +69,13 @@ def main(): if not os.path.isdir(path): print "Path '%s' is not a directory" % (path,) - + print header - + os.path.walk(path, create_file, None) print footer + if __name__ == '__main__': main() - - - - diff --git a/test/load_order.py b/test/load_order.py index 25b4ba803..34ceaaf44 100644 --- a/test/load_order.py +++ b/test/load_order.py @@ -5,71 +5,60 @@ # 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 +# Test that we load parent projects before loading children. -t = Tester() +import BoostBuild +import string -t.write("Jamfile", """ +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ use-project /child : child ; - ECHO "Setting parent requirements" ; -project - : requirements PASS_THE_TEST - ; - -alias x : child//main ; +project : requirements PASS_THE_TEST ; +alias x : child//main ; """) -t.write("project-root.jam", """ -""") - -t.write("child/Jamfile", """ +t.write("child/jamfile.jam", """ ECHO "Setting child requirements" ; project /child ; - -exe main : main.cpp ; +exe main : main.cpp ; """) -t.write("child/main.cpp", """ +t.write("child/main.cpp", """ #if defined(PASS_THE_TEST) -int main() { return 0; } +int main() {} #endif - """) t.run_build_system() - t.expect_addition("child/bin/$toolset/debug/main.exe") -t.fail_test(find(t.stdout(), "Setting child requirements") < - find(t.stdout(), "Setting parent requirements")) +t.fail_test(string.find(t.stdout(), "Setting child requirements") < + string.find(t.stdout(), "Setting parent requirements")) -# Regression test: parent requirements were ignored in some cases +# Regression test: parent requirements were ignored in some cases. t.rm(".") -t.write("Jamroot", """ -build-project src ; +t.write("jamroot.jam", """ +build-project src ; """) -t.write("src/Jamfile", """ -project : requirements EVERYTHING_OK ; +t.write("src/jamfile.jam", """ +project : requirements EVERYTHING_OK ; """) -t.write("src/app/Jamfile", """ -exe test : test.cpp ; +t.write("src/app/jamfile.jam", """ +exe test : test.cpp ; """) -t.write("src/app/test.cpp", """ +t.write("src/app/test.cpp", """ #ifdef EVERYTHING_OK int main() {} #endif - """) t.run_build_system(subdir="src/app") t.expect_addition("src/app/bin/$toolset/debug/test.exe") - t.cleanup() diff --git a/test/loop.py b/test/loop.py index f45ebea7c..4455b9789 100644 --- a/test/loop.py +++ b/test/loop.py @@ -1,27 +1,26 @@ #!/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) +# 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 -from string import find +import BoostBuild +import string -t = Tester() - - -t.write("project-root.jam", "") -t.write("Jamfile", """ +t = BoostBuild.Tester() +t.write("jamroot.jam", """ lib main : main.cpp l ; -lib l : l.cpp main ; +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.fail_test(string.find(t.stdout(), + "error: Recursion in main target references") == -1) +t.fail_test(string.find(t.stdout(), "./main ./l ./main") == -1) t.cleanup() diff --git a/test/m1-01.py b/test/m1-01.py index 34d82db98..6c42c1eec 100644 --- a/test/m1-01.py +++ b/test/m1-01.py @@ -1,19 +1,18 @@ #!/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) +# 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 the very basic 'make' functionality. -from BoostBuild import Tester, List +import BoostBuild + +t = BoostBuild.Tester() -t = Tester() t.set_tree("test1") - -# Check that we can build something - +# Check that we can build something. t.run_build_system("-sTOOLSET=yfc") t.expect_addition("bin/a.obj/yfc/debug/runtime-link-dynamic/a.obj") @@ -33,18 +32,16 @@ t.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\ a.cpp """) -# Check that we have vanilla target names available - +# 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")) +# Check that if a build request cannot be completely matches, a warning is +# issued and a subvariant with link-compatible properties is used. +t.write("jamfile.jam", t.read("jamfile2.jam")) stdout="""Warning: cannot exactly satisfy request for ./a with properties off on dynamic yfc debug Using @@ -54,7 +51,7 @@ instead. t.run_build_system("-sTOOLSET=yfc", stdout=stdout) # Check that conflicting link-incompatible requirements prevent building. -t.write("Jamfile", t.read("Jamfile3")) +t.write("jamfile.jam", t.read("jamfile3.jam")) stdout="""Warning: cannot satisfy request for ./a with properties off on dynamic yfc debug Nothing will be built. @@ -62,4 +59,3 @@ Nothing will be built. t.run_build_system("-sTOOLSET=yfc", stdout=stdout, status=1) t.pass_test() - diff --git a/test/m1-02.py b/test/m1-02.py index 86e6312da..13cc9dc1a 100644 --- a/test/m1-02.py +++ b/test/m1-02.py @@ -4,12 +4,13 @@ # 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) -# Tests that 'make' accepts target from other directories and that -# build request for those targets can be overriden. +# Tests that 'make' accepts targets from other directories and that build +# requests for those targets can be overriden. -from BoostBuild import Tester, List +import BoostBuild + +t = BoostBuild.Tester() -t = Tester() t.set_tree("test1") t.run_build_system("-sTOOLSET=yfc") @@ -31,7 +32,6 @@ t.fail(t.read("auxillary/bin/b.obj/yfc/debug/runtime-link-dynamic/b.obj") !=\ b.cpp """) - t.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\ """ off on dynamic yfc debug @@ -41,8 +41,7 @@ a.cpp b.cpp """) -# Check that we have vanilla target names available in subdirs - +# 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") @@ -50,9 +49,8 @@ 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')) +# Check that we can not request link-incompatible property for source target. +t.write('jamfile.jam', t.read('jamfile2.jam')) stdout="""Error: subvariant of target ./a with properties off on dynamic yfc debug requests link-incompatible property @@ -61,14 +59,15 @@ for source @auxillary/b.obj """ t.run_build_system("-sTOOLSET=yfc", stdout=stdout) -# Check that if we request link-compatible property then requirement for -# the source target will override it, with warning. This is similar to -# the way build requests are satisfied (see the first test) -# CONSIDER: should be print the main target which requests this one -# (and modifies requiremenets)? -t.write('Jamfile3', t.read('Jamfile3')) -t.write('auxillary/Jamfile3', t.read('auxillary/Jamfile3')) +# Check that if we request link-compatible property then requirement for the +# source target will override it, with a warning. This is similar to the way +# build requests are satisfied (see the first test). +# +# CONSIDER: should be print the main target which requests this one (and +# modifies requirements)? +t.write('jamfile.jam', t.read('jamfile3.jam')) +t.write('auxillary/jamfile.jam', t.read('auxillary/jamfile3.jam')) stdout="""Warning: cannot exactly satisfy request for auxillary/b.obj with properties space on dynamic yfc debug Using @@ -78,15 +77,14 @@ instead. t.run_build_system("-sTOOLSET=yfc", stdout=stdout) -# Check for link-incompatible properties - -t.write('Jamfile4', t.read('Jamfile4')) -t.write('auxillary/Jamfile4', t.read('auxillary/Jamfile4')) +# Check for link-incompatible properties. +t.write('jamfile.jam', t.read('jamfile4.jam')) +t.write('auxillary/jamfile.jam', t.read('auxillary/jamfile4.jam')) stdout="""Warning: cannot satisfy request for auxillary/b.obj with properties space on dynamic yfc debug Nothing will be built. -""") +""" +t.run_build_system("-sTOOLSET=yfc", stdout=stdout) t.pass_test() - diff --git a/test/m1-03.py b/test/m1-03.py index 15b0ff0ed..2f31ba27c 100644 --- a/test/m1-03.py +++ b/test/m1-03.py @@ -1,16 +1,16 @@ #!/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) +# 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) -# 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. +# 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 +import BoostBuild + +t = BoostBuild.Tester() -t = Tester() t.set_tree("test1") t.run_build_system("-sTOOLSET=yfc", subdir="p1") @@ -39,7 +39,6 @@ t.fail(t.read("p2/bin/c.obj/yfc/debug/runtime-link-dynamic/c.obj") !=\ a.cpp """) - t.fail(t.read("bin/a/yfc/debug/runtime-link-dynamic/a") !=\ """ off on dynamic yfc debug @@ -55,7 +54,4 @@ t.expect_nothing_more() # TODO: need to write test cases for referring to targets using project-id. - - t.pass_test() - diff --git a/test/make_rule.py b/test/make_rule.py index c204d7a40..389200905 100644 --- a/test/make_rule.py +++ b/test/make_rule.py @@ -1,19 +1,18 @@ #!/usr/bin/python -# Copyright 2003 Dave Abrahams -# 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) +# Copyright 2003 Dave Abrahams +# 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) -# Test the 'make' rule +# Test the 'make' rule. -from BoostBuild import Tester -from string import find +import BoostBuild +import string -t = Tester(pass_toolset=1) - -t.write("Jamroot", """ +t = BoostBuild.Tester(pass_toolset=1) +t.write("jamroot.jam", """ import feature ; feature.feature test_feature : : free ; @@ -30,32 +29,29 @@ make foo.bar : : creator : 12345678 ; t.run_build_system() t.expect_addition("bin/$toolset/debug/foo.bar") -t.fail_test(find(t.read("bin/$toolset/debug/foo.bar"), "12345678") == -1) +t.fail_test(string.find(t.read("bin/$toolset/debug/foo.bar"), "12345678") == -1) -# Regression test. Make sure that if main target requested two times, -# and build request differ only in incidental properties, the main target -# if created only once. The bug was discovered by Kirill Lapshin. -t.write("Jamroot", """ -# Make sure that incidental property does not -# cause second creation of 'hello1.cpp'. +# Regression test. Make sure that if a main target is requested two times, and +# build requests differ only in incidental properties, the main target is +# created only once. The bug was discovered by Kirill Lapshin. +t.write("jamroot.jam", """ +# Make sure that incidental property does not cause second creation of +# 'hello1.cpp'. exe a : dir//hello1.cpp ; -exe b : dir//hello1.cpp/true ; +exe b : dir//hello1.cpp/true ; """) -t.write("dir/Jamfile", """ +t.write("dir/jamfile.jam", """ import common ; make hello1.cpp : hello.cpp : common.copy ; - """) t.write("dir/hello.cpp", """ -int main() -{ - return 1; -} +int main() {} """) -# Show only names of the actions. + +# Show only action names. t.run_build_system("-d1 -n") t.fail_test(t.stdout().count("copy") != 1) diff --git a/test/module_actions.py b/test/module_actions.py index 1f4ff96a0..9f6da7ebc 100644 --- a/test/module_actions.py +++ b/test/module_actions.py @@ -46,7 +46,7 @@ act t3: X1-global X2-global X3-t3 # Accomodate for that fact. if os.name != 'nt': expected_output = re.sub(spaces_re, " ", expected_output) - expected_output = re.sub(trailing_spaces_re, "\n", expected_output) + expected_output = re.sub(trailing_spaces_re, "\n", expected_output) t.run_build_system(stdout=expected_output) t.expect_nothing_more() diff --git a/test/ndebug.py b/test/ndebug.py index b4d071f80..123576f31 100644 --- a/test/ndebug.py +++ b/test/ndebug.py @@ -1,35 +1,30 @@ #!/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) +# 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 building with optimization brings NDEBUG define, and, more -# importantly, that dependency targets are built with NDEBUG as well, -# even if they are not directly requested. +# Test that building with optimization brings NDEBUG define, and, more +# importantly, that dependency targets are built with NDEBUG as well, even if +# they are not directly requested. +import BoostBuild -from BoostBuild import Tester, List +t = BoostBuild.Tester() - -t = Tester() - -t.write("project-root.jam", "") -t.write("Jamfile", """ +t.write("jamroot.jam", """ exe hello : hello.cpp lib//lib1 ; """) + t.write("hello.cpp", """ #ifdef NDEBUG void foo(); -int main() -{ - foo(); - return 0; -} +int main() { foo(); } #endif """) -t.write("lib/Jamfile", """ -lib lib1 : lib1.cpp ; + +t.write("lib/jamfile.jam", """ +lib lib1 : lib1.cpp ; """) t.write("lib/lib1.cpp", """ #ifdef NDEBUG @@ -37,10 +32,8 @@ void foo() {} #endif """) -# 'release' builds should get NDEBUG define -# use static linking to avoid messing with -# imports/exports on windows. +# 'release' builds should get the NDEBUG define. We use static linking to avoid +# messing with imports/exports on windows. t.run_build_system("link=static release") - t.cleanup() diff --git a/test/no_type.py b/test/no_type.py index 509e93538..0668e53ef 100644 --- a/test/no_type.py +++ b/test/no_type.py @@ -4,17 +4,18 @@ # 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. +# 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() +import BoostBuild -t.write("project-root.jam", "import gcc ;") -t.write("Jamfile", """ +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ +import gcc ; static-lib a : a.foo ; """) + t.write("a.foo", "") t.run_build_system(status=1) diff --git a/test/notfile.py b/test/notfile.py index 02b1ee238..ba6509392 100644 --- a/test/notfile.py +++ b/test/notfile.py @@ -1,22 +1,20 @@ #!/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) +# 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. +# Basic tests for the 'notfile' rule. -from BoostBuild import Tester, List +import BoostBuild import string import os -import fnmatch -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ +t.write("jamroot.jam", """ import notfile ; - notfile say : "echo hi" ; exe hello : hello.cpp ; @@ -26,19 +24,11 @@ actions valgrind { valgrind $(>) } - """) t.write("hello.cpp", """ - #include - -int main() -{ - std::cout << "Hello!\\n"; - return 1; -} - +int main() { std::cout << "Hello!\\n"; } """) @@ -51,6 +41,4 @@ name = apply(os.path.join, string.split(name, "/")); c = "valgrind " + name t.expect_output_line(c) - t.cleanup() - diff --git a/test/ordered_include.py b/test/ordered_include.py new file mode 100644 index 000000000..3de729532 --- /dev/null +++ b/test/ordered_include.py @@ -0,0 +1,41 @@ +#!/usr/bin/python +# +# Copyright (c) 2008 Steven Watanabe +# +# 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 + +tester = BoostBuild.Tester() + +tester.write("jamroot.jam", """ +obj test : test.cpp : a&&b ; +""") + +tester.write("test.cpp", """ +#include +#include +int main() {} +""") + +tester.write("a/test1.hpp", """ +""") + +tester.write("b/test2.hpp", """ +""") + +tester.run_build_system() + +tester.expect_addition("bin/$toolset/debug/test.obj") + +tester.touch("a/test1.hpp") +tester.run_build_system() +tester.expect_touch("bin/$toolset/debug/test.obj") + +tester.touch("b/test2.hpp") +tester.run_build_system() +tester.expect_touch("bin/$toolset/debug/test.obj") + +tester.cleanup() diff --git a/test/ordered_properties.py b/test/ordered_properties.py index 3025acfba..58ea5a9f1 100644 --- a/test/ordered_properties.py +++ b/test/ordered_properties.py @@ -1,42 +1,30 @@ #!/usr/bin/python -# Copyright 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) - -# This file is template for Boost.Build tests. It creates a simple -# project that builds one exe from one source, and checks that the exe -# is really created. -from BoostBuild import Tester, List +# Copyright 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) # This checks that Boost.Build does not reorder properties # lexicographically. -t = Tester() -t.write("a.cpp", """ +import BoostBuild + +t = BoostBuild.Tester() + +t.write("a.cpp", """ #include - -int main() -{ - foo(); - return 0; -} - +int main() { foo(); } """) -t.write("Jamfile", """ -exe a : a.cpp : d2 d1 ; +t.write("jamroot.jam", """ +exe a : a.cpp : d2 d1 ; """) -t.write("project-root.jam", """ +t.write("d1/a.h", """ """) -t.write("d1/a.h", """ -""") - -t.write("d2/a.h", """ +t.write("d2/a.h", """ inline void foo() {} - """) t.run_build_system() diff --git a/test/out_of_tree.py b/test/out_of_tree.py index 647709870..9e89cefbe 100644 --- a/test/out_of_tree.py +++ b/test/out_of_tree.py @@ -1,41 +1,34 @@ #!/usr/bin/python -# Copyright (C) FILL SOMETHING HERE 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) +# Copyright (C) FILL SOMETHING HERE 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) -# Tests that we can build a project when the current directory is outside of -# that project tree, that is: -# bjam some_dir -# works. -from BoostBuild import Tester, List +# Tests that we can build a project when the current directory is outside of +# that project tree, that is 'bjam some_dir' works. -# Create a temporary working directory -t = Tester() +import BoostBuild -# Create the needed files -t.write("p1/Jamroot", """ +# Create a temporary working directory. +t = BoostBuild.Tester() + +# Create the needed files. +t.write("p1/jamroot.jam", """ exe hello : hello.cpp ; """) -t.write("p1/hello.cpp", """ -int main() -{ - return 0; -} +t.write("p1/hello.cpp", """ +int main() {} """) -t.write("p2/Jamroot", """ +t.write("p2/jamroot.jam", """ exe hello2 : hello.cpp ; exe hello3 : hello.cpp ; """) -t.write("p2/hello.cpp", """ -int main() -{ - return 0; -} +t.write("p2/hello.cpp", """ +int main() {} """) t.run_build_system("p1 p2//hello3") diff --git a/test/path_features.py b/test/path_features.py index 582b05e7e..231030be8 100644 --- a/test/path_features.py +++ b/test/path_features.py @@ -5,11 +5,12 @@ # 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() +import BoostBuild -t.write("project-root.jam", "import gcc ;") -t.write("Jamfile", "lib a : a.cpp : . ;") +t = BoostBuild.Tester() + +t.write("jamroot.jam", "import gcc ;") +t.write("jamfile.jam", "lib a : a.cpp : . ;") t.write("a.cpp", """ #include void @@ -20,21 +21,23 @@ foo() {} """) t.write("a.h", "//empty file\n") -t.write("d/Jamfile", "exe b : b.cpp ..//a ; ") +t.write("d/jamfile.jam", "exe b : b.cpp ..//a ; ") t.write("d/b.cpp", """ - void foo(); - int main() { foo(); } +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 : debug:. ;") +# Now test the path features with condition work as well. +t.write("jamfile.jam", "lib a : a.cpp : debug:. ;") t.rm("bin") t.run_build_system(subdir="d") -# Test path features with condtion in usage requirements -t.write("Jamfile", "lib a : a.cpp : . : : debug:. ;") +# Test path features with condition in usage requirements. +t.write("jamfile.jam", """ +lib a : a.cpp : . : : debug:. ; +""") t.write("d/b.cpp", """ #include void foo(); @@ -43,11 +46,11 @@ int main() { foo(); } t.rm("d/bin") t.run_build_system(subdir="d") -# Test that absolute paths inside requirements are ok. The problem -# appear only when building targets in subprojects. -t.write("project-root.jam", "") -t.write("Jamfile", "build-project x ; ") -t.write("x/Jamfile", """ +# Test that absolute paths inside requirements are ok. The problems appeared +# only when building targets in subprojects. +t.write("jamroot.jam", "") +t.write("jamfile.jam", "build-project x ; ") +t.write("x/jamfile.jam", """ local pwd = [ PWD ] ; project : requirements $(pwd)/x/include ; exe m : m.cpp : $(pwd)/x/include2 ; @@ -55,7 +58,6 @@ exe m : m.cpp : $(pwd)/x/include2 ; t.write("x/m.cpp", """ #include #include - int main() {} """) t.write("x/include/h1.hpp", "\n") @@ -66,8 +68,8 @@ t.expect_addition("x/bin/$toolset/debug/m.exe") # Test that "&&" in path features is handled correctly. t.rm("bin") -t.write("Jamfile", "build-project sub ;") -t.write("sub/Jamfile", """ +t.write("jamfile.jam", "build-project sub ;") +t.write("sub/jamfile.jam", """ exe a : a.cpp : ../h1&&../h2 ; """) t.write("sub/a.cpp", """ diff --git a/test/pch.py b/test/pch.py index 87ca0846b..d36260a55 100644 --- a/test/pch.py +++ b/test/pch.py @@ -1,63 +1,49 @@ #!/usr/bin/python -# Copyright 2006 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) +# Copyright 2006 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) -from BoostBuild import Tester, List -import string -import os +import BoostBuild -t = Tester() -t.write("Jamroot", """ +t = BoostBuild.Tester() +t.write("jamroot.jam", """ import pch ; - cpp-pch pch : pch.hpp : msvc:pch.cpp . ; - -exe hello : hello.cpp pch : . ; +exe hello : hello.cpp pch : . ; """) -t.write("pch.hpp.bad", """ -THIS WON'T COMPILE +t.write("pch.hpp.bad", """ +THIS WILL NOT COMPILE """) -# Note that pch.hpp is written after pch.hpp.bad, so its timestamp won't -# be less than timestamp of pch.hpp.bad. -t.write("pch.hpp", """ -class TestClass { -public: - TestClass(int, int) {} -}; - -""") - - - -t.write("pch.cpp", """ #include - -""") - -t.write("hello.cpp", """ #include - -int main() +# Note that pch.hpp is written after pch.hpp.bad, so its timestamp will not be +# less than timestamp of pch.hpp.bad. +t.write("pch.hpp", """ +class TestClass { - TestClass c(1, 2); - return 0; -} +public: + TestClass( int, int ) {} +}; +""") +t.write("pch.cpp", """#include +""") + +t.write("hello.cpp", """#include +int main() { TestClass c(1, 2); } """) t.run_build_system() - t.expect_addition("bin/$toolset/debug/hello.exe") -# Now make the header unusable, without changing timestamp. -# If everything is OK, Boost.Build won't recreate PCH, and -# compiler will happily use pre-compiled header, not noticing -# that the real header is bad. + +# Now make the header unusable, without changing timestamp. If everything is OK, +# Boost.Build will not recreate PCH, and compiler will happily use pre-compiled +# header, not noticing that the real header is bad. t.copy_preserving_timestamp("pch.hpp.bad", "pch.hpp") @@ -67,4 +53,3 @@ t.run_build_system() t.expect_addition("bin/$toolset/debug/hello.obj") t.cleanup() - diff --git a/test/prebuilt.py b/test/prebuilt.py index 58590aae7..250cdc820 100644 --- a/test/prebuilt.py +++ b/test/prebuilt.py @@ -6,38 +6,38 @@ # Test that we can use already built sources -from BoostBuild import Tester -t = Tester() +import BoostBuild + +t = BoostBuild.Tester() t.set_tree('prebuilt') -t.expand_toolset("ext/project-root.jam") -t.expand_toolset("project-root.jam") -# First, build the external project +t.expand_toolset("ext/jamroot.jam") +t.expand_toolset("jamroot.jam") + +# First, build the external project. t.run_build_system("debug release", subdir="ext") -# Then pretend that we don't have the sources for the external project, -# and can only use compiled binaries -t.copy("ext/Jamfile2", "ext/Jamfile") -t.expand_toolset("ext/Jamfile") - -# Now check that we can build the main project, and that -# correct prebuilt file is picked, depending of variant. -# This also checks that correct includes for prebuilt -# libraries are used. +# Then pretend that we do not have the sources for the external project, and can +# only use compiled binaries. +t.copy("ext/jamfile2.jam", "ext/jamfile.jam") +t.expand_toolset("ext/jamfile.jam") +# Now check that we can build the main project, and that correct prebuilt file +# is picked, depending of variant. This also checks that correct includes for +# prebuilt libraries are used. t.run_build_system("debug release") t.expect_addition("bin/$toolset/debug/hello.exe") t.expect_addition("bin/$toolset/release/hello.exe") t.rm("bin") -# Now test that prebuilt file specified by absolute name -# works too. -t.copy("ext/Jamfile3", "ext/Jamfile") -t.expand_toolset("ext/Jamfile") + + +# Now test that prebuilt file specified by absolute name works too. +t.copy("ext/jamfile3.jam", "ext/jamfile.jam") +t.expand_toolset("ext/jamfile.jam") t.run_build_system("debug release") t.expect_addition("bin/$toolset/debug/hello.exe") t.expect_addition("bin/$toolset/release/hello.exe") - t.cleanup() diff --git a/test/prebuilt/ext/Jamfile b/test/prebuilt/ext/jamfile.jam similarity index 100% rename from test/prebuilt/ext/Jamfile rename to test/prebuilt/ext/jamfile.jam diff --git a/test/prebuilt/ext/Jamfile2 b/test/prebuilt/ext/jamfile2.jam similarity index 100% rename from test/prebuilt/ext/Jamfile2 rename to test/prebuilt/ext/jamfile2.jam diff --git a/test/prebuilt/ext/Jamfile3 b/test/prebuilt/ext/jamfile3.jam similarity index 100% rename from test/prebuilt/ext/Jamfile3 rename to test/prebuilt/ext/jamfile3.jam diff --git a/test/prebuilt/ext/project-root.jam b/test/prebuilt/ext/jamroot.jam similarity index 100% rename from test/prebuilt/ext/project-root.jam rename to test/prebuilt/ext/jamroot.jam diff --git a/test/prebuilt/Jamfile b/test/prebuilt/jamfile.jam similarity index 100% rename from test/prebuilt/Jamfile rename to test/prebuilt/jamfile.jam diff --git a/test/prebuilt/project-root.jam b/test/prebuilt/jamroot.jam similarity index 100% rename from test/prebuilt/project-root.jam rename to test/prebuilt/jamroot.jam diff --git a/test/print.py b/test/print.py index 62d2c7260..65caf95e1 100644 --- a/test/print.py +++ b/test/print.py @@ -5,12 +5,13 @@ # 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 BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("project-root.jam", "import gcc ;") -t.write("Jamfile", """ +t.write("jamroot.jam", "import gcc ;") + +t.write("jamfile.jam", """ import print ; print.output foo ; print.text \\\"Something\\\" ; @@ -21,7 +22,7 @@ ALWAYS foo ; t.run_build_system() t.expect_content("foo", """\"Something\"""") -t.write("Jamfile", """ +t.write("jamfile.jam", """ import print ; print.output foo ; print.text \\\n\\\"Somethingelse\\\" ; @@ -33,7 +34,7 @@ t.run_build_system() t.expect_content("foo", """\"Something\" \"Somethingelse\"""") -t.write("Jamfile", """ +t.write("jamfile.jam", """ import print ; print.output foo ; print.text \\\"Different\\\" : true ; diff --git a/test/project-test1/dir/Jamfile b/test/project-test1/dir/jamfile.jam similarity index 100% rename from test/project-test1/dir/Jamfile rename to test/project-test1/dir/jamfile.jam diff --git a/test/project-test1/dir2/Jamfile b/test/project-test1/dir2/jamfile.jam similarity index 100% rename from test/project-test1/dir2/Jamfile rename to test/project-test1/dir2/jamfile.jam diff --git a/test/project-test1/dir2/project-root.jam b/test/project-test1/dir2/jamroot.jam similarity index 100% rename from test/project-test1/dir2/project-root.jam rename to test/project-test1/dir2/jamroot.jam diff --git a/test/project-test1/Jamfile b/test/project-test1/jamfile.jam similarity index 100% rename from test/project-test1/Jamfile rename to test/project-test1/jamfile.jam diff --git a/test/project-test1/project-root.jam b/test/project-test1/jamroot.jam similarity index 100% rename from test/project-test1/project-root.jam rename to test/project-test1/jamroot.jam diff --git a/test/project-test3/Jamfile b/test/project-test3/jamfile.jam similarity index 100% rename from test/project-test3/Jamfile rename to test/project-test3/jamfile.jam diff --git a/test/project-test3/project-root.jam b/test/project-test3/jamroot.jam similarity index 100% rename from test/project-test3/project-root.jam rename to test/project-test3/jamroot.jam diff --git a/test/project-test3/lib/Jamfile b/test/project-test3/lib/jamfile.jam similarity index 100% rename from test/project-test3/lib/Jamfile rename to test/project-test3/lib/jamfile.jam diff --git a/test/project-test3/lib2/helper/Jamfile b/test/project-test3/lib2/helper/jamfile.jam similarity index 100% rename from test/project-test3/lib2/helper/Jamfile rename to test/project-test3/lib2/helper/jamfile.jam diff --git a/test/project-test3/lib2/Jamfile b/test/project-test3/lib2/jamfile.jam similarity index 100% rename from test/project-test3/lib2/Jamfile rename to test/project-test3/lib2/jamfile.jam diff --git a/test/project-test3/lib3/Jamfile b/test/project-test3/lib3/jamfile.jam similarity index 100% rename from test/project-test3/lib3/Jamfile rename to test/project-test3/lib3/jamfile.jam diff --git a/test/project-test3/lib3/project-root.jam b/test/project-test3/lib3/jamroot.jam similarity index 100% rename from test/project-test3/lib3/project-root.jam rename to test/project-test3/lib3/jamroot.jam diff --git a/test/project-test4/Jamfile b/test/project-test4/jamfile.jam similarity index 100% rename from test/project-test4/Jamfile rename to test/project-test4/jamfile.jam diff --git a/test/project-test4/Jamfile3 b/test/project-test4/jamfile3.jam similarity index 100% rename from test/project-test4/Jamfile3 rename to test/project-test4/jamfile3.jam diff --git a/test/project-test4/Jamfile4 b/test/project-test4/jamfile4.jam similarity index 100% rename from test/project-test4/Jamfile4 rename to test/project-test4/jamfile4.jam diff --git a/test/project-test4/Jamfile5 b/test/project-test4/jamfile5.jam similarity index 100% rename from test/project-test4/Jamfile5 rename to test/project-test4/jamfile5.jam diff --git a/test/project-test4/project-root.jam b/test/project-test4/jamroot.jam similarity index 100% rename from test/project-test4/project-root.jam rename to test/project-test4/jamroot.jam diff --git a/test/project-test4/lib/Jamfile b/test/project-test4/lib/jamfile.jam similarity index 100% rename from test/project-test4/lib/Jamfile rename to test/project-test4/lib/jamfile.jam diff --git a/test/project-test4/lib/Jamfile1 b/test/project-test4/lib/jamfile1.jam similarity index 100% rename from test/project-test4/lib/Jamfile1 rename to test/project-test4/lib/jamfile1.jam diff --git a/test/project-test4/lib/Jamfile2 b/test/project-test4/lib/jamfile2.jam similarity index 100% rename from test/project-test4/lib/Jamfile2 rename to test/project-test4/lib/jamfile2.jam diff --git a/test/project-test4/lib/Jamfile3 b/test/project-test4/lib/jamfile3.jam similarity index 100% rename from test/project-test4/lib/Jamfile3 rename to test/project-test4/lib/jamfile3.jam diff --git a/test/project-test4/lib2/Jamfile b/test/project-test4/lib2/jamfile.jam similarity index 100% rename from test/project-test4/lib2/Jamfile rename to test/project-test4/lib2/jamfile.jam diff --git a/test/project-test4/lib2/Jamfile2 b/test/project-test4/lib2/jamfile2.jam similarity index 100% rename from test/project-test4/lib2/Jamfile2 rename to test/project-test4/lib2/jamfile2.jam diff --git a/test/project_dependencies.py b/test/project_dependencies.py index e0cdcb686..96df9e250 100644 --- a/test/project_dependencies.py +++ b/test/project_dependencies.py @@ -1,51 +1,51 @@ #!/usr/bin/python -# 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) +# 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. +# Test that we can specify a dependency property in project requirements, and +# that it will not cause every main target in the project to be generated in its +# own subdirectory. -# The whole test is somewhat moot now. +# The whole test is somewhat moot now. -from BoostBuild import Tester, List +import BoostBuild -t = Tester() +t = BoostBuild.Tester() + +t.write("jamroot.jam", "build-project src ;") + +t.write("lib/jamfile.jam", "lib lib1 : lib1.cpp ;") -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 ../lib//lib1 - ; - + +t.write("src/jamfile.jam", """ +project : requirements ../lib//lib1 ; exe a : a.cpp ; -exe b : b.cpp ; +exe b : b.cpp ; """) + t.write("src/a.cpp", """ #ifdef _WIN32 __declspec(dllimport) #endif void foo(); -int main() { foo(); return 0; } +int main() { foo(); } """) + t.copy("src/a.cpp", "src/b.cpp") t.run_build_system() -# Test that there's no "main-target-a" part. +# Test that there is no "main-target-a" part. # t.expect_addition("src/bin/$toolset/debug/a.exe") # t.expect_addition("src/bin/$toolset/debug/b.exe") - t.cleanup() diff --git a/test/project_glob.py b/test/project_glob.py index fe76b6870..1445eb2a6 100644 --- a/test/project_glob.py +++ b/test/project_glob.py @@ -5,48 +5,41 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -# Test the 'glob' rule in Jamfile context. -from BoostBuild import Tester, List -import os -import string +# Test the 'glob' rule in Jamfile context. -# Create a temporary working directory -t = Tester() +import BoostBuild -t.write("project-root.jam", """ +# Create a temporary working directory. +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ """) -t.write("Jamfile", """ +t.write("d1/a.cpp", """ +int main() {} """) -t.write("d1/a.cpp", """ -int main() { return 0; } - +t.write("d1/jamfile.jam", """ +exe a : [ glob *.cpp ] ../d2/d//l ; """) -t.write("d1/Jamfile", """ -exe a : [ glob *.cpp ] ../d2/d//l ; -""") - -t.write("d2/d/l.cpp", """ +t.write("d2/d/l.cpp", """ #if defined(_WIN32) __declspec(dllexport) void force_import_lib_creation() {} #endif """) -t.write("d2/d/Jamfile", """ -lib l : [ glob *.cpp ] ; +t.write("d2/d/jamfile.jam", """ +lib l : [ glob *.cpp ] ; """) -t.write("d3/d/Jamfile", """ +t.write("d3/d/jamfile.jam", """ exe a : [ glob ../*.cpp ] ; """) + t.write("d3/a.cpp", """ -int main() -{ - return 0; -} +int main() {} """) t.run_build_system(subdir="d1") @@ -56,49 +49,46 @@ t.run_build_system(subdir="d3/d") t.expect_addition("d3/d/bin/$toolset/debug/a.exe") t.rm("d2/d/bin") + t.run_build_system(subdir="d2/d") t.expect_addition("d2/d/bin/$toolset/debug/l.dll") -# Test that when 'source-location' is explicitly-specified -# glob works relatively to source location + +# Test that when 'source-location' is explicitly-specified glob works relatively +# to the source location. t.rm("d1") -t.write("d1/src/a.cpp", """ -int main() { return 0; } - +t.write("d1/src/a.cpp", """ +int main() {} """) -t.write("d1/Jamfile", """ +t.write("d1/jamfile.jam", """ project : source-location src ; -exe a : [ glob *.cpp ] ../d2/d//l ; +exe a : [ glob *.cpp ] ../d2/d//l ; """) t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") -# Test that wildcards can include directories. Also -# test exclusion patterns. +# Test that wildcards can include directories. Also test exclusion patterns. t.rm("d1") t.write("d1/src/foo/a.cpp", """ void bar(); -int main() { bar(); return 0; } - +int main() { bar(); } """) t.write("d1/src/bar/b.cpp", """ void bar() {} - """) t.write("d1/src/bar/bad.cpp", """ very bad non-compilable file """) - -t.write("d1/Jamfile", """ +t.write("d1/jamfile.jam", """ project : source-location src ; -exe a : [ glob foo/*.cpp bar/*.cpp : bar/bad* ] ../d2/d//l ; +exe a : [ glob foo/*.cpp bar/*.cpp : bar/bad* ] ../d2/d//l ; """) t.run_build_system(subdir="d1") @@ -107,18 +97,20 @@ t.expect_addition("d1/bin/$toolset/debug/a.exe") # Test that 'glob-tree' works. t.rm("d1/bin/$toolset/debug/a.exe") -t.write("d1/Jamfile", """ + +t.write("d1/jamfile.jam", """ project : source-location src ; -exe a : [ glob-tree *.cpp : bad* ] ../d2/d//l ; +exe a : [ glob-tree *.cpp : bad* ] ../d2/d//l ; """) + t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") -# Test that directory names in patterns for -# 'glob-tree' are rejected. -t.write("d1/Jamfile", """ + +# Test that directory names in patterns for 'glob-tree' are rejected. +t.write("d1/jamfile.jam", """ project : source-location src ; -exe a : [ glob-tree foo/*.cpp bar/*.cpp : bad* ] ../d2/d//l ; +exe a : [ glob-tree foo/*.cpp bar/*.cpp : bad* ] ../d2/d//l ; """) t.run_build_system(subdir="d1", status=1) @@ -127,51 +119,40 @@ t.expect_output_line("error: The patterns * may not include directory") t.rm("d1/src/bar/bad.cpp") -# Test that 'glob' works with absolute names +# Test that 'glob' works with absolute names. t.rm("d1/bin") -# Note that to get current dir, we use bjam's PWD, -# not Python's os.getcwd, because the former will -# always return long path. The latter might return -# short path, and that will confuse path.glob. -t.write("d1/Jamfile", """ +# Note that to get current dir, we use bjam's PWD, not Python's os.getcwd(), +# because the former will always return long path while the latter might return +# a short path, and that will confuse path.glob. +t.write("d1/jamfile.jam", """ project : source-location src ; -local pwd = [ PWD ] ; # Always absolute -exe a : [ glob $(pwd)/src/foo/*.cpp $(pwd)/src/bar/*.cpp ] ../d2/d//l ; +local pwd = [ PWD ] ; # Always absolute +exe a : [ glob $(pwd)/src/foo/*.cpp $(pwd)/src/bar/*.cpp ] ../d2/d//l ; """) t.run_build_system(subdir="d1") t.expect_addition("d1/bin/$toolset/debug/a.exe") -# Regression test: glob excludes used to be broken -# when building from a subdirectory. + +# Regression test: glob excludes used to be broken when building from a +# subdirectory. t.rm(".") -t.write("Jamroot", """ +t.write("jamroot.jam", """ build-project p ; """) -t.write("p/p.c", """ -int main() -{ - return 0; -} - - +t.write("p/p.c", """ +int main() {} """) -t.write("p/p_x.c", """ -int main() -{ - return 0; -} - +t.write("p/p_x.c", """ +int main() {} """) -t.write("p/Jamfile", """ -exe p : - [ glob *.c : p_x.c ] - ; +t.write("p/jamfile.jam", """ +exe p : [ glob *.c : p_x.c ] ; """) t.run_build_system(subdir="p") diff --git a/test/project_root_constants.py b/test/project_root_constants.py index 1129ed801..cd8a7d6c7 100644 --- a/test/project_root_constants.py +++ b/test/project_root_constants.py @@ -4,26 +4,25 @@ # 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 string import find +import BoostBuild +import string -# Create a temporary working directory -t = Tester() +# Create a temporary working directory. +t = BoostBuild.Tester() -# Create the needed files -t.write("project-root.jam", """ +# Create the needed files. +t.write("jamroot.jam", """ constant FOO : foobar gee ; ECHO $(FOO) ; """) -t.write("Jamfile", """ -""") t.run_build_system() -t.fail_test(find(t.stdout(), "foobar gee") == -1) +t.fail_test(string.find(t.stdout(), "foobar gee") == -1) # Regression test: when absolute paths were passed to path-constant rule, -# Boost.Build failed to recognize path as absolute and prepended current dir. -t.write("project-root.jam", """ +# Boost.Build failed to recognize path as absolute and prepended the current +# dir. +t.write("jamroot.jam", """ import path ; local here = [ path.native [ path.pwd ] ] ; path-constant HERE : $(here) ; @@ -34,25 +33,24 @@ if $(HERE) != $(here) EXIT ; } """) -t.write("Jamfile", "") +t.write("jamfile.jam", "") t.run_build_system() -t.write("Jamfile", """ -# This tests that rule 'hello' will be imported -# to children unlocalized, and will still access -# variables in this Jamfile +t.write("jamfile.jam", """ +# This tests that rule 'hello' will be imported to children unlocalized, and +# will still access variables in this Jamfile. x = 10 ; constant FOO : foo ; rule hello ( ) { ECHO "Hello $(x)" ; } """) -t.write("d/Jamfile", """ +t.write("d/jamfile.jam", """ ECHO "d: $(FOO)" ; constant BAR : bar ; """) -t.write("d/d2/Jamfile", """ +t.write("d/d2/jamfile.jam", """ ECHO "d2: $(FOO)" ; ECHO "d2: $(BAR)" ; hello ; diff --git a/test/project_root_rule.py b/test/project_root_rule.py index b2280c3d5..29fdcff4c 100644 --- a/test/project_root_rule.py +++ b/test/project_root_rule.py @@ -1,34 +1,29 @@ #!/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) +# 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) -# Tests that we can declare a rule in Jamroot that will be -# can be called in child Jamfile to declare a target. Specifically -# test for use of 'glob' in that rule. -# +# Tests that we can declare a rule in Jamroot that will be can be called in +# child Jamfile to declare a target. Specifically test for use of 'glob' in that +# rule. -from BoostBuild import Tester, List -import string +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ + +t.write("jamroot.jam", """ project : requirements static ; - -rule my-lib ( name ) -{ - lib $(name) : [ glob *.cpp ] ; -} +rule my-lib ( name ) { lib $(name) : [ glob *.cpp ] ; } """) -t.write("sub/a.cpp", """ +t.write("sub/a.cpp", """ """) -t.write("sub/Jamfile", """ -my-lib foo ; +t.write("sub/jamfile.jam", """ +my-lib foo ; """) @@ -37,4 +32,3 @@ t.run_build_system(subdir="sub") t.expect_addition("sub/bin/$toolset/debug/link-static/foo.lib") t.cleanup() - diff --git a/test/project_test1.py b/test/project_test1.py index c4a3a8c2f..a2a2ada18 100644 --- a/test/project_test1.py +++ b/test/project_test1.py @@ -5,16 +5,15 @@ # 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 +import BoostBuild 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 +t = BoostBuild.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: """ @@ -59,16 +58,16 @@ Projects: """ -# Test that correct project structure is created when jam is invoked -# outside of the source tree. +# Test that correct project structure is created when jam is invoked outside of +# the source tree. expected = (expected_output1 + expected_output2 + expected_output3) % \ {"root-dir": "project-test1", "root-dir-prefix": "project-test1/" } t.run_build_system(stdout=expected) -# Test that correct project structure is created when jam is invoked -# at the top of the source tree. +# Test that correct project structure is created when jam is invoked at the top +# of the source tree. expected = (expected_output1 + expected_output3 + expected_output2) % \ {"root-dir": ".", "root-dir-prefix": "" } diff --git a/test/project_test3.py b/test/project_test3.py index 7d46f3f19..8a4421604 100644 --- a/test/project_test3.py +++ b/test/project_test3.py @@ -1,23 +1,21 @@ #!/usr/bin/python -# Copyright 2002, 2003 Dave Abrahams -# Copyright 2002, 2003, 2004, 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) +# Copyright 2002, 2003 Dave Abrahams +# Copyright 2002, 2003, 2004, 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 +import BoostBuild import os -from string import strip -t = Tester(translate_suffixes=0) +t = BoostBuild.Tester(translate_suffixes=0) -# First check some startup +# First check some startup. t.set_tree("project-test3") -os.remove("project-root.jam") +os.remove("jamroot.jam") t.run_build_system(status=1, stdout= """error: Could not find parent for project at '.' error: Did not find Jamfile.jam or Jamroot.jam in any parent directory. - """) t.set_tree("project-test3") @@ -79,7 +77,6 @@ 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() @@ -87,11 +84,10 @@ 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", +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-all') @@ -102,10 +98,9 @@ t.expect_removal(["bin/$toolset/debug/a.obj", "lib2/bin/$toolset/debug/c.obj", "lib2/bin/$toolset/debug/d.obj", "lib2/bin/$toolset/debug/l.exe", - "lib3/bin/$toolset/debug/f.obj", - ]) + "lib3/bin/$toolset/debug/f.obj"]) -# Now test target ids in command line +# Now test target ids in command line. t.set_tree("project-test3") t.run_build_system("lib//b.obj") t.expect_addition("lib/bin/$toolset/debug/b.obj") @@ -119,22 +114,20 @@ t.run_build_system("lib//b.obj") t.expect_addition("lib/bin/$toolset/debug/b.obj") t.expect_nothing_more() - t.run_build_system("release lib2/helper//e.obj /lib3//f.obj") t.expect_addition("lib2/helper/bin/$toolset/release/e.obj") t.expect_addition("lib3/bin/$toolset/release/f.obj") t.expect_nothing_more() -# Test project ids in command line work as well +# Test project ids in command line work as well. t.set_tree("project-test3") t.run_build_system("/lib2") -t.expect_addition("lib2/bin/$toolset/debug/" * List("c.obj d.obj l.exe")) +t.expect_addition("lib2/bin/$toolset/debug/" * BoostBuild.List("c.obj d.obj l.exe")) t.expect_addition("bin/$toolset/debug/a.obj") t.expect_nothing_more() - t.run_build_system("lib") -t.expect_addition("lib/bin/$toolset/debug/" * List("b.obj m.exe")) +t.expect_addition("lib/bin/$toolset/debug/" * BoostBuild.List("b.obj m.exe")) t.expect_nothing_more() t.cleanup() diff --git a/test/project_test4.py b/test/project_test4.py index ec735df0f..fc4115017 100644 --- a/test/project_test4.py +++ b/test/project_test4.py @@ -1,15 +1,13 @@ #!/usr/bin/python -# 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) +# 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) -from BoostBuild import Tester -import os -from string import strip, find +import BoostBuild -t = Tester(translate_suffixes=0) +t = BoostBuild.Tester(translate_suffixes=0) t.set_tree("project-test4") @@ -40,20 +38,20 @@ t.expect_content("bin/$toolset/debug/b.exe", "bin/$toolset/debug/a.obj\n" ) - -t.copy("lib/Jamfile3", "lib/Jamfile") +t.copy("lib/jamfile3.jam", "lib/jamfile.jam") # Link-compatibility check for rtti is disabled... #t.run_build_system(status=None) -#t.fail_test(find(t.stdout(), +#import string +#t.fail_test(string.find(t.stdout(), #"""warning: targets produced from b.obj are link incompatible #warning: with main target a.exe""") !=-0) -# Test that if we specified composite property in target reference, -# everything works OK. +# Test that if we specified composite property in target reference, everything +# works OK. -t.copy("lib/Jamfile1", "lib/Jamfile") -t.copy("Jamfile5", "Jamfile") +t.copy("lib/jamfile1.jam", "lib/jamfile.jam") +t.copy("jamfile5.jam", "jamfile.jam") t.run_build_system() @@ -64,5 +62,4 @@ t.expect_content("bin/$toolset/debug/a.exe", "bin/$toolset/debug/a.obj lib/bin/$toolset/release/b.obj\n" ) - t.cleanup() diff --git a/test/property_expansion.py b/test/property_expansion.py index 2371d87bd..280f86208 100644 --- a/test/property_expansion.py +++ b/test/property_expansion.py @@ -4,31 +4,26 @@ # 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 +# Test that free property inside. -# Test that free property inside -t = Tester() +import BoostBuild -t.write("project-root.jam", "") -t.write("Jamfile", """ +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ project ; - variant debug-AA : debug : AA ; - alias all : hello ; exe hello : hello.cpp ; explicit hello ; """) + t.write("hello.cpp", """ #ifdef AA -int main() -{ - return 0; -} +int main() {} #endif """) t.run_build_system("debug-AA") - t.cleanup() diff --git a/test/qt4.py b/test/qt4.py index 0eeed9e9a..abb9594d5 100755 --- a/test/qt4.py +++ b/test/qt4.py @@ -1,18 +1,19 @@ #!/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) +# (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 BoostBuild import os -from BoostBuild import Tester - -# Run test in real directory in order to find Boost.Test via Boost Top-Level Jamroot +# 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 = BoostBuild.Tester(workdir=qt4_dir) t.run_build_system() + t.cleanup() diff --git a/test/qt4/Jamroot b/test/qt4/jamroot.jam similarity index 100% rename from test/qt4/Jamroot rename to test/qt4/jamroot.jam diff --git a/test/railsys.py b/test/railsys.py index 10db5c3a0..7b7f8bd0b 100644 --- a/test/railsys.py +++ b/test/railsys.py @@ -1,12 +1,12 @@ #!/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) +# 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 BoostBuild -t = Tester() +t = BoostBuild.Tester() t.set_tree("railsys") t.run_build_system("--v2", subdir="program") diff --git a/test/railsys/libx/project-root.jam b/test/railsys/libx/jamroot.jam similarity index 100% rename from test/railsys/libx/project-root.jam rename to test/railsys/libx/jamroot.jam diff --git a/test/railsys/libx/src/Jamfile b/test/railsys/libx/src/jamfile.jam similarity index 100% rename from test/railsys/libx/src/Jamfile rename to test/railsys/libx/src/jamfile.jam diff --git a/test/railsys/program/Jamfile b/test/railsys/program/jamfile.jam similarity index 100% rename from test/railsys/program/Jamfile rename to test/railsys/program/jamfile.jam diff --git a/test/railsys/program/project-root.jam b/test/railsys/program/jamroot.jam similarity index 100% rename from test/railsys/program/project-root.jam rename to test/railsys/program/jamroot.jam diff --git a/test/railsys/program/liba/Jamfile b/test/railsys/program/liba/jamfile.jam similarity index 100% rename from test/railsys/program/liba/Jamfile rename to test/railsys/program/liba/jamfile.jam diff --git a/test/railsys/program/main/Jamfile b/test/railsys/program/main/jamfile.jam similarity index 100% rename from test/railsys/program/main/Jamfile rename to test/railsys/program/main/jamfile.jam diff --git a/test/rebuilds.py b/test/rebuilds.py index 9de1e32b7..da64eada3 100644 --- a/test/rebuilds.py +++ b/test/rebuilds.py @@ -1,10 +1,8 @@ #!/usr/bin/python -# Copyright 2005 Dave Abrahams -# 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 the typechecking facilities. +# Copyright 2005 Dave Abrahams +# 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 BoostBuild diff --git a/test/regression.py b/test/regression.py index 9ef3bed7f..c65082810 100644 --- a/test/regression.py +++ b/test/regression.py @@ -5,52 +5,45 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -# Test for the regression testing framework. -from BoostBuild import Tester, List +# Test for the regression testing framework. -# Create a temporary working directory -t = Tester() +import BoostBuild -t.write("c.cpp", "") +# Create a temporary working directory. +t = BoostBuild.Tester() + +t.write("c.cpp", "\n") t.write("r.cpp", """ - void helper(); #include -int main(int ac, char* av[]) +int main( int ac, char * av[] ) { helper(); - - for (int i = 1; i < ac; ++i) - std::cout << av[i] << '\\n'; - return 0; -} + for ( int i = 1; i < ac; ++i ) + std::cout << av[ i ] << '\\n'; +} """) -t.write("c-f.cpp", """ -int +t.write("c-f.cpp", """ +int """) -t.write("r-f.cpp", """ -int main() -{ - return 1; -} +t.write("r-f.cpp", """ +int main() { return 1; } """) -t.write("Jamfile", """ +t.write("jamfile.jam", """ import testing ; - compile c.cpp ; compile-fail c-f.cpp ; run r.cpp libs//helper : foo bar ; run-fail r-f.cpp ; - """) -t.write("libs/Jamfile", """ +t.write("libs/jamfile.jam", """ lib helper : helper.cpp ; """) @@ -60,10 +53,9 @@ void __declspec(dllexport) #endif helper() {} - """) -t.write("project-root.jam", "") +t.write("jamroot.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) @@ -74,28 +66,26 @@ 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) + "foo\nbar\n*\nEXIT STATUS: 0*\n", True) # Test that input file is handled as well. t.write("r.cpp", """ #include #include -int main(int ac, char* av[]) +int main( int ac, char * av[] ) { - for (int i = 1; i < ac; ++i) { - std::ifstream ifs(av[i]); + for ( int i = 1; i < ac; ++i ) + { + std::ifstream ifs( av[ i ] ); std::cout << ifs.rdbuf(); } - - return 0; -} +} """) t.write("dir/input.txt", "test input") -t.write("Jamfile", """ +t.write("jamfile.jam", """ import testing ; - compile c.cpp ; obj c-obj : c.cpp ; compile-fail c-f.cpp ; @@ -112,9 +102,9 @@ t.expect_content("bin/r.test/$toolset/debug/r.output", t.expect_addition('bin/$toolset/debug/execution.time') t.expect_addition('bin/$toolset/debug/compilation.time') -# Make sure test failures are detected. Reverse expectation and see -# if .test files are created or not. -t.write("Jamfile", """ +# Make sure test failures are detected. Reverse expectation and see if .test +# files are created or not. +t.write("jamfile.jam", """ import testing ; compile-fail c.cpp ; @@ -123,7 +113,7 @@ run-fail r.cpp : : dir/input.txt ; run r-f.cpp ; """) -t.touch(List("c.cpp c-f.cpp r.cpp r-f.cpp")) +t.touch(BoostBuild.List("c.cpp c-f.cpp r.cpp r-f.cpp")) t.run_build_system("hardcode-dll-paths=false", stderr=None, status=1) t.expect_removal("bin/c.test/$toolset/debug/c.test") diff --git a/test/relative_sources.py b/test/relative_sources.py index e03f999bc..6ffe3619b 100644 --- a/test/relative_sources.py +++ b/test/relative_sources.py @@ -1,18 +1,19 @@ #!/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) +# 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() +import BoostBuild -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 = BoostBuild.Tester() + +t.write("jamroot.jam", "import gcc ;") +t.write("jamfile.jam", "exe a : src/a.cpp ;") +t.write("src/a.cpp", "int main() {}\n") t.run_build_system() diff --git a/test/remove_requirement.py b/test/remove_requirement.py index 24a3deb96..b060a2ab7 100644 --- a/test/remove_requirement.py +++ b/test/remove_requirement.py @@ -1,76 +1,58 @@ #!/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) +# 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 +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -t.write("Jamroot", """ + +t.write("jamroot.jam", """ project : requirements multi debug:static ; build-project sub ; build-project sub2 ; build-project sub3 ; -build-project sub4 ; +build-project sub4 ; """) -t.write("sub/Jamfile", """ -exe hello : hello.cpp : -multi ; +t.write("sub/jamfile.jam", """ +exe hello : hello.cpp : -multi ; """) -t.write("sub/hello.cpp", """ -int main() -{ - return 0; -} - +t.write("sub/hello.cpp", """ +int main() {} """) -t.write("sub2/Jamfile", """ +t.write("sub2/jamfile.jam", """ project : requirements -multi ; -exe hello : hello.cpp ; +exe hello : hello.cpp ; """) -t.write("sub2/hello.cpp", """ -int main() -{ - return 0; -} - +t.write("sub2/hello.cpp", """ +int main() {} """) -t.write("sub3/hello.cpp", """ -int main() -{ - return 0; -} - +t.write("sub3/hello.cpp", """ +int main() {} """) -t.write("sub3/Jamfile", """ -exe hello : hello.cpp : -debug:static ; +t.write("sub3/jamfile.jam", """ +exe hello : hello.cpp : -debug:static ; """) -t.write("sub4/hello.cpp", """ -int main() -{ - return 0; -} - +t.write("sub4/hello.cpp", """ +int main() {} """) -t.write("sub4/Jamfile", """ +t.write("sub4/jamfile.jam", """ project : requirements -debug:static ; -exe hello : hello.cpp ; +exe hello : hello.cpp ; """) - - t.run_build_system() t.expect_addition("sub/bin/$toolset/debug/link-static/hello.exe") @@ -81,29 +63,22 @@ t.expect_addition("sub4/bin/$toolset/debug/threading-multi/hello.exe") t.rm(".") # Now test that path requirements can be removed as well. -t.write("Jamroot", """ +t.write("jamroot.jam", """ build-project sub ; - """) -t.write("sub/Jamfile", """ +t.write("sub/jamfile.jam", """ project : requirements broken ; - -exe hello : hello.cpp : -broken ; +exe hello : hello.cpp : -broken ; """) -t.write("sub/hello.cpp", """ +t.write("sub/hello.cpp", """ #include "math.h" - -int main() -{ - return 0; -} - +int main() {} """) -t.write("sub/broken/math.h", """ -Broken +t.write("sub/broken/math.h", """ +Broken """) @@ -112,4 +87,3 @@ t.run_build_system() t.expect_addition("sub/bin/$toolset/debug/hello.exe") t.cleanup() - diff --git a/test/resolution.py b/test/resolution.py index 93c520b26..31c122e19 100644 --- a/test/resolution.py +++ b/test/resolution.py @@ -1,28 +1,27 @@ #!/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) +# 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 +# Tests for the target id resolution process. -# Create a temporary working directory -t = Tester() +import BoostBuild + +# Create a temporary working directory. +t = BoostBuild.Tester() # Create the needed files -t.write("Jamroot", """ +t.write("jamroot.jam", """ exe hello : hello.cpp ; -# This should use the 'hello' target, even if there's -# 'hello' file in current dir. +# This should use the 'hello' target, even if there is a 'hello' file in the +# current dir. install s : hello : . ; """) + t.write("hello.cpp", """ -int main() -{ - return 0; -} +int main() {} """) t.run_build_system() @@ -31,8 +30,8 @@ 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. +# If 'hello' in the 's' target resolved to file in the current dir, nothing will +# be rebuilt. t.expect_touch("bin/$toolset/debug/hello.obj") t.cleanup() diff --git a/test/searched_lib.py b/test/searched_lib.py index 32058dab8..7f96b0a88 100644 --- a/test/searched_lib.py +++ b/test/searched_lib.py @@ -8,14 +8,16 @@ # 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 BoostBuild import os -t = Tester() +import string + +t = BoostBuild.Tester() + # To start with, we have to prepare a library to link with. -t.write("lib/project-root.jam", "") -t.write("lib/Jamfile", "lib test_lib : test_lib.cpp ;") +t.write("lib/jamroot.jam", "") +t.write("lib/jamfile.jam", "lib test_lib : test_lib.cpp ;") t.write("lib/test_lib.cpp", """ #ifdef _WIN32 __declspec(dllexport) @@ -26,9 +28,11 @@ void foo() {} t.run_build_system(subdir="lib") t.expect_addition("lib/bin/$toolset/debug/test_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': +if ( ( os.name == "nt" ) or os.uname()[0].lower().startswith("cygwin") ) and \ + ( BoostBuild.get_toolset() != "gcc" ): t.copy("lib/bin/$toolset/debug/test_lib.implib", "lib/test_lib.implib") t.copy("lib/bin/$toolset/debug/test_lib.dll", "lib/test_lib.dll") else: @@ -36,9 +40,9 @@ else: # Test that the simplest usage of searched library works. -t.write('project-root.jam', '') -t.write('Jamfile', """ +t.write("jamroot.jam", "") +t.write("jamfile.jam", """ import path ; import project ; @@ -49,26 +53,28 @@ exe main : main.cpp helper ; lib helper : helper.cpp test_lib ; lib test_lib : : test_lib lib ; """) + t.write("main.cpp", """ void helper(); -int main() { helper(); return 0; } +int main() { helper(); } """) + t.write("helper.cpp", """ void foo(); - void #if defined(_WIN32) __declspec(dllexport) #endif helper() { foo(); } """) + t.run_build_system() t.expect_addition("bin/$toolset/debug/main.exe") t.rm("bin/$toolset/debug/main.exe") -# Test that 'unit-test' will correctly add runtime paths -# to searched libraries. -t.write('Jamfile', """ + +# Test that 'unit-test' will correctly add runtime paths to searched libraries. +t.write("jamfile.jam", """ import path ; import project ; @@ -83,44 +89,43 @@ unit-test main : main.cpp helper ; lib helper : helper.cpp test_lib ; lib test_lib : : test_lib lib ; """) + t.run_build_system() t.expect_addition("bin/$toolset/debug/main.passed") t.rm("bin/$toolset/debug/main.exe") -# Now try using searched lib from static lib. Request shared version -# of searched lib, since we don't have static one handy. -t.write('Jamfile', """ +# Now try using searched lib from static lib. Request shared version of searched +# lib, since we do not have a static one handy. +t.write("jamfile.jam", """ exe main : main.cpp helper ; lib helper : helper.cpp test_lib/shared : static ; lib test_lib : : test_lib lib ; """) + t.run_build_system(stderr=None) t.expect_addition("bin/$toolset/debug/main.exe") t.expect_addition("bin/$toolset/debug/link-static/helper.lib") t.rm("bin/$toolset/debug/main.exe") -# A regression test: property referring to -# searched-lib was mishandled. As the result, we were -# putting target name to the command line! +# A regression test: property referring to searched-lib was being +# 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('Jamfile', 'exe main : main.cpp d/d2//a ;') -t.write('main.cpp',""" +# 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("jamfile.jam", "exe main : main.cpp d/d2//a ;") +t.write("main.cpp", """ void foo(); -int main() { foo(); return 0; } - +int main() { foo(); } """) -t.write('d/d2/Jamfile', """ + +t.write("d/d2/jamfile.jam", """ lib test_lib : : test_lib ../../lib ; lib a : a.cpp : : : test_lib ; """) -t.write('d/d2/a.cpp', """ + +t.write("d/d2/a.cpp", """ #ifdef _WIN32 __declspec(dllexport) int force_library_creation_for_a; #endif @@ -128,39 +133,36 @@ __declspec(dllexport) int force_library_creation_for_a; t.run_build_system() -# A regression test. Searched targets were not associated -# with any properties. For that reason, if the same searched -# lib is generated with two different properties, we had an -# error saying they are actualized to the same Jam target name. -t.write("project-root.jam", "") +# A regression test. Searched targets were not associated with any properties. +# For that reason, if the same searched lib is generated with two different +# properties, we had an error saying they are actualized to the same Jam target +# name. +t.write("jamroot.jam", "") t.write("a.cpp", "") -# The 'l' library will be built in two variants: -# 'debug' (directly requested) and 'release' (requested -# from 'a'). -t.write("Jamfile", """ +# The 'l' library will be built in two variants: 'debug' (directly requested) +# and 'release' (requested from 'a'). +t.write("jamfile.jam", """ exe a : a.cpp l/release ; - lib l : : l_d debug ; lib l : : l_r release ; """) t.run_build_system("-n") -# A regression test. Two virtual target with the same properties -# were created for 'l' target, which caused and error to be reported -# when actualizing targets. The final error is correct, but we should -# not create two duplicated targets. Thanks to Andre Hentz -# for finding this bug. -t.write("project-root.jam", "") + +# A regression test. Two virtual target with the same properties were created +# for 'l' target, which caused and error to be reported when actualizing +# targets. The final error is correct, but we should not create two duplicated +# targets. Thanks to Andre Hentz for finding this bug. +t.write("jamroot.jam", "") t.write("a.cpp", "") -t.write("Jamfile", """ +t.write("jamfile.jam", """ project a : requirements static ; - static-lib a : a.cpp l ; lib l : : l_f ; """) @@ -168,19 +170,22 @@ lib l : : l_f ; t.run_build_system("-n") -# Make sure that plain "lib foobar ; " works. -t.write("Jamfile", """ +# Make sure plain "lib foobar ; " works. +t.write("jamfile.jam", """ exe a : a.cpp foobar ; lib foobar ; """) + t.run_build_system("-n -d2") t.fail_test(string.find(t.stdout(), "foobar") == -1) -# Make sure that plain "lib foo bar ; " works. -t.write("Jamfile", """ + +# Make sure plain "lib foo bar ; " works. +t.write("jamfile.jam", """ exe a : a.cpp foo bar ; lib foo bar ; """) + t.run_build_system("-n -d2") t.fail_test(string.find(t.stdout(), "foo") == -1) t.fail_test(string.find(t.stdout(), "bar") == -1) diff --git a/test/skipping.py b/test/skipping.py index 0c74a89f4..b3575eafd 100644 --- a/test/skipping.py +++ b/test/skipping.py @@ -1,40 +1,36 @@ #!/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) +# 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 V2 does not fail gracelessy when any target is skipped. -from BoostBuild import Tester, List +# Test that V2 does not fail gracelessy when any target is skipped. -# Create a temporary working directory -t = Tester() -t.write("a.cpp", """ -int main() {} +import BoostBuild + +# Create a temporary working directory. +t = BoostBuild.Tester() + +t.write("a.cpp", """ +int main() {} """) -t.write("b.cpp", """ -int main() {} +t.write("b.cpp", """ +int main() {} """) -t.write("c.cpp", """ -int main() {} +t.write("c.cpp", """ +int main() {} """) -t.write("Jamfile", """ -import feature : feature ; - -feature foo : 1 2 : link-incompatible ; - +t.write("jamroot.jam", """ +import feature ; +feature.feature foo : 1 2 : link-incompatible ; exe a : a.cpp : 1 ; exe b : b.cpp : 2 ; -exe c : c.cpp ; -""") - -t.write("project-root.jam", """ +exe c : c.cpp ; """) t.run_build_system("foo=1") t.cleanup() - diff --git a/test/sort_rule.py b/test/sort_rule.py index d38b4e5c6..f4a4acda1 100755 --- a/test/sort_rule.py +++ b/test/sort_rule.py @@ -20,7 +20,8 @@ import BoostBuild def testSORTCorrectness(): """Testing that Boost Jam's SORT builtin rule actually sorts correctly. """ - t = BoostBuild.Tester("-f test.jam -d1", pass_toolset=False, use_test_config=False) + t = BoostBuild.Tester("-f test.jam -d1", pass_toolset=False, + use_test_config=False) t.write("test.jam", """ NOCARE all ; @@ -57,7 +58,8 @@ def testSORTDuration(): """Regression test making sure Boost Jam's SORT builtin rule does not get quadratic behaviour again in this use case. """ - t = BoostBuild.Tester("-f test.jam -d1", pass_toolset=False, use_test_config=False) + t = BoostBuild.Tester("-f test.jam -d1", pass_toolset=False, + use_test_config=False) f = open(t.workpath("test.jam"), "w") print >> f, "data = " diff --git a/test/source_locations.py b/test/source_locations.py index d1ce9b86f..7133ab044 100644 --- a/test/source_locations.py +++ b/test/source_locations.py @@ -7,45 +7,34 @@ # Test that projects with multiple source-location directories are handled OK. -from BoostBuild import Tester -t = Tester() +import BoostBuild -t.write("Jamroot", """ +t = BoostBuild.Tester() + +t.write("jamroot.jam", """ path-constant SRC1 : "./src1" ; path-constant SRC2 : "./src2" ; path-constant SRC3 : "./src3" ; path-constant BUILD : "build" ; -project - : requirements - $(SRC1)/include - multi - : build-dir $(BUILD) - ; +project : requirements $(SRC1)/include multi + : build-dir $(BUILD) ; build-project project1 ; - """) -t.write("project1/Jamfile", """ -project project1 - : source-location $(SRC1) - $(SRC2) - $(SRC3) - ; -SRCS = s1.cpp - s2.cpp - testfoo.cpp - ; +t.write("project1/jamfile.jam", """ +project project1 : source-location $(SRC1) $(SRC2) $(SRC3) ; +SRCS = s1.cpp s2.cpp testfoo.cpp ; exe test : $(SRCS) ; """) -t.write("src1/s1.cpp", "int main() { return 0; }\n") +t.write("src1/s1.cpp", "int main() {}\n") t.write("src2/s2.cpp", "void hello() {}\n") t.write("src3/testfoo.cpp", "void testfoo() {}\n") -# This file should not be picked up, because "src2" is before -# "src3" in the list of source directories. +# This file should not be picked up, because "src2" is before "src3" in the list +# of source directories. t.write("src3/s2.cpp", "void hello() {}\n") t.run_build_system() diff --git a/test/stage.py b/test/stage.py index ba7ff693f..9862138b0 100644 --- a/test/stage.py +++ b/test/stage.py @@ -1,20 +1,19 @@ #!/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) +# 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 +# Test staging. -from BoostBuild import Tester -t = Tester() +import BoostBuild -t.write("project-root.jam", "import gcc ;") +t = BoostBuild.Tester() -t.write( - "Jamfile", -""" +t.write("jamroot.jam", "import gcc ;") + +t.write("jamfile.jam", """ lib a : a.cpp ; stage dist : a a.h auxilliary/1 ; """) @@ -36,25 +35,21 @@ t.run_build_system() t.expect_addition(["dist/a.dll", "dist/a.h", "dist/1"]) -# Regression test: the following was causing the "duplicate target name" -# error. -t.write( - "Jamfile", -""" +# Regression test: the following was causing the "duplicate target name" error. +t.write("jamfile.jam", """ project : requirements true ; lib a : a.cpp ; stage dist : a a.h auxilliary/1 ; alias dist-alias : dist ; """) + t.run_build_system() -# Test the property -t.write("Jamfile", """ +# Test the property. +t.write("jamfile.jam", """ lib a : a.cpp ; -stage dist : a - : debug:ds release:rs - ; +stage dist : a : debug:ds release:rs ; """) t.run_build_system() @@ -63,62 +58,60 @@ t.expect_addition("ds/a.dll") t.run_build_system("release") t.expect_addition("rs/a.dll") -# Test the property in subprojects. -# Thanks to Kirill Lapshin for bug report. -t.write("project-root.jam", """ +# Test the property in subprojects. Thanks to Kirill Lapshin for the +# bug report. + +t.write("jamroot.jam", """ path-constant DIST : dist ; """) -t.write("Jamfile", "build-project d ;") +t.write("jamfile.jam", "build-project d ;") -t.write( - "d/Jamfile", -""" +t.write("d/jamfile.jam", """ exe a : a.cpp ; stage dist : a : $(DIST) ; """) -t.write("d/a.cpp", "int main() { return 0;}\n") +t.write("d/a.cpp", "int main() {}\n") t.run_build_system() t.expect_addition("dist/a.exe") t.rm("dist") -# Workaround a BIG BUG: the response file is not deleted, -# even if application *is* deleted. We'll try to use the -# same response file when building from subdir, with very -# bad results. + +# Workaround a BIG BUG: the response file is not deleted, even if application +# *is* deleted. We will try to use the same response file when building from +# subdir, with very bad results. t.rm("d/bin") t.run_build_system(subdir="d") t.expect_addition("dist/a.exe") # Check that 'stage' does not incorrectly reset target suffixes. -t.write("a.cpp", """ -int main() {} +t.write("a.cpp", """ +int main() {} """) -t.write("project-root.jam", """ +t.write("jamroot.jam", """ import type ; type.register MYEXE : : EXE ; -type.set-generated-target-suffix MYEXE : off : myexe ; +type.set-generated-target-suffix MYEXE : off : myexe ; """) -# Since off is in properties when 'a' is built, and staged, -# it's suffix should be "myexe". -t.write("Jamfile", """ +# Since off is in properties when 'a' is built, and staged, its +# suffix should be "myexe". +t.write("jamfile.jam", """ stage dist : a ; -myexe a : a.cpp ; +myexe a : a.cpp ; """) t.run_build_system() t.expect_addition("dist/a.myexe") # Test 'stage's ability to traverse dependencies. -t.write("a.cpp", """ -int main() { return 0; } - +t.write("a.cpp", """ +int main() {} """) t.write("l.cpp", """ @@ -126,43 +119,45 @@ void #if defined(_WIN32) __declspec(dllexport) #endif -foo() { } - +foo() {} """) -t.write("Jamfile", """ +t.write("jamfile.jam", """ lib l : l.cpp ; exe a : a.cpp l ; -stage dist : a : on EXE LIB ; +stage dist : a : on EXE LIB ; """) -t.write("project-root.jam", "") +t.write("jamroot.jam", "") t.rm("dist") + t.run_build_system() t.expect_addition("dist/a.exe") t.expect_addition("dist/l.dll") -# Check that properties are ignored the traversing -# target for staging. +# Check that properties are ignored the traversing target for staging. t.copy("l.cpp", "l2.cpp") + t.copy("l.cpp", "l3.cpp") -t.write("Jamfile", """ + +t.write("jamfile.jam", """ lib l2 : l2.cpp ; lib l3 : l3.cpp ; lib l : l.cpp : l2 l3 ; exe a : a.cpp l ; -stage dist : a : on EXE LIB ; +stage dist : a : on EXE LIB ; """) t.rm("dist") + t.run_build_system() t.expect_addition("dist/l3.dll") t.expect_nothing("dist/l2.dll") # Check if on 'stage' works. t.rm(".") -t.write("Jamroot", """ +t.write("jamroot.jam", """ stage a1 : a1.txt : dist ; stage a2 : a2.txt : dist a1 ; """) @@ -171,77 +166,93 @@ t.write("a2.txt", "") t.run_build_system("a2") t.expect_addition(["dist/a1.txt", "dist/a2.txt"]) -# Regression test: check if . works +# Regression test: check that . works. t.rm(".") -t.write("Jamroot", """ + +t.write("jamroot.jam", """ stage a1 : d/a1.txt : . ; """) + t.write("d/a1.txt", "") + t.run_build_system() t.expect_addition("a1.txt") -# Test that relative paths of sources can be preserved +# Test that relative paths of sources can be preserved. t.rm(".") -t.write("Jamroot", """ + +t.write("jamroot.jam", """ install dist : a/b/c.h : . ; """) + t.write("a/b/c.h", "") + t.run_build_system() t.expect_addition("dist/a/b/c.h") -t.write("Jamroot", """ +t.write("jamroot.jam", """ install dist : a/b/c.h : a ; """) + t.write("a/b/c.h", "") + t.run_build_system() t.expect_addition("dist/b/c.h") t.rm(".") -t.write("build/Jamroot", """ -install dist : ../a/b/c.h - : ../dist ../a ; +t.write("build/jamroot.jam", """ +install dist : ../a/b/c.h : ../dist ../a ; """) + t.write("a/b/c.h", "") + t.run_build_system(subdir="build") t.expect_addition("dist/b/c.h") -t.write("Jamroot", """ +t.write("jamroot.jam", """ install dist2 : a/b/c.h : a ; """) + t.write("a/b/c.h", "") -t.write("sub/Jamfile", """ + +t.write("sub/jamfile.jam", """ alias h : ..//dist2 ; """) + t.run_build_system(subdir="sub") t.expect_addition("dist2/b/c.h") -# Test that when installing .cpp files, we don't scan -# include dependencies. +# Test that when installing .cpp files, we do not scan include dependencies. t.rm(".") -t.write("Jamroot", """ + +t.write("jamroot.jam", """ install dist : a.cpp ; """) + t.write("a.cpp", """ #include "a.h" """) + t.write("a.h", "") + t.run_build_system() t.expect_addition("dist/a.cpp") t.touch("a.h") + t.run_build_system() t.expect_nothing("dist/a.cpp") -# Test that property works, when there's just -# one file in sources. +# Test that property works, when there is just one file in sources. t.rm(".") -t.write("Jamroot", """ + +t.write("jamroot.jam", """ install dist : a.cpp : b.cpp ; """) -t.write("a.cpp", "test file") -t.run_build_system() +t.write("a.cpp", "test file") + +t.run_build_system() t.expect_addition("dist/b.cpp") t.cleanup() - diff --git a/test/standalone.py b/test/standalone.py index 70a95ee88..785bab597 100644 --- a/test/standalone.py +++ b/test/standalone.py @@ -1,29 +1,26 @@ #!/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) +# 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 BoostBuild + +t = BoostBuild.Tester() -t = Tester() # Regression tests: standalone project were not able to refer to targets -# declared in themselfs! - -t.write("a.cpp", """ -int main() -{ - return 0; -} +# declared in themselves. +t.write("a.cpp", """ +int main() {} """) -t.write("project-root.jam", """ -import standalone ; +t.write("jamroot.jam", """ +import standalone ; """) -t.write("standalone.jam", """ +t.write("standalone.jam", """ import project ; project.initialize $(__name__) ; @@ -33,14 +30,13 @@ local pwd = [ PWD ] ; alias x : $(pwd)/../a.cpp ; alias runtime : x ; - """) -t.write("sub/Jamfile", """ -stage bin : /standalone//runtime ; +t.write("sub/jamfile.jam", """ +stage bin : /standalone//runtime ; """) t.run_build_system(subdir="sub") t.expect_addition("sub/bin/a.cpp") -t.cleanup() +t.cleanup() diff --git a/test/startup_v1.py b/test/startup_v1.py index 3598c9351..14a286a70 100644 --- a/test/startup_v1.py +++ b/test/startup_v1.py @@ -1,27 +1,23 @@ #!/usr/bin/python -# Copyright 2002 Dave Abrahams -# Copyright 2003, 2004, 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) +# Copyright 2002 Dave Abrahams +# Copyright 2003, 2004, 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) -from BoostBuild import Tester +import BoostBuild import os import re -def expect_substring(actual,expected): +def expect_substring(actual, expected): return actual.find(expected) != -1 -def match_re(actual,expected): - return re.match(expected,actual,re.DOTALL) != None +def match_re(actual, expected): + return re.match(expected, actual, re.DOTALL) != None -# Test the v1 startup behavior -t = Tester( - executable='bjam' - , match=match_re - , boost_build_path='' - , pass_toolset=0 - ) +# Test the v1 startup behavior. +t = BoostBuild.Tester(executable='bjam', match=match_re, boost_build_path='', + pass_toolset=0) t.set_tree('startup') @@ -29,71 +25,57 @@ t.set_tree('startup') # t.run_build_system( # status=1, stdout="You didn't set BOOST_ROOT", match = expect_substring) -t.run_build_system( - extra_args = '-sBOOST_ROOT=.', status=1 - , stdout=r'''Unable to load Boost\.Build: could not find "boost-build\.jam".''' - ) +t.run_build_system(extra_args='-sBOOST_ROOT=.', status=1, + stdout=r'''Unable to load Boost\.Build: could not find ''' + + r'''"boost-build\.jam".''') os.chdir('no-bootstrap1') -t.run_build_system( - extra_args = '-sBOOST_ROOT=.', status=1 - , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' +t.run_build_system(extra_args='-sBOOST_ROOT=.', 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"''' - ) + + r'''but we were unable to find "bootstrap\.jam"''') # Descend to a subdirectory which /doesn't/ contain a boost-build.jam # file, and try again to test the crawl-up behavior. os.chdir('subdir') -t.run_build_system( - extra_args = '-sBOOST_ROOT=.', status=1 - , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' +t.run_build_system(extra_args='-sBOOST_ROOT=.', 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"''' - ) + + r'''but we were unable to find "bootstrap\.jam"''') os.chdir('../../no-bootstrap2') -t.run_build_system( - extra_args = '-sBOOST_ROOT=.', status=1 - , stdout=r'''Unable to load Boost\.Build: could not find build system\.''' +t.run_build_system(extra_args='-sBOOST_ROOT=.', 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"''' - ) + + r'''but we were unable to find "bootstrap\.jam"''') os.chdir('../no-bootstrap3') -t.run_build_system( - extra_args = '-sBOOST_ROOT=.', status=1 - , stdout=r'''Unable to load Boost.Build +t.run_build_system(extra_args='-sBOOST_ROOT=.', status=1, + stdout=r'''Unable to load Boost.Build .*boost-build.jam" was found.* -However, it failed to call the "boost-build" rule''' - ) +However, it failed to call the "boost-build" rule''') # test bootstrapping based on BOOST_BUILD_PATH os.chdir('../bootstrap-env') -t.run_build_system( - extra_args = '-sBOOST_ROOT=../boost-root -sBOOST_BUILD_PATH=../boost-root/build' - , stdout = 'build system bootstrapped' - ) +t.run_build_system(extra_args='-sBOOST_ROOT=../boost-root ' + + '-sBOOST_BUILD_PATH=../boost-root/build', + stdout='build system bootstrapped') # test bootstrapping based on an explicit path in boost-build.jam os.chdir('../bootstrap-explicit') -t.run_build_system( - extra_args = '-sBOOST_ROOT=../boost-root' - , stdout = 'build system bootstrapped' - ) +t.run_build_system(extra_args='-sBOOST_ROOT=../boost-root', + stdout='build system bootstrapped') # test bootstrapping based on BOOST_ROOT os.chdir('../bootstrap-implicit') -t.run_build_system( - extra_args = '-sBOOST_ROOT=../boost-root' - , stdout = 'build system bootstrapped' - ) +t.run_build_system(extra_args='-sBOOST_ROOT=../boost-root', + stdout='build system bootstrapped') t.cleanup() diff --git a/test/startup_v2.py b/test/startup_v2.py index abffbb828..a4faf56de 100644 --- a/test/startup_v2.py +++ b/test/startup_v2.py @@ -1,23 +1,20 @@ #!/usr/bin/python -# Copyright 2002 Dave Abrahams -# 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) +# Copyright 2002 Dave Abrahams +# 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) -from BoostBuild import Tester +import BoostBuild 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 - ) +# Test the v1 startup behavior. +t = BoostBuild.Tester(match=match_re, boost_build_path='', pass_toolset=0) t.set_tree('startup') @@ -35,8 +32,8 @@ t.run_build_system( + r'''but we were unable to find "bootstrap\.jam"''' ) -# Descend to a subdirectory which /doesn't/ contain a boost-build.jam -# file, and try again to test the crawl-up behavior. +# Descend to a subdirectory which /doesn't/ contain a boost-build.jam file, and +# try again to test the crawl-up behavior. os.chdir('subdir') t.run_build_system( @@ -66,18 +63,17 @@ t.run_build_system( However, it failed to call the "boost-build" rule''' ) -# test bootstrapping based on BOOST_BUILD_PATH +# Test bootstrapping based on BOOST_BUILD_PATH. os.chdir('../bootstrap-env') t.run_build_system( extra_args = '-sBOOST_BUILD_PATH=../boost-root/build' , stdout = 'build system bootstrapped' ) -# test bootstrapping based on an explicit path in boost-build.jam +# Test bootstrapping based on an explicit path in boost-build.jam. os.chdir('../bootstrap-explicit') t.run_build_system( stdout = 'build system bootstrapped' ) t.cleanup() - diff --git a/test/suffix.py b/test/suffix.py index 38b8ad2a3..cb4ad1180 100644 --- a/test/suffix.py +++ b/test/suffix.py @@ -1,33 +1,32 @@ #!/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) +# 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) -from BoostBuild import Tester, List +import BoostBuild -t = Tester() +t = BoostBuild.Tester() -# Regression test: when staging V2 used to change suffixes on targets -# corresponding to real files. -t.write("Jamfile", """ +# Regression test: when staging V2 used to change suffixes on targets +# corresponding to real files. +t.write("jamfile.jam", """ import type : register ; register A : a1 a2 a3 ; - -stage a : a.a3 ; +stage a : a.a3 ; """) -t.write("project-root.jam", "") +t.write("jamroot.jam", "") t.write("a.a3", "") t.run_build_system() t.expect_addition("a/a.a3"); -# Regression test: we should be able to specify empty suffix for -# derived target type, even if base type has non-empty suffix. +# Regression test: we should be able to specify empty suffix for derived target +# type, even if base type has non-empty suffix. t.write("a.cpp", "") -t.write("suffixes.jam", """ +t.write("suffixes.jam", """ import type ; import generators ; import common ; @@ -46,19 +45,17 @@ actions second { $(TOUCH) $(<) } - """) -t.write("project-root.jam", """ -import suffixes ; +t.write("jamroot.jam", """ +import suffixes ; """) -t.write("Jamfile", """ -second a : a.cpp ; +t.write("jamfile.jam", """ +second a : a.cpp ; """) t.run_build_system() t.expect_addition("bin/$toolset/debug/a") - t.cleanup() diff --git a/test/svn_tree.py b/test/svn_tree.py index 1ce8cd2b1..74bceb7f5 100644 --- a/test/svn_tree.py +++ b/test/svn_tree.py @@ -16,8 +16,8 @@ # ###################################################################### -# This file was modified by Vladimir Prus to store modification times in -# tree nodes. +# This file was modified by Vladimir Prus to store modification times in tree +# nodes. import re import string @@ -26,7 +26,6 @@ import os import stat - #======================================================================== # ===> Overview of our Datastructures <=== @@ -498,7 +497,7 @@ def compare_trees(a, b, def dump_tree(n,indent=""): "Print out a nice representation of the tree's structure." - # Code partially stolen from Dave Beazley + # Code partially stolen from Dave Beazley. if n.children is None: tmp_children = [] else: @@ -509,12 +508,11 @@ def dump_tree(n,indent=""): else: print "%s%s" % (indent, n.name) - indent = indent.replace("-"," ") - indent = indent.replace("+"," ") + indent = indent.replace("-", " ") + indent = indent.replace("+", " ") for i in range(len(tmp_children)): c = tmp_children[i] - if i == len(tmp_children - )-1: + if i == len(tmp_children) - 1: dump_tree(c,indent + " +-- ") else: dump_tree(c,indent + " |-- ") diff --git a/test/symlink.py b/test/symlink.py index 92c06248f..d78e96c15 100644 --- a/test/symlink.py +++ b/test/symlink.py @@ -1,36 +1,41 @@ #!/usr/bin/python -# Copyright 2003 Dave Abrahams -# 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) +# Copyright 2003 Dave Abrahams +# 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 the 'symlink' rule +# Test the 'symlink' rule. -from BoostBuild import Tester, List import os -t = Tester() +import BoostBuild + if os.name != 'posix': - print "The symlink tests can be run on posix only" + print "The symlink tests can be run on posix only." + import sys sys.exit(1) -t.write("project-root.jam", "import gcc ;") -t.write("Jamfile", """ + +t = BoostBuild.Tester() + +t.write("jamroot.jam", "import gcc ;") + +t.write("jamfile.jam", """ exe hello : hello.cpp ; -symlink hello_release : hello/release ; +symlink hello_release : hello/release ; symlink hello_debug : hello/debug ; -symlink links/hello_release : hello/release ; +symlink links/hello_release : hello/release ; """) + t.write("hello.cpp", """ -int main() -{ - return 0; -} +int main() {} """) t.run_build_system() -t.expect_addition(List('hello_debug.exe hello_release.exe links/hello_release.exe')) - +t.expect_addition([ + 'hello_debug.exe', + 'hello_release.exe', + 'links/hello_release.exe']) t.cleanup() diff --git a/test/tag.py b/test/tag.py index d65bed340..aef31e808 100644 --- a/test/tag.py +++ b/test/tag.py @@ -1,9 +1,9 @@ #!/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. +# 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. import BoostBuild @@ -20,21 +20,21 @@ def test_folder_with_dot_in_name(t): a dot in their name. """ - t.write("version-1.32.0/Jamroot.jam", """ + t.write("version-1.32.0/jamroot.jam", """ project test : requirements @$(__name__).tag ; rule tag ( name : type ? : property-set ) { # Do nothing, just make sure the rule is invoked OK. - ECHO "The tag rule was invoked" ; + ECHO "The tag rule has been invoked." ; } exe a : a.cpp ; """) - t.write("version-1.32.0/a.cpp", "int main() { return 0; }\n") + t.write("version-1.32.0/a.cpp", "int main() {}\n") t.run_build_system(subdir="version-1.32.0") t.expect_addition("version-1.32.0/bin/$toolset/debug/a.exe") - t.expect_output_line("The tag rule was invoked") + t.expect_output_line("The tag rule has been invoked.") ################################################################################ @@ -48,7 +48,7 @@ def test_tag_property(t): """Basic tag property test. """ - t.write("Jamroot.jam", """ + t.write("jamroot.jam", """ import virtual-target ; rule tag ( name : type ? : property-set ) @@ -78,11 +78,7 @@ stage c : a ; """) t.write("a.cpp", """ -int main() -{ - return 0; -} - +int main() {} #ifdef _MSC_VER __declspec (dllexport) void x () {} #endif diff --git a/test/template.py b/test/template.py index 289053db2..1fbef07b8 100644 --- a/test/template.py +++ b/test/template.py @@ -1,41 +1,42 @@ #!/usr/bin/python -# Copyright (C) FILL SOMETHING HERE 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) +# Copyright (C) FILL SOMETHING HERE 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) -# This file is template for Boost.Build tests. It creates a simple -# project that builds one exe from one source, and checks that the exe -# is really created. -from BoostBuild import Tester, List +# This file is template for Boost.Build tests. It creates a simple project that +# builds one exe from one source, and checks that the exe is really created. -# Create a temporary working directory -t = Tester() +import BoostBuild -# Create the needed files -t.write("Jamroot", """ + +# Create a temporary working directory. +t = BoostBuild.Tester() + +# Create the needed files. +t.write("jamroot.jam", """ exe hello : hello.cpp ; """) + t.write("hello.cpp", """ -int main() -{ - return 0; -} - -""") +int main() {} +""" +# Run the build. t.run_build_system() -# First, create a list of three pathnames -file_list = List("bin/$toolset/debug/") * List("hello.exe hello.obj") -# Second, assert that those files were added as result of the last build system invocation. +# First, create a list of three pathnames. +file_list = BoostBuild.List("bin/$toolset/debug/") * \ + BoostBuild.List("hello.exe hello.obj") +# Second, assert that those files were added as result of the last build system +# invocation. t.expect_addition(file_list) -# Invoke the build system once again +# Invoke the build system once again. t.run_build_system("clean") # Check if the files added previously were removed. t.expect_removal(file_list) -# Remove temporary directories +# Remove temporary directories. t.cleanup() diff --git a/test/test1.py b/test/test1.py index 9253269a9..3cdc71d2d 100644 --- a/test/test1.py +++ b/test/test1.py @@ -8,8 +8,9 @@ import BoostBuild t = BoostBuild.Tester() -t.write("test.jam",""" -actions unbuilt { } unbuilt all ; +t.write("test.jam", """ +actions unbuilt { } +unbuilt all ; ECHO "Hi" ; """) diff --git a/test/test2.py b/test/test2.py index b982d4001..b5c9ba824 100644 --- a/test/test2.py +++ b/test/test2.py @@ -1,24 +1,25 @@ #!/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) +# 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 +import BoostBuild -t = Tester() +t = BoostBuild.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") +file_list = 'bin/foo/$toolset/debug/runtime-link-dynamic/' * \ + BoostBuild.List("foo foo.o") + +t.run_build_system("-sBOOST_BUILD_PATH=" + t.original_workdir + "/..") t.expect_addition(file_list) -t.write("foo.cpp", "int main(int, char**) { return 0; }\n") +t.write("foo.cpp", "int main() {}\n") t.run_build_system("-d2 -sBOOST_BUILD_PATH=" + t.original_workdir + "/..") t.expect_touch(file_list) -t.pass_test() +t.pass_test() diff --git a/test/test2/Jamfile b/test/test2/jamfile.jam similarity index 100% rename from test/test2/Jamfile rename to test/test2/jamfile.jam diff --git a/test/test_all.py b/test/test_all.py index 13e878498..04d0978d9 100644 --- a/test/test_all.py +++ b/test/test_all.py @@ -6,17 +6,16 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import os, sys, string +import os +import sys +import string import BoostBuild -from BoostBuild import get_toolset -# clear environment for testing + +# Clear environment for testing. # -for s in ( - 'BOOST_ROOT','BOOST_BUILD_PATH','JAM_TOOLSET','BCCROOT', - 'MSVCDir','MSVC','MSVCNT','MINGW','watcom' - ): - +for s in ('BOOST_ROOT', 'BOOST_BUILD_PATH', 'JAM_TOOLSET', 'BCCROOT', 'MSVCDir', + 'MSVC', 'MSVCNT', 'MINGW', 'watcom' ): try: del os.environ[s] except: @@ -24,12 +23,13 @@ for s in ( BoostBuild.set_defer_annotations(1) + def run_tests(critical_tests, other_tests): """Runs first critical tests and then other_tests. Stops on first error, and write the name of failed test to - test_results.txt. Critical tests are run in the specified order, - other tests are run starting with the one that failed the last time. + test_results.txt. Critical tests are run in the specified order, other + tests are run starting with the one that failed the last time. """ last_failed = last_failed_test() other_tests = reorder_tests(other_tests, last_failed) @@ -50,17 +50,16 @@ def run_tests(critical_tests, other_tests): f.write(i) f.close() failures_count = failures_count + 1 - # Restore the current directory, which might be changed by the - # test + # Restore the current directory, which might be changed by the test. os.chdir(invocation_dir) BoostBuild.flush_annotations(); continue print "PASSED" BoostBuild.flush_annotations(); pass_count = pass_count + 1 - sys.stdout.flush() # makes testing under emacs more entertaining. + sys.stdout.flush() # Makes testing under emacs more entertaining. - # Erase the file on success + # Erase the file on success. if failures_count == 0: open('test_results.txt', 'w') @@ -80,6 +79,7 @@ def last_failed_test(): except: return None + def reorder_tests(tests, first_test): try: n = tests.index(first_test) @@ -93,106 +93,110 @@ critical_tests = ["unit_tests", "module_actions", "startup_v1", "startup_v2"] critical_tests += ["core_d12", "core_typecheck", "core_delete_module", "core_varnames", "core_import_module"] -tests = [ "rebuilds", - "timedata", - "project_test3", - "project_test4", - "generators_test", - "dependency_test", - "path_features", - "relative_sources", - "no_type", +tests = [ "absolute_sources", + "alias", + "alternatives", + "bad_dirname", + "build_dir", + "build_file", + "build_no", + "c_file", "chain", - "default_build", - "default_toolset", - "use_requirements", + "clean", + "composite", "conditionals", "conditionals2", "conditionals3", "conditionals_multiple", "configuration", - "indirect_conditional", - "stage", - "prebuilt", - "project_dependencies", - "build_dir", - "searched_lib", - "make_rule", - "alias", - "alternatives", - "default_features", - "print", - "ndebug", - "explicit", - "absolute_sources", - "dependency_property", "custom_generator", - "bad_dirname", - "c_file", - "inline", - "property_expansion", - "loop", - "tag", - "suffix", - "inherit_toolset", - "skipping", - "project_glob", - "project_root_constants", - "double_loading", - "dll_path", - "regression", - "composite", - "library_chain", - "unit_test", - "standalone", - "expansion", - "wrapper", - "duplicate", - "library_property", - "load_order", - "wrong_project", - "using", - "source_locations", - "out_of_tree", - "notfile", - "project_root_rule", - "resolution", - "build_file", - "build_no", + "default_build", + "default_features", + "default_toolset", + "dependency_property", + "dependency_test", "disambiguation", - "clean", - "lib_source_property", - "implicit_dependency", + "dll_path", + "double_loading", + "duplicate", "example_libraries", "example_make", - "remove_requirement", - "free_features_request", + "expansion", + "explicit", "file_name_handling", - "sort_rule" + "free_features_request", + "generator_selection", + "generators_test", + "implicit_dependency", + "indirect_conditional", + "inherit_toolset", + "inherited_dependency", + "inline", + "lib_source_property", + "library_chain", + "library_property", + "load_order", + "loop", + "make_rule", + "ndebug", + "no_type", + "notfile", + "ordered_include", + "out_of_tree", + "path_features", + "prebuilt", + "print", + "project_dependencies", + "project_glob", + "project_root_constants", + "project_root_rule", + "project_test3", + "project_test4", + "property_expansion", + "rebuilds", + "regression", + "relative_sources", + "remove_requirement", + "resolution", + "searched_lib", + "skipping", + "sort_rule", + "source_locations", + "stage", + "standalone", + "suffix", + "tag", + "test_result_dumping", + "testing_support", + "timedata", + "unit_test", + "use_requirements", + "using", + "wrapper", + "wrong_project" ] if os.name == 'posix': tests.append("symlink") - # On windows, library order is not important, so skip this test - # Besides, it fails ;-) - # Further, the test relies on the fact that on Linux, one - # can build a shared library with unresolved symbols. This is - # not true on Windows (even with cygwin gcc). + # On windows, library order is not important, so skip this test. Besides, it + # fails ;-). Further, the test relies on the fact that on Linux, one can + # build a shared library with unresolved symbols. This is not true on + # Windows (even with cygwin gcc). if string.find(os.uname()[0], "CYGWIN") == -1: tests.append("library_order") -if string.find(get_toolset(), 'gcc') == 0: +if string.find(BoostBuild.get_toolset(), 'gcc') == 0: tests.append("gcc_runtime") -if string.find(get_toolset(), 'gcc') == 0 or string.find(get_toolset(), 'msvc') == 0: +if ( string.find(BoostBuild.get_toolset(), 'gcc') == 0 )or \ + ( string.find(BoostBuild.get_toolset(), 'msvc') == 0 ): tests.append("pch") if "--extras" in sys.argv: tests.append("boostbook") tests.append("qt4") tests.append("example_qt4") - # Requires ./whatever.py to work, so is - # not guaranted to work everywhere. + # Requires ./whatever.py to work, so is not guaranted to work everywhere. tests.append("example_customization") # Requires gettext tools. tests.append("example_gettext") diff --git a/test/test_result_dumping.py b/test/test_result_dumping.py new file mode 100755 index 000000000..07eb59480 --- /dev/null +++ b/test/test_result_dumping.py @@ -0,0 +1,33 @@ +#!/usr/bin/python + +# Copyright 2008 Jurko Gospodnetic +# 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) + +# Tests dumping Boost Build based testing results. + +import BoostBuild + + +################################################################################ +# +# Test that dumping Boost Build based testing results works in case test code +# is not located in a folder under the Jamroot folder. +# +################################################################################ + +t = BoostBuild.Tester("--dump-tests") + +t.write("TestBuild/jamroot.jam", """ +import testing ; +test-suite testit : [ run ../TestSource/test.cpp ] ; +""") + +t.write("TestSource/test.cpp", """ +int main() {} +""") + +t.run_build_system("", subdir="TestBuild") +t.expect_output_line('boost-test(RUN) "*/TestBuild/test" : "../TestSource/test.cpp"') + +t.cleanup() diff --git a/test/test_system.html b/test/test_system.html index 876c682d2..32ff363d2 100644 --- a/test/test_system.html +++ b/test/test_system.html @@ -112,12 +112,11 @@ "../../../jam/index.html">$boost_build_root/jam/index.html for instructions. -
  • Configure at least one toolset. You can edit - site-config.jam or user-config.jam to add new - toolsets. Or you can create file test-config.jam in - $boost_build_root/test directory. In this case, - site-config.jam and user-config.jam will be ignored - for testing.
  • +
  • Configure at least one toolset. You can edit site-config.jam + or user-config.jam to add new toolsets. Or you can create file + test-config.jam in $boost_build_root/test directory. In + this case, site-config.jam and user-config.jam will be + ignored for testing.
  • When all is set, you can run all the tests using the test_all.py @@ -211,14 +210,14 @@ python generators_test.py msvc-7.1

    The "hello.py" module might contain:

    -from BoostBuild import Tester, List
    +from BoostBuild import List
     
     # Create a temporary working directory
    -t = Tester()
    +t = BoostBuild.Tester()
     
     # Create the needed files
    -t.write("project-root.jam", "")
    -t.write("Jamfile", """
    +t.write("jamroot.jam", "")
    +t.write("jamfile.jam", """
     exe hello : hello.cpp ;
     """)
     t.write("hello.cpp", """
    diff --git a/test/testing_primitives.py b/test/testing_primitives.py
    index b2607390b..ae62993b3 100644
    --- a/test/testing_primitives.py
    +++ b/test/testing_primitives.py
    @@ -4,34 +4,27 @@
     # 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
    -from string import strip
    +import BoostBuild
     import re
     
    -def match_re(actual,expected):
    -    return re.match(expected,actual,re.DOTALL) != None
    +def match_re(actual, expected):
    +    return re.match(expected, actual, re.DOTALL) != None
     
    -t = Tester(match = match_re)
    +t = BoostBuild.Tester(match=match_re)
     
     t.set_tree('testing-primitives')
     
    -# We expect t5 and t7's output to be dumped to stdout
    +# 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')
    -
     t.expect_nothing_more()
    +
     t.cleanup()
    -print 'tesing complete'
    diff --git a/test/testing_support.py b/test/testing_support.py
    new file mode 100755
    index 000000000..eee4345c5
    --- /dev/null
    +++ b/test/testing_support.py
    @@ -0,0 +1,61 @@
    +#!/usr/bin/python
    +
    +# Copyright 2008 Jurko Gospodnetic
    +# 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)
    +
    +# Tests different aspects of Boost Builds automated testing support.
    +
    +import BoostBuild
    +
    +
    +################################################################################
    +#
    +# test_files_with_spaces_in_their_name()
    +# --------------------------------------
    +#
    +################################################################################
    +
    +def test_files_with_spaces_in_their_name():
    +    """Regression test making sure test result files get created correctly when
    +    testing files with spaces in their name.
    +    """
    +
    +    t = BoostBuild.Tester()
    +
    +    t.write("valid source.cpp", "int main() {}\n");
    +
    +    t.write("invalid source.cpp", "this is not valid source code");
    +    
    +    t.write("jamroot.jam", """
    +import testing ;
    +testing.compile "valid source.cpp" ;
    +testing.compile-fail "invalid source.cpp" ;
    +""")
    +
    +    t.run_build_system(status=0)
    +    t.expect_addition("bin/invalid source.test/$toolset/debug/invalid source.obj")
    +    t.expect_addition("bin/invalid source.test/$toolset/debug/invalid source.test")
    +    t.expect_addition("bin/valid source.test/$toolset/debug/valid source.obj")
    +    t.expect_addition("bin/valid source.test/$toolset/debug/valid source.test")
    +
    +    t.expect_content("bin/valid source.test/$toolset/debug/valid source.test", \
    +        "passed" )
    +    t.expect_content( \
    +        "bin/invalid source.test/$toolset/debug/invalid source.test", \
    +        "passed" )
    +    t.expect_content( \
    +        "bin/invalid source.test/$toolset/debug/invalid source.obj", \
    +        "failed as expected" )
    +
    +    t.cleanup()
    +
    +
    +################################################################################
    +#
    +# main()
    +# ------
    +#
    +################################################################################
    +
    +test_files_with_spaces_in_their_name()
    diff --git a/test/timedata.py b/test/timedata.py
    index 8a3d87c76..04ec99f98 100644
    --- a/test/timedata.py
    +++ b/test/timedata.py
    @@ -1,16 +1,30 @@
     #!/usr/bin/python
    -# Copyright David Abrahams 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)
     
    -# This tests the build step timing facilities.
    +# Copyright 2005 David Abrahams
    +# Copyright 2008 Jurko Gospodnetic
    +# 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)
    +
    +# Tests the build step timing facilities.
    +
     
     import BoostBuild
     import re
     
    -t = BoostBuild.Tester(pass_toolset=0)
     
    -t.write("file.jam", """
    +################################################################################
    +#
    +# basic_jam_action_test()
    +# -----------------------
    +#
    +################################################################################
    +
    +def basic_jam_action_test():
    +    """Tests basic Jam action timing support."""
    +
    +    t = BoostBuild.Tester(pass_toolset=0)
    +
    +    t.write("file.jam", """
     rule time
     {
         DEPENDS $(<) : $(>) ;
    @@ -40,14 +54,13 @@ actions make
         echo made from $(>) >> $(<)
     }
     
    -
     time foo : bar ;
     make bar : baz ;
     """)
     
    -t.write("baz", "nothing\n")
    +    t.write("baz", "nothing\n")
     
    -expected_output = """\.\.\.found 4 targets\.\.\.
    +    expected_output = """\.\.\.found 4 targets\.\.\.
     \.\.\.updating 2 targets\.\.\.
     make bar
     time foo
    @@ -55,10 +68,88 @@ bar +user: [0-9\.]+ +system: +[0-9\.]+ *
     \.\.\.updated 2 targets\.\.\.$
     """
     
    -t.run_build_system("-ffile.jam -d+1", stdout=expected_output,
    -    match=lambda actual, expected: re.search(expected, actual, re.DOTALL))
    -t.expect_addition("foo")
    -t.expect_addition("bar")
    -t.expect_nothing_more()
    +    t.run_build_system("-ffile.jam -d+1", stdout=expected_output, match=lambda
    +        actual, expected: re.search(expected, actual, re.DOTALL))
    +    t.expect_addition("foo")
    +    t.expect_addition("bar")
    +    t.expect_nothing_more()
     
    -t.cleanup()
    +    t.cleanup()
    +
    +
    +################################################################################
    +#
    +# boost_build_testing_support_timing_rule():
    +# ------------------------------------------
    +#
    +################################################################################
    +
    +def boost_build_testing_support_timing_rule():
    +    """Tests the target build timing rule provided by the Boost Build testing
    +    support system.
    +    """
    +
    +    t = BoostBuild.Tester()
    +
    +    t.write("aaa.cpp", "int main() {}\n")
    +
    +    t.write("jamroot.jam", """
    +import testing ;
    +exe my-exe : aaa.cpp ;
    +time my-time : my-exe ;
    +""")
    +
    +    t.run_build_system()
    +    t.expect_addition("bin/$toolset/debug/aaa.obj")
    +    t.expect_addition("bin/$toolset/debug/my-exe.exe")
    +    t.expect_addition("bin/$toolset/debug/my-time.time")
    +
    +    t.expect_content_line("bin/$toolset/debug/my-time.time", "user: *")
    +    t.expect_content_line("bin/$toolset/debug/my-time.time", "system: *")
    +
    +    t.cleanup()
    +
    +
    +################################################################################
    +#
    +# boost_build_testing_support_timing_rule_with_spaces_in_names()
    +# --------------------------------------------------------------
    +#
    +################################################################################
    +
    +def boost_build_testing_support_timing_rule_with_spaces_in_names():
    +    """Tests the target build timing rule provided by the Boost Build testing
    +    support system when used with targets contining spaces in their names.
    +    """
    +
    +    t = BoostBuild.Tester()
    +
    +    t.write("aaa bbb.cpp", "int main() {}\n")
    +
    +    t.write("jamroot.jam", """
    +import testing ;
    +exe "my exe" : "aaa bbb.cpp" ;
    +time "my time" : "my exe" ;
    +""")
    +
    +    t.run_build_system()
    +    t.expect_addition("bin/$toolset/debug/aaa bbb.obj")
    +    t.expect_addition("bin/$toolset/debug/my exe.exe")
    +    t.expect_addition("bin/$toolset/debug/my time.time")
    +
    +    t.expect_content_line("bin/$toolset/debug/my time.time", "user: *")
    +    t.expect_content_line("bin/$toolset/debug/my time.time", "system: *")
    +
    +    t.cleanup()
    +
    +
    +################################################################################
    +#
    +# main()
    +# ------
    +#
    +################################################################################
    +
    +basic_jam_action_test()
    +boost_build_testing_support_timing_rule()
    +boost_build_testing_support_timing_rule_with_spaces_in_names()
    \ No newline at end of file
    diff --git a/test/tree.py b/test/tree.py
    index af2ff25e5..89f8ad4ff 100644
    --- a/test/tree.py
    +++ b/test/tree.py
    @@ -1,7 +1,7 @@
    -# Copyright 2003 Dave Abrahams 
    -# Copyright 2001, 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) 
    +# Copyright 2003 Dave Abrahams
    +# Copyright 2001, 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)
     
     # This file is based in part on the content of svn_tree.py.
     
    @@ -20,7 +20,7 @@ class Trees_difference:
             self.removed_files.extend(other.removed_files)
             self.modified_files.extend(other.modified_files)
             self.touched_files.extend(other.touched_files)
    -     
    +
         def ignore_directories(self):
             "Removes directories for list of found differences"
     
    @@ -33,13 +33,15 @@ class Trees_difference:
     
         def pprint(self, f=None):
             print >> f, "Added files   :", self.added_files
    -        print >> f,"Removed files :", self.removed_files
    +        print >> f, "Removed files :", self.removed_files
             print >> f, "Modified files:", self.modified_files
             print >> f, "Touched files :", self.touched_files
     
         def empty(self):
    -        return (len(self.added_files) == 0 and len(self.removed_files) == 0)\
    -                and len(self.modified_files) == 0 and len(self.touched_files) == 0
    +        return ( len(self.added_files) == 0 ) and \
    +            ( len(self.removed_files) == 0 ) and \
    +            ( len(self.modified_files) == 0 ) and \
    +            ( len(self.touched_files) == 0 )
     
     def build_tree(dir):
         return svn_tree.build_tree_from_wc(dir, load_props=0, ignore_svn=1)
    diff --git a/test/unit_test.py b/test/unit_test.py
    index f3ec569ec..94575ad31 100644
    --- a/test/unit_test.py
    +++ b/test/unit_test.py
    @@ -1,16 +1,17 @@
     #!/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) 
    +# 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 the unit_test rule.
     
    -#  Test the unit_test rule
     import BoostBuild
     
     t = BoostBuild.Tester()
     
     # Create the needed files.
    -t.write("Jamroot.jam", """
    +t.write("jamroot.jam", """
     using testing ;
     lib helper : helper.cpp ;
     unit-test test : test.cpp : helper ;
    @@ -18,11 +19,7 @@ unit-test test : test.cpp : helper ;
     
     t.write("test.cpp", """
     void helper();
    -int main()
    -{
    -    helper();
    -    return 0;
    -}
    +int main() { helper(); }
     """)
     
     t.write("helper.cpp", """
    diff --git a/test/unit_tests.py b/test/unit_tests.py
    index 7da89f609..b2cac4bd5 100644
    --- a/test/unit_tests.py
    +++ b/test/unit_tests.py
    @@ -4,9 +4,10 @@
     # 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
    +import BoostBuild
    +
    +t = BoostBuild.Tester(pass_toolset=0)
     
    -t = Tester(pass_toolset=0)
     t.run_build_system(extra_args="--debug --build-system=test")
     
     t.cleanup()
    diff --git a/test/unused.py b/test/unused.py
    index 976efed89..9db2380cd 100644
    --- a/test/unused.py
    +++ b/test/unused.py
    @@ -6,26 +6,26 @@
     
     # Test that unused sources are at least reported.
     
    -from BoostBuild import Tester
    +import BoostBuild
     from string import find
    -t = Tester()
    +
    +t = BoostBuild.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.
    +# The second invocation should do nothing, and produce no warning. The previous
    +# invocation might have printed executed actions and other things, so it is 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","""
    +# Now check that even if main target generates nothing, its usage requirements
    +# are still propagated to dependants.
    +t.write("a.cpp", """
     #ifdef FOO
     int main() {}
     #endif
    @@ -33,4 +33,3 @@ int main() {}
     t.run_build_system("-sGENERATE_NOTHING=1")
     
     t.cleanup()
    -
    diff --git a/test/unused/Jamfile b/test/unused/jamfile.jam
    similarity index 100%
    rename from test/unused/Jamfile
    rename to test/unused/jamfile.jam
    diff --git a/test/unused/project-root.jam b/test/unused/jamroot.jam
    similarity index 100%
    rename from test/unused/project-root.jam
    rename to test/unused/jamroot.jam
    diff --git a/test/use_requirements.py b/test/use_requirements.py
    index 546abde54..a73c01f1f 100644
    --- a/test/use_requirements.py
    +++ b/test/use_requirements.py
    @@ -1,33 +1,29 @@
     #!/usr/bin/python
     
    -# Copyright 2003 Dave Abrahams 
    -# Copyright 2002, 2003, 2004, 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) 
    +# Copyright 2003 Dave Abrahams
    +# Copyright 2002, 2003, 2004, 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
    -t = Tester()
    +import BoostBuild
     
    -# Test that use requirements on main target work
    -# (and a propagated all the way up, not only to direct
    -# dependents)
    -t.write("project-root.jam", "import gcc ;")
    +t = BoostBuild.Tester()
     
    -# Note: 'lib cc ..', not 'lib c', If using 'lib c: ...' the HP-CXX
    -# linker will confuse it with the system C runtime.
    -t.write(
    -    "Jamfile",
    -"""
    -    lib b : b.cpp : shared:SHARED_B
    -    : : FOO shared:SHARED_B    
    -    ;
    -    lib cc : c.cpp b ;
    -    exe a : a.cpp cc ;
    +
    +# Test that use requirements on main target work (and a propagated all the way
    +# up, not only to direct dependants).
    +t.write("jamroot.jam", "import gcc ;")
    +
    +# Note: 'lib cc ..', not 'lib c'. If using 'lib c: ...' the HP-CXX linker will
    +# confuse it with the system C runtime.
    +t.write("jamfile.jam", """
    +lib b : b.cpp : shared:SHARED_B : :
    +    FOO shared:SHARED_B ;
    +lib cc : c.cpp b ;
    +exe a : a.cpp cc ;
     """)
     
    -t.write(
    -    "b.cpp",
    -"""
    +t.write("b.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
     __declspec(dllexport)
    @@ -35,9 +31,7 @@ __declspec(dllexport)
     foo() {}\n
     """)
     
    -t.write(
    -    "c.cpp",
    -"""
    +t.write("c.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
     __declspec(dllexport)
    @@ -45,10 +39,7 @@ __declspec(dllexport)
     create_lib_please() {}\n
     """)
     
    -
    -t.write(
    -    "a.cpp",
    -"""
    +t.write("a.cpp", """
     #ifdef FOO
     void
     # if defined(_WIN32) && defined(SHARED_B)
    @@ -56,30 +47,24 @@ __declspec(dllexport)
     # endif
     foo() {}
     #endif
    -
     int main() { foo(); }
     """)
     
     t.run_build_system()
    -
     t.run_build_system("--clean")
     
    +
     # Test that use requirements on main target work, when they are referred using
     # 'dependency' features.
    -t.write("project-root.jam", "import gcc ;")
    +t.write("jamroot.jam", "import gcc ;")
     
    -t.write(
    -    "Jamfile", 
    -"""
    -    lib b : b.cpp : shared:SHARED_B
    -    : : FOO shared:SHARED_B
    -    ;
    -    exe a : a.cpp : b ;
    +t.write("jamfile.jam", """
    +lib b : b.cpp : shared:SHARED_B : : FOO
    +    shared:SHARED_B ;
    +exe a : a.cpp : b ;
     """)
     
    -t.write(
    -    "b.cpp",
    -"""
    +t.write("b.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
     __declspec(dllexport)
    @@ -87,11 +72,9 @@ __declspec(dllexport)
     foo() {}
     """)
     
    -t.write(
    -    "a.cpp",
    -"""
    +t.write("a.cpp", """
     #ifdef FOO
    -int main() { return 0; }
    +int main() {}
     #endif
     """)
     
    @@ -100,22 +83,17 @@ t.run_build_system()
     t.run_build_system("--clean")
     
     
    -# Test that use requirement on project work
    -t.write("Jamfile", "exe a : a.cpp lib//b ;")
    +# Test that usage requirements on a project work.
    +t.write("jamfile.jam", "exe a : a.cpp lib//b ;")
     
    -t.write(
    -    "lib/Jamfile", 
    -"""
    +t.write("lib/jamfile.jam", """
     project
        : requirements shared:SHARED_B
    -   : usage-requirements FOO shared:SHARED_B
    -    ;
    +   : usage-requirements FOO shared:SHARED_B ;
     lib b : b.cpp ;
     """)
     
    -t.write(
    -    "lib/b.cpp", 
    -"""
    +t.write("lib/b.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
     __declspec(dllexport)
    @@ -125,42 +103,29 @@ foo() {}\n
     
     t.run_build_system()
     
    -# Test that use requirements are inherited correctly
     
    -t.write("Jamfile", "exe a : a.cpp lib/1//b ;")
    +# Test that use requirements are inherited correctly.
    +t.write("jamfile.jam", "exe a : a.cpp lib/1//b ;")
     
    -t.write(
    -    "a.cpp", 
    -"""
    +t.write("a.cpp", """
     #if defined(FOO) && defined(ZOO)
     void foo() {}
     #endif
    -
     int main() { foo(); }
     """)
     
    -t.write(
    -    "lib/Jamfile", 
    -"""
    -project
    -   : requirements
    -   : usage-requirements FOO
    -    ;
    +t.write("lib/jamfile.jam", """
    +project : requirements : usage-requirements FOO ;
     """)
     
    -t.write(
    -    "lib/1/Jamfile", 
    -"""
    +t.write("lib/1/jamfile.jam", """
     project
        : requirements shared:SHARED_B
    -   : usage-requirements ZOO shared:SHARED_B 
    -   ;
    +   : usage-requirements ZOO shared:SHARED_B ;
     lib b : b.cpp ;
     """)
     
    -t.write(
    -    "lib/1/b.cpp", 
    -"""
    +t.write("lib/1/b.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
     __declspec(dllexport)
    @@ -171,29 +136,22 @@ foo() {}\n
     t.run_build_system()
     t.run_build_system("--clean")
     
    -# Test that we correctly handle dependency features
    -# in use requirements on target
     
    -t.write(
    -    "Jamfile", 
    -"""
    -    lib b : b.cpp : shared:SHARED_B 
    -    : : FOO shared:SHARED_B
    -    ;
    -    
    -    # Here's the test: we should correctly
    -    # handle dependency feature and get
    -    # use requirements from 'b'.
    -    lib cc : c.cpp : shared:SHARED_C : : b ;
    -    
    -    # This will build only if FOO
    -    # was propagated from 'c'.
    -    exe a : a.cpp cc ;
    +# Test that we correctly handle dependency features in use requirements on
    +# target.
    +t.write("jamfile.jam", """
    +lib b : b.cpp : shared:SHARED_B : : FOO
    +    shared:SHARED_B ;
    +
    +# Here's the test: we should correctly handle dependency feature and get usage
    +# requirements from 'b'.
    +lib cc : c.cpp : shared:SHARED_C : : b ;
    +
    +# This will build only if FOO was propagated from 'c'.
    +exe a : a.cpp cc ;
     """)
     
    -t.write(
    -    "a.cpp", 
    -"""
    +t.write("a.cpp", """
     #ifdef FOO
     void
     # if defined(_WIN32) && defined(SHARED_B)
    @@ -205,10 +163,8 @@ foo();
     int main() { foo(); }
     """)
     
    -t.write(
    -    "c.cpp",
    -"""
    -int 
    +t.write("c.cpp", """
    +int
     #if defined(_WIN32) && defined(SHARED_C)
     __declspec(dllexport)
     #endif
    @@ -218,119 +174,97 @@ must_export_something;
     t.run_build_system()
     t.run_build_system("--clean")
     
    -# Test correct handling of dependency features in 
    -# project requirements.
    -t.write(
    -    "Jamfile",
    -"""
    -    exe a : a.cpp lib1//cc ;
    +
    +# Test correct handling of dependency features in project requirements.
    +t.write("jamfile.jam", """
    +exe a : a.cpp lib1//cc ;
     """)
     
    -t.write(
    -    "lib1/Jamfile",
    -"""
    -    project
    +t.write("lib1/jamfile.jam", """
    +project
         : requirements shared:SHARED_C
    -    : usage-requirements ../lib2//b shared:SHARED_C
    -    ;
    -    
    -    lib cc : c.cpp ;    
    +    : usage-requirements ../lib2//b shared:SHARED_C ;
    +lib cc : c.cpp ;
     """)
     
    -t.write(
    -    "lib1/c.cpp", 
    -"""
    -int 
    +t.write("lib1/c.cpp", """
    +int
     #if defined(_WIN32) && defined(SHARED_C)
     __declspec(dllexport)
     #endif
     must_export_something;
     """)
     
    -t.write(
    -    "lib2/Jamfile", 
    -"""
    -    lib b : b.cpp : shared:SHARED_B
    -    : : FOO shared:SHARED_B ;
    +t.write("lib2/jamfile.jam", """
    +lib b : b.cpp : shared:SHARED_B : : FOO
    +    shared:SHARED_B ;
     """)
     
     t.copy("b.cpp", "lib2/b.cpp")
     
     t.run_build_system()
     
    -# Test that dependency feature in use requirements are built
    -# with the correct properties
    +
    +# Test that dependency feature in use requirements are built with the correct
    +# properties.
     t.rm(".")
     
    -t.write(
    -    "Jamfile", 
    -""" 
    -lib main : main.cpp : libs//lib1 : : libs//lib1 ; 
    +t.write("jamfile.jam", """
    +lib main : main.cpp : libs//lib1 : : libs//lib1 ;
     exe hello : hello.cpp main : ;
     """)
     
    -t.write(
    -    "main.cpp", 
    -""" 
    +t.write("main.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_LIB1)
     __declspec(dllimport)
     #endif
     foo();
     
    -int main() { foo(); return 0; } 
    +int main() { foo(); }
     """)
     
     t.write("hello.cpp", "\n")
     
    -t.write(
    -    "project-root.jam",
    -""" 
    -import gcc ; 
    +t.write("jamroot.jam", """
    +import gcc ;
     """)
     
    -t.write(
    -    "libs/a.cpp", 
    -""" 
    +t.write("libs/a.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_LIB1)
     __declspec(dllexport)
     #endif
    -foo() {} 
    +foo() {}
     """)
     
    -# This library should be build with the same properties as
    -# 'main'. There were a bug when they were generated with 
    -# empty properties, and there were ambiguity between variants.
    -t.write(
    -    "libs/Jamfile", 
    -""" 
    -lib lib1 : a_d.cpp : debug shared:SHARED_LIB1
    -: : shared:SHARED_LIB1 ;
     
    -lib lib1 : a.cpp : release shared:SHARED_LIB1
    -: : shared:SHARED_LIB1 ; 
    +# This library should be build with the same properties as 'main'. This is a
    +# regression test for a bug when they were generated with empty properties, and
    +# there were ambiguity between variants.
    +t.write("libs/jamfile.jam", """
    +lib lib1 : a_d.cpp : debug shared:SHARED_LIB1 : :
    +    shared:SHARED_LIB1 ;
    +lib lib1 : a.cpp : release shared:SHARED_LIB1 : :
    +    shared:SHARED_LIB1 ;
     """)
     
    -t.write(
    -    "libs/a_d.cpp", 
    -""" 
    +t.write("libs/a_d.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_LIB1)
     __declspec(dllexport)
     #endif
    -foo() {} 
    +foo() {}
     """)
     
     t.run_build_system("link=static")
     t.expect_addition("libs/bin/$toolset/debug/link-static/a_d.obj")
     
     
    -# Test that indirect conditionals are respected in
    -# usage requirements.
    +# Test that indirect conditionals are respected in usage requirements.
     t.rm(".")
     
    -t.write("Jamroot", """
    +t.write("jamroot.jam", """
     rule has-foo ( properties * )
     {
         return HAS_FOO ;
    @@ -339,12 +273,14 @@ rule has-foo ( properties * )
     exe a : a.cpp b ;
     lib b : b.cpp : static : : @has-foo ;
     """)
    +
     t.write("a.cpp", """
     #ifdef HAS_FOO
     void foo();
     int main() { foo(); }
     #endif
     """)
    +
     t.write("b.cpp", """
     void
     #if defined(_WIN32) && defined(SHARED_B)
    @@ -352,8 +288,8 @@ __declspec(dllexport)
     #endif
     foo() {}\n
     """)
    +
     t.run_build_system()
     t.expect_addition("bin/$toolset/debug/a.exe")
     
    -
     t.cleanup()
    diff --git a/test/using.py b/test/using.py
    index f616d4494..4e47f5f7f 100644
    --- a/test/using.py
    +++ b/test/using.py
    @@ -1,43 +1,33 @@
     #!/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)
    +# 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)
     
    -from BoostBuild import Tester, List
    -import string
    +import BoostBuild
     
    -t = Tester()
    -
    -t.write("sub/a.cpp", """ 
    -int main() { return 0; }
    +t = BoostBuild.Tester()
     
    +t.write("sub/a.cpp", """
    +int main() {}
     """)
     
    -t.write("Jamroot", """ 
    +t.write("jamroot.jam", """
     using some_tool ;
     """)
     
    -t.write("some_tool.jam", """ 
    +t.write("some_tool.jam", """
     import project ;
     project.initialize $(__name__) ;
    -
    -rule init ( )
    -{
    -}
    -
    +rule init ( ) { }
     """)
     
    -t.write("sub/Jamfile", """ 
    -exe a : a.cpp ; 
    +t.write("sub/jamfile.jam", """
    +exe a : a.cpp ;
     """)
     
    -
    -
     t.run_build_system(subdir="sub")
    -
     t.expect_addition("sub/bin/$toolset/debug/a.exe")
     
     t.cleanup()
    -
    diff --git a/test/v1-testing/Jamfile b/test/v1-testing/jamfile.jam
    similarity index 100%
    rename from test/v1-testing/Jamfile
    rename to test/v1-testing/jamfile.jam
    diff --git a/test/v1_testing.py b/test/v1_testing.py
    index b1de60fb1..524775fac 100644
    --- a/test/v1_testing.py
    +++ b/test/v1_testing.py
    @@ -1,11 +1,11 @@
     #!/usr/bin/python
     
    -# Copyright 2002 Dave Abrahams 
    -# Copyright 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) 
    +# Copyright 2002 Dave Abrahams
    +# Copyright 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)
     
    -from BoostBuild import Tester, List
    +import BoostBuild
     import os
     from string import strip
     import re
    @@ -14,7 +14,7 @@ import time
     def match_re(actual,expected):
         return re.match(expected,actual,re.DOTALL) != None
     
    -t = Tester(match = match_re, boost_build_path = os.path.join(os.getcwd(), ".."))
    +t = BoostBuild.Tester(match = match_re, boost_build_path = os.path.join(os.getcwd(), ".."))
     t.set_tree('v1_testing')
     
     os.environ['TOOLS'] = 'gcc'
    @@ -59,11 +59,11 @@ t.expect_addition(
          # function, but we actually need to spell out a lot more than
          # what we currently have to do that.
     
    -# 4) Introduced error into one of the library files, causing a library build 
    -# compile to fail. path_test.test was deleted, so the reporting programs 
    -# would know that failure occurred. Excellent! This is the case that has 
    -# caused regression testing to report the wrong results in the past, so it 
    -# was good news to see it working correctly now. We probably should figure 
    +# 4) Introduced error into one of the library files, causing a library build
    +# compile to fail. path_test.test was deleted, so the reporting programs
    +# would know that failure occurred. Excellent! This is the case that has
    +# caused regression testing to report the wrong results in the past, so it
    +# was good news to see it working correctly now. We probably should figure
     # out some other test cases just to be sure it is working for full coverage.
     t.rename('lib.cpp', 'lib.cpp.bak')
     t.rename('lib-err.cpp', 'lib.cpp')
    @@ -74,9 +74,9 @@ t.expect_removal(
          , 'bin/nolink.test/gcc/debug/runtime-link-dynamic/nolink.test'
          , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test'])
     
    -# 5) Fixed the error in the library file.  The library build then worked, and 
    -# path_test.exe was relinked, without first recompiling path_test.obj. Test 
    -# was rerun. Exactly right behavior!
    +# 5) Fixed the error in the library file.  The library build then worked, and
    +# path_test.exe was relinked, without first recompiling path_test.obj. Test was
    +# rerun. Exactly the right behavior!
     t.rename('lib.cpp.bak', 'lib.cpp')
     t.run_build_system(arguments = 'test', status = 0)
     t.expect_addition(
    @@ -85,4 +85,4 @@ t.expect_addition(
          , 'bin/run.test/gcc/debug/runtime-link-dynamic/run.test'])
     
     t.cleanup()
    -print 'tesing complete'
    +print 'testing complete'
    diff --git a/test/v1_testing/Jamfile b/test/v1_testing/jamfile.jam
    similarity index 100%
    rename from test/v1_testing/Jamfile
    rename to test/v1_testing/jamfile.jam
    diff --git a/test/v1_testing/project-root.jam b/test/v1_testing/jamroot.jam
    similarity index 100%
    rename from test/v1_testing/project-root.jam
    rename to test/v1_testing/jamroot.jam
    diff --git a/test/wrapper.py b/test/wrapper.py
    index 74e8516f0..676892fa9 100644
    --- a/test/wrapper.py
    +++ b/test/wrapper.py
    @@ -1,46 +1,38 @@
     #!/usr/bin/python
     
    -# Copyright 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) 
    +# Copyright 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 the user can define his own rule that will call builtin main
    -#  target rule and that this will work.
    +# Test that the user can define his own rule that will call built-in main target
    +# rule and that this will work.
     
    -from BoostBuild import Tester, List
    -
    -t = Tester()
    -
    -t.write("Jamfile", """ my-test : test.cpp ;
    +import BoostBuild
     
     
    +t = BoostBuild.Tester()
    +
    +t.write("jamfile.jam", """
    +my-test : test.cpp ;
     """)
     
    -t.write("test.cpp", """ 
    -int main()
    -{
    -    return 0;
    -}
    -
    +t.write("test.cpp", """
    +int main() {}
     """)
     
    -t.write("project-root.jam", """ using testing ;
    +t.write("jamroot.jam", """
    +using testing ;
     
     rule my-test ( name ? : sources + )
     {
    -    {
    -        name ?= test ;
    -        unit-test $(name) : $(sources) ; # /site-config//cppunit /util//testMain ;
    -    }   
    +    name ?= test ;
    +    unit-test $(name) : $(sources) ;  # /site-config//cppunit /util//testMain ;
     }
     
     IMPORT $(__name__) : my-test : : my-test ;
    -
    -
     """)
     
     t.run_build_system()
     t.expect_addition("bin/$toolset/debug/test.passed")
     
     t.cleanup()
    -
    diff --git a/test/wrong_project.py b/test/wrong_project.py
    index ef1ecc987..58d00d02e 100644
    --- a/test/wrong_project.py
    +++ b/test/wrong_project.py
    @@ -5,39 +5,28 @@
     # (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.
    +# 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
    +import BoostBuild
     
    +t = BoostBuild.Tester()
     
    -t = Tester()
    -# Remove temporary directories
    +t.write("a.cpp", "int main() {}\n")
     
    -t.write("a.cpp", """ 
    -int main() { return 0; }
    -
    -""")
    -
    -t.write("Jamroot", """ 
    +t.write("jamroot.jam", """
     using some_tool ;
    -exe a : a.cpp ; 
    +exe a : a.cpp ;
     """)
     
    -t.write("some_tool.jam", """ 
    +t.write("some_tool.jam", """
     import project ;
     project.initialize $(__name__) ;
    -
    -rule init ( )
    -{
    -}
    -
    +rule init ( ) { }
     """)
     
     t.run_build_system()
     t.expect_addition("bin/$toolset/debug/a.exe")
     
     t.cleanup()
    -
    diff --git a/website/index.html b/website/index.html
    index 3686d29f5..160949ce2 100644
    --- a/website/index.html
    +++ b/website/index.html
    @@ -67,7 +67,7 @@ div.sidebar p.rubric {
     		
     		 -->
               
    -	
  • Bug tracker +
  • Bug tracker