Blame status/Jamfile.v2

Packit 58578d
# Copyright 2002. Dave Abrahams
Packit 58578d
# Copyright 2016. Rene Rivera
Packit 58578d
# Distributed under the Boost Software License, Version 1.0.
Packit 58578d
# (See accompanying file LICENSE_1_0.txt or copy at
Packit 58578d
# http://www.boost.org/LICENSE_1_0.txt)
Packit 58578d
Packit 58578d
# This build project manages running the tests for all of Boost.
Packit 58578d
# The tests to run are discovered from the structure of the libs tree.
Packit 58578d
#
Packit 58578d
# Usage:
Packit 58578d
#
Packit 58578d
# > cd boost-root/status
Packit 58578d
# > b2 [--check-libs-only] [--limit-tests=/lib-name-regex../]* [--exclude-tests=/lib-name-regex../]*
Packit 58578d
#
Packit 58578d
# --check-libs-only
Packit 58578d
#   Only runs the library conformance tests.
Packit 58578d
#
Packit 58578d
# --no-check-libs
Packit 58578d
#   Do not run the library conformance tests.
Packit 58578d
#
Packit 58578d
# --limit-tests, or --include-tests
Packit 58578d
#   Only runs the tests for whom the name matches the regex.
Packit 58578d
#   The value for the argument is a comma separated list of simple
Packit 58578d
#   regular expressions to check against the names of all the libraries.
Packit 58578d
#   If any one regex matches the matching library is tested.
Packit 58578d
#
Packit 58578d
# --exclude-tests
Packit 58578d
#   Only runs the tests for whom the names does not match the regex.
Packit 58578d
#   The argument is the same as for the limit-tests option except
Packit 58578d
#   that the result is that libraries for whom the name matches
Packit 58578d
#   are not tested.
Packit 58578d
#
Packit 58578d
# The test filters are evaluated in the order given in the command
Packit 58578d
# and can be used to selectively narrow or widen the set of libraries
Packit 58578d
# tested.
Packit 58578d
#
Packit 58578d
# Examples:
Packit 58578d
#
Packit 58578d
# > b2 --check-libs-only --include-tests=predef,config
Packit 58578d
# 
Packit 58578d
# Runs the library conformance tests for the predef and config
Packit 58578d
# libraries only.
Packit 58578d
#
Packit 58578d
# > b2 --include-tests=[n-t] --exclude-tests=rat --limit-tests=[v-w]
Packit 58578d
#
Packit 58578d
# Runs all the tests for library names that begin with "n" through "t",
Packit 58578d
# or "v" through "w", but not libraries that start with "rat".
Packit 58578d
Packit 58578d
project status
Packit 58578d
    : source-location $(BOOST_ROOT)
Packit 58578d
    : requirements <hardcode-dll-paths>true
Packit 58578d
    ;
Packit 58578d
Packit 58578d
import testing ;
Packit 58578d
import modules ;
Packit 58578d
import project ;
Packit 58578d
import regex ;
Packit 58578d
import modules ;
Packit 58578d
import path ;
Packit 58578d
import feature ;
Packit 58578d
import numbers ;
Packit 58578d
Packit 58578d
local check-libs-only = [ MATCH "^--(check-libs-only)" : [ modules.peek : ARGV ] ] ;
Packit 58578d
local no-check-libs = [ MATCH "^--(no-check-libs)$" : [ modules.peek : ARGV ] ] ;
Packit 58578d
local check-libs-only-targets = ;
Packit 58578d
local libraries = ;
Packit 58578d
Packit 58578d
local rule run-tests ( root : tests * )
Packit 58578d
{
Packit 58578d
    local filter-args = [ MATCH "^--(limit|exclude|include)-tests=(.*)" : [ modules.peek : ARGV ] ] ;
Packit 58578d
    local filter-tests ;
Packit 58578d
    while $(filter-args)
Packit 58578d
    {
Packit 58578d
        local type = $(filter-args[1]) ;
Packit 58578d
        for local test in [ regex.split-list $(filter-args[2]) : "[,]" ]
Packit 58578d
        {
Packit 58578d
            filter-tests += $(type) $(test) ;
Packit 58578d
        }
Packit 58578d
        filter-args = $(filter-args[3-]) ;
Packit 58578d
    }
Packit 58578d
    # If any filter is given we make the initial set of tested libraries we:
Packit 58578d
    # (a) make it empty if the first filter is an include.
Packit 58578d
    # (b) make it full otherwise.
Packit 58578d
    local include-default = y ;
Packit 58578d
    if $(filter-tests[1]) && ( $(filter-tests[1]) in limit include )
Packit 58578d
    {
Packit 58578d
        include-default = n ;
Packit 58578d
    }
Packit 58578d
    local location = [ project.attribute $(__name__) location ] ;
Packit 58578d
    # We only run the check library test when host-os == target-os.
Packit 58578d
    # Hence we need that information.
Packit 58578d
    local host-os-default = [ feature.defaults <host-os> ] ;
Packit 58578d
    for local test in $(tests)
Packit 58578d
    {
Packit 58578d
        local library = [ path.parent $(test) ] ;
Packit 58578d
        if $(library) = "."
Packit 58578d
        {
Packit 58578d
            library = $(test) ;
Packit 58578d
        }
Packit 58578d
        local include-test = $(include-default) ;
Packit 58578d
        local t = 1 ;
Packit 58578d
        local f = 2 ;
Packit 58578d
        while $(filter-tests[$(f)])
Packit 58578d
        {
Packit 58578d
            if [ MATCH "^($(filter-tests[$(f)]))" : $(test) ]
Packit 58578d
            {
Packit 58578d
                if $(filter-tests[$(t)]) = exclude { include-test = n ; }
Packit 58578d
                else { include-test = y ; }
Packit 58578d
            }
Packit 58578d
            t = [ CALC $(t) + 2 ] ;
Packit 58578d
            f = [ CALC $(f) + 2 ] ;
Packit 58578d
        }
Packit 58578d
        if $(include-test) = y
Packit 58578d
        {
Packit 58578d
            if [ path.exists ../$(root)/$(test) ]
Packit 58578d
            {
Packit 58578d
                use-project /boost/$(test) : ../$(root)/$(test) ;
Packit 58578d
            }
Packit 58578d
            if $(root) = libs && ! $(no-check-libs) && ( ! ( $(library) in $(libraries) ) )
Packit 58578d
            {
Packit 58578d
                libraries += $(library) ;
Packit 58578d
                local test_module = [ project.find ../$(root)/$(test) : $(location) ] ;
Packit 58578d
                modules.poke $(test_module) : __LIBRARY__ : $(root)/$(library) ;
Packit 58578d
                modules.poke $(test_module) : __JAMFILE__ : [ modules.peek project : JAMFILE ] ;
Packit 58578d
                modules.poke $(test_module) : __REQUIRE__ : <target-os>$(host-os-default:G=) ;
Packit 58578d
                project.push-current [ project.target $(test_module) ] ;
Packit 58578d
                module $(test_module)
Packit 58578d
                {
Packit 58578d
                    import testing ;
Packit 58578d
                    testing.make-test run-pyd :
Packit 58578d
                        $(BOOST_ROOT)/status/boost_check_library.py
Packit 58578d
                        :
Packit 58578d
                        <pythonpath>$(BOOST_ROOT)/status
Packit 58578d
                        <testing.arg>--boost-root=\"$(BOOST_ROOT)\"
Packit 58578d
                        <testing.arg>--library=$(__LIBRARY__)
Packit 58578d
                        <testing.arg>--jamfile=\"$(__JAMFILE__:J=;)\"
Packit 58578d
                        <testing.arg>organization
Packit 58578d
                        $(__REQUIRE__)
Packit 58578d
                        :
Packit 58578d
                        __boost_check_library__ ;
Packit 58578d
                }
Packit 58578d
                project.pop-current ;
Packit 58578d
                check-libs-only-targets += ../$(root)/$(test)//__boost_check_library__ ;
Packit 58578d
            }
Packit 58578d
            if ! $(check-libs-only)
Packit 58578d
            {
Packit 58578d
                build-project ../$(root)/$(test) ;
Packit 58578d
            }
Packit 58578d
        }
Packit 58578d
    }
Packit 58578d
}
Packit 58578d
Packit 58578d
local rule find-targets ( target : libs * )
Packit 58578d
{
Packit 58578d
    local result = ;
Packit 58578d
Packit 58578d
    for local lib in $(libs)
Packit 58578d
    {
Packit 58578d
        local path = ../libs/$(lib)/test ;
Packit 58578d
        local project = [ project.load $(path) ] ;
Packit 58578d
        local pt = [ project.target $(project) ] ;
Packit 58578d
        local mt = [ $(pt).main-target $(target) ] ;
Packit 58578d
Packit 58578d
        if $(mt)
Packit 58578d
        {
Packit 58578d
            result += $(path)//$(target) ;
Packit 58578d
        }
Packit 58578d
    }
Packit 58578d
Packit 58578d
    return $(result) ;
Packit 58578d
}
Packit 58578d
Packit 58578d
local libs-to-test = ;
Packit 58578d
for local libdir in [ path.glob $(BOOST_ROOT) : libs/* ]
Packit 58578d
{
Packit 58578d
    local jamfile = [ modules.peek project : JAMFILE ] ;
Packit 58578d
    local jamfiles = [ path.glob [ path.join $(libdir) test ] : $(jamfile) ] ;
Packit 58578d
    if $(jamfiles)
Packit 58578d
    {
Packit 58578d
        libs-to-test += $(libdir:B) ;
Packit 58578d
    }
Packit 58578d
    if [ path.glob $(libdir) : sublibs ]
Packit 58578d
    {
Packit 58578d
        jamfiles = [ path.glob $(libdir) : */test/$(jamfile) ] ;
Packit 58578d
        for local sublib_jamfile in $(jamfiles)
Packit 58578d
        {
Packit 58578d
            local sublibdir = [ path.parent [ path.parent $(sublib_jamfile) ] ] ;
Packit 58578d
            local sublib = $(libdir:B)/$(sublibdir:B) ;
Packit 58578d
            libs-to-test += $(sublib) ;
Packit 58578d
        }
Packit 58578d
    }
Packit 58578d
}
Packit 58578d
libs-to-test = [ SORT $(libs-to-test) ] ;
Packit 58578d
Packit 58578d
run-tests libs : $(libs-to-test)/test ;
Packit 58578d
Packit 58578d
# Tests from Jamfiles in individual library test subdirectories
Packit 58578d
# Please keep these in alphabetic order by test-suite name
Packit 58578d
run-tests libs :
Packit 58578d
    wave/test/build             # test-suite wave
Packit 58578d
    ;
Packit 58578d
Packit 58578d
run-tests tools :
Packit 58578d
    bcp/test
Packit 58578d
    ;
Packit 58578d
Packit 58578d
if $(check-libs-only-targets)
Packit 58578d
{
Packit 58578d
    alias check-libs-only : $(check-libs-only-targets) ;
Packit 58578d
}
Packit 58578d
Packit 58578d
alias minimal : [ find-targets minimal : $(libs-to-test) ] ;
Packit 58578d
explicit minimal ;
Packit 58578d
Packit 58578d
alias quick : [ find-targets quick : $(libs-to-test) ] ;
Packit 58578d
explicit quick ;