Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75835 - in trunk/tools/build/v2/test: . subdir1
From: steven_at_[hidden]
Date: 2011-12-07 00:05:05


Author: steven_watanabe
Date: 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
New Revision: 75835
URL: http://svn.boost.org/trac/boost/changeset/75835

Log:
Integrate everything useful from check-jam-patches into the Python test system.
Added:
   trunk/tools/build/v2/test/core_arguments.py (contents, props changed)
   trunk/tools/build/v2/test/core_bindrule.py (contents, props changed)
   trunk/tools/build/v2/test/core_nt_line_length.py (contents, props changed)
Removed:
   trunk/tools/build/v2/test/assert-equal.jam
   trunk/tools/build/v2/test/check-arguments.jam
   trunk/tools/build/v2/test/check-bindrule.jam
   trunk/tools/build/v2/test/check-jam-patches.jam
   trunk/tools/build/v2/test/check-test-tools.jam
   trunk/tools/build/v2/test/echo_args.jam
   trunk/tools/build/v2/test/jamfile.jam
   trunk/tools/build/v2/test/recursive.jam
   trunk/tools/build/v2/test/subdir1/
   trunk/tools/build/v2/test/test_nt_line_length.jam
Text files modified:
   trunk/tools/build/v2/test/core_import_module.py | 17 +++++
   trunk/tools/build/v2/test/core_language.jam | 118 ++++++++++++++++++++++++++++++++++++++-
   trunk/tools/build/v2/test/test_all.py | 4 +
   3 files changed, 135 insertions(+), 4 deletions(-)

Deleted: trunk/tools/build/v2/test/assert-equal.jam
==============================================================================
--- trunk/tools/build/v2/test/assert-equal.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,33 +0,0 @@
-# Copyright 2001 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)
-
-# Evaluates [ rulename arg1... : arg2... : ... : argN... ] and compares the
-# result to expected-results. If there is a mismatch, prints an error message
-# and exits.
-rule assert-equal ( expected-results *
- : rulename a1 * : a2 * : a3 * : a4 * : a5 * : a6 * : a7 * : a8 * : a9 * )
-{
-
- local results = [ $(rulename) $(a1) : $(a2) : $(a3)
- : $(a4) : $(a5) : $(a6) : $(a7) : $(a8) ] ;
-
- if $(results) != $(expected-results)
- {
- EXIT ******ASSERTION FAILURE******* "
- [ $(rulename) " $(a1)
- ": "$(a2[1]) $(a2[2-])
- ": "$(a3[1]) $(a3[2-])
- ": "$(a4[1]) $(a4[2-])
- ": "$(a5[1]) $(a5[2-])
- ": "$(a6[1]) $(a6[2-])
- ": "$(a7[1]) $(a7[2-])
- ": "$(a8[1]) $(a8[2-]) "]
-expected:
- (" $(expected-results) ")
-result was:
- (" $(results) ")"
- ;
-
- }
-}

Deleted: trunk/tools/build/v2/test/check-arguments.jam
==============================================================================
--- trunk/tools/build/v2/test/check-arguments.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,71 +0,0 @@
-# Copyright 2001 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)
-
-#
-# Jam code for testing the named-argument patch.
-#
-
-include recursive.jam ;
-
-# Prefixes for all of the jam code we're going to test
-local ECHO_ARGS = "include echo_args.jam ; echo_args "
- ;
-
-local ECHO_VARARGS = "include echo_args.jam ; echo_varargs "
- ;
-
-# Check that it will find missing arguments
-Jam-fail $(ECHO_ARGS)";"
- : "missing argument a"
- ;
-
-# Check that it will find if too many arguments are passed
-Jam-fail $(ECHO_ARGS)"1 2 : 3 : 4 : 5 ;"
- : "extra argument 5"
- ;
-
-# Check that it will find when an argument has too many elements
-Jam-fail $(ECHO_ARGS)"a b c1 c2 : d ;"
- : "extra argument c2"
- ;
-
-# Check modifier '?'
-Jam $(ECHO_ARGS)"1 2 3 : 4 ;"
- : "a= 1 b= 2 c= 3 : d= 4 : e=" ;
-Jam $(ECHO_ARGS)"1 2 : 3 ;"
- : "a= 1 b= 2 c= : d= 3 : e=" ;
-Jam $(ECHO_ARGS)"1 : 2 ;"
- : "a= 1 b= c= : d= 2 : e=" ;
-
-# Check modifier '+'
-Jam-fail $(ECHO_ARGS)"1 ;"
- : "missing argument d" ;
-Jam $(ECHO_ARGS)"1 : 2 3 ;"
- : "a= 1 b= c= : d= 2 3 : e=" ;
-Jam $(ECHO_ARGS)"1 : 2 3 4 ;"
- : "a= 1 b= c= : d= 2 3 4 : e=" ;
-
-# Check modifier '*'
-Jam $(ECHO_ARGS)"1 : 2 : 3 ;"
- : "a= 1 b= c= : d= 2 : e= 3" ;
-Jam $(ECHO_ARGS)"1 : 2 : 3 4 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4" ;
-Jam $(ECHO_ARGS)"1 : 2 : 3 4 5 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5" ;
-
-#
-# Check varargs
-#
-Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5" ;
-Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6" ;
-Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7" ;
-Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 : 8 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8" ;
-Jam $(ECHO_VARARGS)"1 : 2 : 3 4 5 : 6 7 : 8 : 9 ;"
- : "a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8 : 9" ;
-
-

Deleted: trunk/tools/build/v2/test/check-bindrule.jam
==============================================================================
--- trunk/tools/build/v2/test/check-bindrule.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,29 +0,0 @@
-# Copyright 2001 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 rule establishes a dependency, with no special build actions
-rule do-nothing ( target : source )
-{
- DEPENDS $(target) : $(source) ;
-}
-actions quietly do-nothing
-{
-}
-
-# Make a non-file target which depends on a file that exists
-NOTFILE fake-target ;
-SEARCH on file-to-bind = subdir1 ;
-
-do-nothing fake-target
- : file-to-bind ;
-
-# Set jam up to call our bind-rule
-BINDRULE = bind-rule ;
-
-rule bind-rule ( target : path )
-{
- ECHO found: $(target) at $(path) ;
-}
-
-DEPENDS all : fake-target ;

Deleted: trunk/tools/build/v2/test/check-jam-patches.jam
==============================================================================
--- trunk/tools/build/v2/test/check-jam-patches.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,293 +0,0 @@
-# Copyright 2001, 2002 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)
-
-# Get the recursive Jam invocation code
-include recursive.jam ;
-include assert-equal.jam ;
-
-Jam "include check-bindrule.jam ;"
- : "found: file-to-bind at subdir1$(SLASH)file-to-bind"
- ;
-
-include check-arguments.jam ;
-
-if $(NT)
-{
- # if this one fails, you don't have the line length patch
- Jam "include test_nt_line_length.jam ;" ;
-}
-
-# a little utility for assertions
-rule identity ( list * )
-{
- return $(list) ;
-}
-
-#
-# test rule indirection
-#
-rule select ( n list * )
-{
- return $(list[$(n)]) ;
-}
-
-rule indirect1 ( rule + : args * )
-{
- return [ $(rule) $(args) ] ;
-}
-
-assert-equal a : indirect1 select 1 : a b c d e ;
-assert-equal b : indirect1 select 2 : a b c d e ;
-
-x = reset ;
-rule reset-x ( new-value )
-{
- x = $(new-value) ;
-}
-$(x)-x bar ; # invokes reset-x...
-assert-equal bar : identity $(x) ; # which changes x
-
-# Check that unmatched subst returns an empty list
-assert-equal # nothing
- : SUBST "abc" "d+" x ;
-
-# Check that a matched subst works
-assert-equal x
- : SUBST "ddd" "d+" x ;
-
-# Check that we can get multiple substitutions from a single invocation
-assert-equal x y x-y
- : SUBST "x/y/z" "([^/]*)/([^/]*).*" "\\1" $2 "\\1-\\2" ;
-
-#
-# test local foreach modification
-#
-{
- local x = 0 ;
- local entered = ;
- for local x in a b c # x declared local to for loop.
- {
- entered = 1 ;
- if ! ( $(x) in a b c )
- {
- EXIT "local foreach: expected one of a, b, c; got" $(x) ;
- }
- }
-
- if $(x) != 0 # if x was modified, it failed to be a local variable
- {
- EXIT "local foreach failed" ;
- }
-}
-
-#
-# test while loops
-#
-{
- local x = a b c ;
- local y = $(x) ;
- local z = ;
-
- while $(y)
- {
- z += $(y[1]) ;
- y = $(y[2-]) ;
- }
-
- if $(z) != $(x)
- {
- EXIT "while loops failed" ;
- }
-}
-
-#
-# test negative list indices and slices
-#
-{
- local x = a b c d e ;
-
- rule assert-index ( index : list * )
- {
- if $(x[$(index)]) != $(list)
- {
- ECHO with x= $(x) ;
- ECHO x[$(index)] == $(x[$(index)]) ;
- EXIT expected $(list) ;
- }
- }
-
- assert-index 1 : a ;
- assert-index 3 : c ;
- assert-index 1-2 : a b ;
- assert-index -1 : e ;
- assert-index -2 : d ;
- assert-index 2--2 : b c d ;
- assert-index -3--2 : c d ;
- assert-index 1--2 : a b c d ;
- assert-index 1--2 : a b c d ;
- assert-index 1--10 : ;
- x = a ;
- assert-index 1--2 : ;
- assert-index 1--2 : ;
-}
-
-#
-# test module primitives
-#
-{
- local x = a b c d e f g h i j ;
- local y = $(x[3-]) ;
-
- rule shift1 ( dummy ) { }
-
- rule my_module.not_really ( ) { return something ; }
-
- # import the identity rule into my_module as "id"
- IMPORT : identity : my_module : id ;
- module my_module
- {
- # assert-equal operates in its own module, so call id in here and use
- # identity later.
- local f = [ id x y z ] ;
- assert-equal x y z : identity $(f) ;
-
- w = ;
- y = ;
- x2 = 1 2 3 ;
- x3 = $(x2) ;
- z = $(x2) ;
-
- x3 = ; # should reset x3
-
- # drops one element from the head of x
- # moves the first element of z from the head of z to the head of y
- rule shift1 ( )
- {
- x = $(x[2-]) ;
- y = $(z[1]) $(y) ;
- z = $(z[2-]) ;
- }
-
- rule shift2 ( )
- {
- shift1 ;
- }
-
- shift1 ;
- shift2 ;
-
- rule get ( symbol )
- {
- return $($(symbol)) ;
- }
- local rule not_really ( ) { return nothing ; }
- }
-
- local expected = shift1 shift2 get ;
- if ! ( $(expected) in [ RULENAMES my_module ] )
- || ! ( [ RULENAMES my_module ] in $(expected) )
- {
- EXIT "[ RULENAMES my_module ] =" [ RULENAMES my_module ] "!=" shift1 shift2 get ;
- }
-
-
- # show that not_really was actually a local definition
- assert-equal something : my_module.not_really ;
-
- if not_really in [ RULENAMES my_module ]
- {
- EXIT unexpectedly found local rule "not_really" in "my_module" ;
- }
- EXPORT my_module : not_really ;
-
- if ! ( not_really in [ RULENAMES my_module ] )
- {
- EXIT unexpectedly failed to find exported rule "not_really" in "my_module" ;
- }
-
- # show that my_module doesn't have access to our variables
- my_module.shift1 ;
- assert-equal $(x[3-]) : identity $(y) ;
-
- # check module locals
- assert-equal : my_module.get w ;
- assert-equal 3 2 1 : my_module.get y ;
- assert-equal 1 2 3 : my_module.get x2 ;
- assert-equal : my_module.get x3 ;
- assert-equal : my_module.get z ;
-
- my_module.shift2 ;
- x = $(x[3-]) ;
- assert-equal $(x) : identity $(y) ;
-
- # Prove that the module's rule is not exposed to the world at large without
- # qualification
- shift1 nothing ;
- assert-equal $(x) : identity $(y) ;
-
- # import my_module.shift1 into the global module as "shifty", and
- # my_module.shift2 into the global module as "shift2".
- IMPORT my_module : shift1 shift2 : : shifty shift2 ;
-
- shifty ;
- assert-equal $(x) : identity $(y) ;
-
- shift2 ;
- assert-equal $(x) : identity $(y) ;
-
- # Now do the same with localization
- IMPORT my_module : shift1 : : shifty : LOCALIZE ;
-
- shifty ;
- y = $(y[3-]) ;
- assert-equal $(x) : identity $(y) ;
-
- # import everything from my_module into the global module using
- # the same names.
- IMPORT my_module : [ RULENAMES my_module ] : : [ RULENAMES my_module ] : LOCALIZE ;
-
- shift1 ;
- y = $(y[2-]) ;
- assert-equal $(x) : identity $(y) ;
-
- shift2 ;
- y = $(y[2-]) ;
- assert-equal $(x) : identity $(y) ;
-}
-
-#
-# test CALLER_MODULE and backtrace
-#
-{
- rule backtrace ( )
- {
- local bt = [ BACKTRACE ] ;
- bt = $(bt[5-]) ;
- while $(bt)
- {
- ECHO $(bt[1]):$(bt[2]): "in" $(bt[4]) ;
- bt = $(bt[5-]) ;
- }
- }
- module module1
- {
- rule f ( )
- {
- local m = [ CALLER_MODULE ] ;
- assert-equal : identity $(m) ;
- module2.f ;
- }
-
- }
- module module2
- {
- rule f ( )
- {
- local m = [ CALLER_MODULE ] ;
- assert-equal module1 : identity $(m) ;
- backtrace ;
- }
- }
- module1.f ;
-}

Deleted: trunk/tools/build/v2/test/check-test-tools.jam
==============================================================================
--- trunk/tools/build/v2/test/check-test-tools.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,26 +0,0 @@
-# Copyright 2001 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)
-
-include recursive.jam ;
-include assert-equal.jam ;
-
-#####################################
-# Test the testing tools right here #
-#####################################
-
-# This command always exits with a failure.
-Jam-fail "EXIT error ;" ;
-
-# This should fail to fail
-Jam-fail
- "include recursive.jam ; Jam-fail \"# this innocuous Jamfile should fail to fail\" ;"
- ;
-
-# the ECHO rule always has an empty result.
-Jam-fail "include assert-equal.jam ; assert-equal fubar : ECHO checking that assertions fail ;"
- : "ASSERTION FAILURE"
- ;
-
-local NOTHING = ;
-assert-equal $(NOTHING) : ECHO checking that assertions succeed ;

Added: trunk/tools/build/v2/test/core_arguments.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/core_arguments.py 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -0,0 +1,109 @@
+#!/usr/bin/python
+
+# Copyright 2001 Dave Abrahams
+# Copyright 2011 Steven Watanabe
+# 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
+import os
+
+t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
+
+t.write("echo_args.jam", """
+rule echo_args ( a b ? c ? : d + : e * )
+{
+ ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e) ;
+}
+
+rule echo_varargs ( a b ? c ? : d + : e * : * )
+{
+ ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e)
+ ": rest= "$(4[1]) $(4[2])
+ ": "$(5[1]) $(5[2])
+ ": "$(6[1]) $(6[2])
+ ": "$(7[1]) $(7[2])
+ ": "$(8[1]) $(8[2])
+ ": "$(9[1]) $(9[2]) ;
+}
+""")
+
+t.write("file.jam", "include echo_args.jam ; echo_args ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("* missing argument a");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 2 : 3 : 4 : 5 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("* extra argument 5");
+
+t.write("file.jam", "include echo_args.jam ; echo_args a b c1 c2 : d ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("* extra argument c2");
+
+# Check modifier '?'
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 2 3 : 4 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= 2 c= 3 : d= 4 : e=");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 2 : 3 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= 2 c= : d= 3 : e=");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e=");
+
+# Check modifier '+'
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("* missing argument d");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 3 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 3 : e=");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 3 4 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 3 4 : e=");
+
+# Check modifier '*'
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 4 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4");
+
+t.write("file.jam", "include echo_args.jam ; echo_args 1 : 2 : 3 4 5 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5");
+
+#
+# Check varargs
+#
+
+t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5");
+
+t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6");
+
+t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7");
+
+t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 : 8 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8");
+
+t.write("file.jam", "include echo_args.jam ; echo_varargs 1 : 2 : 3 4 5 : 6 7 : 8 : 9 ;")
+t.run_build_system("-ffile.jam", status=1)
+t.expect_output_line("a= 1 b= c= : d= 2 : e= 3 4 5 : rest= 6 7 : 8 : 9");
+
+t.cleanup()

Added: trunk/tools/build/v2/test/core_bindrule.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/core_bindrule.py 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+# Copyright 2001 Dave Abrahams
+# Copyright 2011 Steven Watanabe
+# 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
+import os
+
+t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
+
+t.write("subdir1/file-to-bind", "# This file intentionally left blank")
+
+t.write("file.jam", """
+rule do-nothing ( target : source )
+{
+ DEPENDS $(target) : $(source) ;
+}
+actions quietly do-nothing
+{
+}
+
+# Make a non-file target which depends on a file that exists
+NOTFILE fake-target ;
+SEARCH on file-to-bind = subdir1 ;
+
+do-nothing fake-target
+ : file-to-bind ;
+
+# Set jam up to call our bind-rule
+BINDRULE = bind-rule ;
+
+rule bind-rule ( target : path )
+{
+ ECHO found: $(target) at $(path) ;
+}
+
+DEPENDS all : fake-target ;
+""")
+
+t.run_build_system("-ffile.jam", stdout="""found: all at all
+found: file-to-bind at subdir1%sfile-to-bind
+...found 3 targets...
+""" % os.sep)
+
+t.cleanup()

Modified: trunk/tools/build/v2/test/core_import_module.py
==============================================================================
--- trunk/tools/build/v2/test/core_import_module.py (original)
+++ trunk/tools/build/v2/test/core_import_module.py 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -15,6 +15,11 @@
     {
         ECHO R1 ;
     }
+
+ local rule l1 ( )
+ {
+ ECHO A.L1 ;
+ }
 }
 module a2
 {
@@ -25,6 +30,11 @@
 }
 IMPORT a2 : r2 : : a2.r2 ;
 
+rule a.l1 ( )
+{
+ ECHO L1 ;
+}
+
 module b
 {
     IMPORT_MODULE a : b ;
@@ -34,6 +44,11 @@
         a.r1 ;
         # Call rule in global scope
         a2.r2 ;
+ # Call rule in global scope. Doesn't find local rule
+ a.l1 ;
+ # Make l1 visible
+ EXPORT a : l1 ;
+ a.l1 ;
     }
 }
 
@@ -57,6 +72,8 @@
 
 t.run_build_system("-fcode", stdout="""R1
 R2
+L1
+A.L1
 CTEST
 """)
 

Modified: trunk/tools/build/v2/test/core_language.jam
==============================================================================
--- trunk/tools/build/v2/test/core_language.jam (original)
+++ trunk/tools/build/v2/test/core_language.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -168,7 +168,7 @@
 
 }
 
-# Check rule arguments
+# Check rules
 
 {
 
@@ -204,6 +204,40 @@
     [ test-rule a1 : a2 : a3 : a4 : a5 : a6 : a7 : a8 : a9 : a10 : a11 : a12 : a13 : a14 : a15 : a16 : a17 : a18 : a19 ] :
     a1 - a2 - a3 - a4 - a5 - a6 - a7 - a8 - a9 - a10 - a11 - a12 - a13 - a14 - a15 - a16 - a17 - a18 - a19 ;
 
+#
+# test rule indirection
+#
+rule select ( n list * )
+{
+ return $(list[$(n)]) ;
+}
+
+rule indirect1 ( rule + : args * )
+{
+ return [ $(rule) $(args) ] ;
+}
+
+check-equal rule-indirect-1 : [ indirect1 select 1 : a b c d e ] : a ;
+check-equal rule-indirect-2 : [ indirect1 select 2 : a b c d e ] : b ;
+
+x = reset ;
+rule reset-x ( new-value )
+{
+ x = $(new-value) ;
+}
+$(x)-x bar ; # invokes reset-x...
+check-equal rule-reset : $(x) : bar ; # which changes x
+
+rule bar-x ( new-value )
+{
+ mark-order r3 ;
+}
+
+# The arguments are evaluated in forward order
+# before the rule name
+$(x)-x [ mark-order r1 : [ reset-x reset ] ] : [ mark-order r2 ] ;
+check-order rule-order : r1 r2 ;
+
 }
 
 # Check append
@@ -599,8 +633,30 @@
 # Check module
 
 {
-#FIXME:
-# ...
+ local var1 = root-module-var ;
+ module my_module
+ {
+ var1 = module-var ;
+ rule get ( )
+ {
+ return $(var1) ;
+ }
+ local rule not_really ( ) { return nothing ; }
+ }
+
+ check-equal module-var-not-root : $(var1) : root-module-var ;
+
+ check-equal module-rulenames : [ RULENAMES my_module ] : get ;
+
+ IMPORT_MODULE my_module ;
+ check-equal module-rule-import-module : [ my_module.get ] : module-var ;
+
+ IMPORT my_module : get : : module-get ;
+ check-equal module-rule-imort : [ module-get ] : module-var ;
+
+ IMPORT my_module : get : : module-get : LOCALIZE ;
+ check-equal module-rule-imort-localize : [ module-get ] : root-module-var ;
+
 }
 
 # Check class
@@ -1046,6 +1102,47 @@
 
 }
 
+#
+# test CALLER_MODULE and backtrace
+#
+
+{
+ local base = [ BACKTRACE ] ;
+ base = $(base[2]) ;
+ rule backtrace ( )
+ {
+ local bt = [ BACKTRACE ] ;
+ check-equal backtrace-1-file : $(bt) :
+ core_language.jam [ CALC $(base) + 4 ] "" backtrace
+ core_language.jam [ CALC $(base) + 28 ] module2. f
+ core_language.jam [ CALC $(base) + 19 ] module1. f
+ core_language.jam [ CALC $(base) + 32 ] "" "module scope"
+ ;
+ }
+ module module1
+ {
+ IMPORT_MODULE module2 : module1 ;
+ rule f ( )
+ {
+ local m = [ CALLER_MODULE ] ;
+ check-equal caller-module-root : $(m) ;
+ module2.f ;
+ }
+ }
+ module module2
+ {
+ rule f ( )
+ {
+ local m = [ CALLER_MODULE ] ;
+ check-equal caller-module : module1 : $(m) ;
+ backtrace ;
+ }
+ }
+ IMPORT_MODULE module1 ;
+ module1.f ;
+}
+
+
 # Test NORMALIZE_PATH
 
 {
@@ -1144,6 +1241,21 @@
 
 }
 
+# Test SUBST
+
+{
+
+# Check that unmatched subst returns an empty list
+check-equal subst-nomatch : [ SUBST "abc" "d+" x ] : ;
+
+# Check that a matched subst works
+check-equal subst-match : [ SUBST "ddd" "d+" x ] : x ;
+
+# Check that we can get multiple substitutions from a single invocation
+check-equal subst-multiple : [ SUBST "x/y/z" "([^/]*)/([^/]*).*" "\\1" $2 "\\1-\\2" ] : x y x-y ;
+
+}
+
 # Test summary
 
 if $(failed) = 0

Added: trunk/tools/build/v2/test/core_nt_line_length.py
==============================================================================
--- (empty file)
+++ trunk/tools/build/v2/test/core_nt_line_length.py 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+# Copyright 2001 Dave Abrahams
+# Copyright 2011 Steven Watanabe
+# 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
+import os
+
+t = BoostBuild.Tester(pass_toolset=0, pass_d0=False)
+
+t.write("file.jam", """
+if $(NT)
+{
+ #
+ # Build a really long commandline. (> 10K characters).
+ #
+ ten = 0 1 2 3 4 5 6 7 8 9 ;
+ 1x7chars = 0_____ ;
+ # add a digit and multiply by 10
+ 10x8chars = $(ten)$(1x7chars) ;
+ # add a digit to each of 10 strings and multiply by 10
+ 100x9chars = $(ten)$(10x8chars) ;
+ # add a digit to each of 100 strings and multiply by 10
+ 1000x10chars = $(ten)$(100x9chars) ;
+
+ #
+ # Cause line_length_test to be built
+ #
+ actions do_echo
+ {
+ echo $(text)
+ }
+
+ 400x10chars = $(ten[1-4])$(100x9chars) ;
+
+ text on line_length_test = $(400x10chars) 40$(10x8chars[1-9]) 01234 ;
+ text on line_length_test = $(1000x10chars) $(1000x10chars) ;
+ JAMSHELL on line_length_test = % ;
+ DEPENDS all : line_length_test ;
+
+ do_echo line_length_test ;
+}
+else
+{
+ NOCARE all ;
+}
+""")
+t.run_build_system("-ffile.jam")
+
+t.cleanup()

Deleted: trunk/tools/build/v2/test/echo_args.jam
==============================================================================
--- trunk/tools/build/v2/test/echo_args.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,20 +0,0 @@
-# Copyright 2001 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)
-
-rule echo_args ( a b ? c ? : d + : e * )
-{
- ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e) ;
-}
-
-rule echo_varargs ( a b ? c ? : d + : e * : * )
-{
- ECHO a= $(a) b= $(b) c= $(c) ":" d= $(d) ":" e= $(e)
- ": rest= "$(4[1]) $(4[2])
- ": "$(5[1]) $(5[2])
- ": "$(6[1]) $(6[2])
- ": "$(7[1]) $(7[2])
- ": "$(8[1]) $(8[2])
- ": "$(9[1]) $(9[2]) ;
-}
-

Deleted: trunk/tools/build/v2/test/jamfile.jam
==============================================================================
--- trunk/tools/build/v2/test/jamfile.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,11 +0,0 @@
-# Copyright 2001 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)
-
-
-# establish a project root right here in the test directory, so that we can test
-# things independently of the boost jambase, etc.
-project-root ;
-
-include check-test-tools.jam ;
-include check-jam-patches.jam ;

Deleted: trunk/tools/build/v2/test/recursive.jam
==============================================================================
--- trunk/tools/build/v2/test/recursive.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,117 +0,0 @@
-# Copyright 2001, 2002 Dave Abrahams
-# Copyright 2005 Rene Rivera
-# 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)
-
-##############################################################
-# Rules and actions that test Jam by invoking it recursively #
-# #
-# This is necessary for testing anything that requires Jam #
-# to execute build actions whose results must be checked, #
-# and anything which exits Jam with a failure code (e.g. a #
-# failed assertion). #
-##############################################################
-
-# Creates a fake target, always built, which succeeds in building if Invoking a
-# Jamfile containing the given string succeeds. If optional-expected-output is
-# supplied, creates another fake target which succeeds in building if
-# optional-expected-output is in the Jam output.
-#
-# RETURNS: the target name of the Jam command.
-rule Jam ( command : expected-output ? )
-{
- local jam-cmd = "$(command:G=jam_command)" ;
-
- NOTFILE "$(jam-cmd)" ;
- ALWAYS "$(jam-cmd)" ;
- DEPENDS all : "$(jam-cmd)" ;
-
- if ($NT)
- {
- redirect on $(jam-cmd) = "nul" ;
- }
- else if $(UNIX)
- {
- redirect on $(jam-cmd) = "/dev/null" ;
- }
-
- if $(VERBOSE)
- {
- redirect on $(jam-cmd) = ;
- }
-
- invoke-Jam "$(jam-cmd)" ;
-
- if $(expected-output)
- {
- redirect on $(jam-cmd) = "scratch-output.txt" ;
- local output-target = "$(expected-output:G=$(command))" ;
- NOTFILE "$(output-target)" ;
- ALWAYS "$(output-target)" ;
- DEPENDS all : "$(output-target)" ;
- Expect-in-output "$(output-target)" ;
-
- if $(VERBOSE)
- {
- if $(NT) { VERBOSE on $(output-target) = "type " ; }
- else { VERBOSE on $(output-target) = "cat " ; }
- }
- }
- return $(jam-cmd) ;
-}
-
-# Just like the "Jam" rule, above, but only succeeds if the Jam command /fails/.
-rule Jam-fail ( command : expected-output ? )
-{
- local target = [ Jam $(command) : $(expected-output) ] ;
- FAIL_EXPECTED $(target) ;
- return $(target) ;
-}
-
-# The temporary jamfile we write is called "temp.jam". If the user has set
-# BOOST_BUILD_ROOT, it will be built there.
-gBOOST_TEST_JAMFILE = temp.jam ;
-LOCATE on gBOOST_TEST_JAMFILE ?= $(BOOST_BUILD_ROOT) ;
-
-# Runs Jam on a temporary Jamfile which contains the string in $(command:G=)
-# and redirects the results into a file whose name is given by $(redirect) on
-# command
-rule invoke-Jam ( command )
-{
- PREFIX on $(command) = "actions unbuilt { } unbuilt all ;" ;
- if $(NT)
- {
- REMOVE on $(command) = $(SystemRoot)\System32\find ;
- }
- REMOVE on $(command) ?= rm ;
-}
-actions invoke-Jam
-{
- echo $(PREFIX) $(<:G=) > $(gBOOST_TEST_JAMFILE)
- jam -sBOOST_ROOT=../../.. -sJAMFILE=$(gBOOST_TEST_JAMFILE) $(JAMARGS) >$(redirect)
-}
-# $(REMOVE) $(gBOOST_TEST_JAMFILE)
-
-
-# These actions expect to find the ungristed part of $(<) in scratch-output.txt
-# and return a nonzero exit code otherwise
-if $(NT)
-{
- # Explicitly get the NT find command in case someone has another find in their path.
- actions quietly Expect-in-output
- {
- $(VERBOSE)scratch-output.txt ;
- $(SystemRoot)\System32\find /C "$(<:G=)" scratch-output.txt >nul
- }
-}
-else
-{
- # Not really the right actions for Unix; the argument will be interpreted as
- # a regular expression. Is there a simpler find?
- actions quietly Expect-in-output
- {
- $(VERBOSE)scratch-output.txt;
- grep "$(<:G=)" scratch-output.txt
- }
-}
-

Modified: trunk/tools/build/v2/test/test_all.py
==============================================================================
--- trunk/tools/build/v2/test/test_all.py (original)
+++ trunk/tools/build/v2/test/test_all.py 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
@@ -121,7 +121,7 @@
 critical_tests = ["unit_tests", "module_actions", "startup_v1", "startup_v2"]
 
 critical_tests += ["core_d12", "core_typecheck", "core_delete_module",
- "core_language", "core_varnames", "core_import_module"]
+ "core_language", "core_arguments", "core_varnames", "core_import_module"]
 
 tests = [ "absolute_sources",
           "alias",
@@ -142,6 +142,8 @@
           "copy_time",
           "core_action_status",
           "core_actions_quietly",
+ "core_bindrule",
+ "core_nt_line_length",
           "core_option_d2",
           "core_option_l",
           "core_option_n",

Deleted: trunk/tools/build/v2/test/test_nt_line_length.jam
==============================================================================
--- trunk/tools/build/v2/test/test_nt_line_length.jam 2011-12-07 00:05:03 EST (Wed, 07 Dec 2011)
+++ (empty file)
@@ -1,39 +0,0 @@
-# Copyright 2001 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)
-
-# Test that the patch which allows long command-lines in actions on NT is
-# working. For reasons of backward-compatibility, this patch requires that the
-# action fits on a single command-line, and that the JAMSHELL variable on the
-# target being built is set to "%".
-if $(NT)
-{
- #
- # Build a really long commandline. (> 10K characters).
- #
- ten = 0 1 2 3 4 5 6 7 8 9 ;
- 1x7chars = 0_____ ;
- # add a digit and multiply by 10
- 10x8chars = $(ten)$(1x7chars) ;
- # add a digit to each of 10 strings and multiply by 10
- 100x9chars = $(ten)$(10x8chars) ;
- # add a digit to each of 100 strings and multiply by 10
- 1000x10chars = $(ten)$(100x9chars) ;
-
- #
- # Cause line_length_test to be built
- #
- actions do_echo
- {
- echo $(text)
- }
-
- 400x10chars = $(ten[1-4])$(100x9chars) ;
-
- text on line_length_test = $(400x10chars) 40$(10x8chars[1-9]) 01234 ;
- text on line_length_test = $(1000x10chars) $(1000x10chars) ;
- JAMSHELL on line_length_test = % ;
- DEPENDS all : line_length_test ;
-
- do_echo line_length_test ;
-}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk