2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00

Fixed a bug in Boost Build causing its module names to be displayed incorrectly when running Boost Build module tests for indirectly loaded modules. Minor stylistic changes.

[SVN r46235]
This commit is contained in:
Jurko Gospodnetić
2008-06-08 13:03:39 +00:00
parent 79318df0b3
commit 28cdc8e4b1

View File

@@ -25,7 +25,39 @@ local rule no-test-defined
import modules ;
if ! ( --quiet in [ modules.peek : ARGV ] )
{
ECHO warning: no __test__ rule defined in module $(__module__) ;
ECHO warning: no __test__ rule defined in module $(.module-under-test) ;
}
}
# Runs internal Boost Build unit tests for the specified module. The module's
# __test__ rule is executed in its own module to eliminate any inadvertent
# effects of testing module dependencies (such as assert) on the module itself.
#
local rule run_test ( m )
{
if ( ! $(m) in $(.tested) ) # Avoid recursive test invocations.
&& ( ( --debug in $(argv) ) || ( --debug-module=$(m) in $(argv) ) )
{
.tested += $(m) ;
if ! ( --quiet in $(argv) )
{
ECHO testing module $(m)... ;
}
local test-module = __test-$(m)__ ;
IMPORT $(m) : [ RULENAMES $(m) ] : $(test-module) : [ RULENAMES $(m) ] ;
IMPORT $(m) : __test__ : $(test-module) : __test__ : LOCALIZE ;
# Set up the name of the module we are testing so that no-test-defined
# can find it.
poke $(test-module) : .module-under-test : $(m) ;
module $(test-module)
{
__test__ ;
}
}
}
@@ -163,31 +195,7 @@ rule load (
local argv = [ peek : ARGV ] ;
for local m in $(.untested)
{
if ( ! $(m) in $(.tested) ) # Avoid recursive test invocations.
&& ( ( --debug in $(argv) ) || ( --debug-module=$(m) in $(argv) ) )
{
.tested += $(m) ;
if ! ( --quiet in $(argv) )
{
ECHO testing module $(m)... ;
}
# Import m's rules into __test-$(m)__ for easy access.
IMPORT $(m) : [ RULENAMES $(m) ] : __test-$(m)__ : [ RULENAMES $(m) ] ;
# Execute the module's __test__ rule in its own module to
# eliminate the inadvertent effects of testing module
# dependencies (such as assert) on the module itself.
IMPORT $(m) : __test__ : __test-$(m)__ : __test__ : LOCALIZE ;
module __test-$(m)__
{
# Set up the name of the module we're testing so that
# no-test-defined can find it.
__module__ = $(1) ;
__test__ ;
}
}
run_test $(m) ;
}
.untested = ;
}