diff --git a/v2/test/assert-equal.jam b/v2/test/assert-equal.jam deleted file mode 100644 index 6ed501e74..000000000 --- a/v2/test/assert-equal.jam +++ /dev/null @@ -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) ")" - ; - - } -} diff --git a/v2/test/check-arguments.jam b/v2/test/check-arguments.jam deleted file mode 100644 index 20e025074..000000000 --- a/v2/test/check-arguments.jam +++ /dev/null @@ -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" ; - - diff --git a/v2/test/check-jam-patches.jam b/v2/test/check-jam-patches.jam deleted file mode 100644 index 7e00bec20..000000000 --- a/v2/test/check-jam-patches.jam +++ /dev/null @@ -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 ; -} diff --git a/v2/test/check-test-tools.jam b/v2/test/check-test-tools.jam deleted file mode 100644 index adf78cc3b..000000000 --- a/v2/test/check-test-tools.jam +++ /dev/null @@ -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 ; diff --git a/v2/test/core_arguments.py b/v2/test/core_arguments.py new file mode 100755 index 000000000..5a1bc9b65 --- /dev/null +++ b/v2/test/core_arguments.py @@ -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() diff --git a/v2/test/check-bindrule.jam b/v2/test/core_bindrule.py old mode 100644 new mode 100755 similarity index 60% rename from v2/test/check-bindrule.jam rename to v2/test/core_bindrule.py index f8eb986e3..d5aaa7fc5 --- a/v2/test/check-bindrule.jam +++ b/v2/test/core_bindrule.py @@ -1,8 +1,18 @@ +#!/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) -# This rule establishes a dependency, with no special build actions +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) ; @@ -27,3 +37,11 @@ rule bind-rule ( target : 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() diff --git a/v2/test/core_import_module.py b/v2/test/core_import_module.py index fab209e4c..2ab594241 100644 --- a/v2/test/core_import_module.py +++ b/v2/test/core_import_module.py @@ -15,6 +15,11 @@ module a { ECHO R1 ; } + + local rule l1 ( ) + { + ECHO A.L1 ; + } } module a2 { @@ -25,6 +30,11 @@ module a2 } IMPORT a2 : r2 : : a2.r2 ; +rule a.l1 ( ) +{ + ECHO L1 ; +} + module b { IMPORT_MODULE a : b ; @@ -34,6 +44,11 @@ module b 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 @@ do-nothing all ; t.run_build_system("-fcode", stdout="""R1 R2 +L1 +A.L1 CTEST """) diff --git a/v2/test/core_language.jam b/v2/test/core_language.jam index ae574c6c2..5bd43d8b4 100644 --- a/v2/test/core_language.jam +++ b/v2/test/core_language.jam @@ -168,7 +168,7 @@ check-equal var-subscript-range-empty : $(v3[4-3]) : ; } -# Check rule arguments +# Check rules { @@ -204,6 +204,40 @@ check-equal rule-arguments-named : [ 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-equal local-duplicate-restore : $(v1) : a b c ; # 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 @@ check-equal while-result : [ test-rule ] : x ; } +# +# 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 @@ check-equal command : "" 0 : [ COMMAND $(c) : no-output : exit-status ] ; } +# 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 diff --git a/v2/test/test_nt_line_length.jam b/v2/test/core_nt_line_length.py old mode 100644 new mode 100755 similarity index 78% rename from v2/test/test_nt_line_length.jam rename to v2/test/core_nt_line_length.py index bc003964e..809c5e1ec --- a/v2/test/test_nt_line_length.jam +++ b/v2/test/core_nt_line_length.py @@ -1,11 +1,16 @@ +#!/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) -# 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 "%". +import BoostBuild +import os + +t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) + +t.write("file.jam", """ if $(NT) { # @@ -37,3 +42,11 @@ if $(NT) do_echo line_length_test ; } +else +{ + NOCARE all ; +} +""") +t.run_build_system("-ffile.jam") + +t.cleanup() diff --git a/v2/test/echo_args.jam b/v2/test/echo_args.jam deleted file mode 100644 index 0f6956e46..000000000 --- a/v2/test/echo_args.jam +++ /dev/null @@ -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]) ; -} - diff --git a/v2/test/jamfile.jam b/v2/test/jamfile.jam deleted file mode 100644 index 9d186f3c1..000000000 --- a/v2/test/jamfile.jam +++ /dev/null @@ -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 ; diff --git a/v2/test/recursive.jam b/v2/test/recursive.jam deleted file mode 100644 index 8087f7da7..000000000 --- a/v2/test/recursive.jam +++ /dev/null @@ -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 - } -} - diff --git a/v2/test/subdir1/file-to-bind b/v2/test/subdir1/file-to-bind deleted file mode 100644 index 7ff128fa6..000000000 --- a/v2/test/subdir1/file-to-bind +++ /dev/null @@ -1 +0,0 @@ -# This file intentionally left blank \ No newline at end of file diff --git a/v2/test/test_all.py b/v2/test/test_all.py index 4375d275f..9c3dd235f 100644 --- a/v2/test/test_all.py +++ b/v2/test/test_all.py @@ -121,7 +121,7 @@ def reorder_tests(tests, first_test): 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 @@ tests = [ "absolute_sources", "copy_time", "core_action_status", "core_actions_quietly", + "core_bindrule", + "core_nt_line_length", "core_option_d2", "core_option_l", "core_option_n",