1#!/usr/bin/python 2 3# Copyright 2018 Steven Watanabe 4# Distributed under the Boost Software License, Version 1.0. 5# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 6 7# Test the handling of toolset.add-defaults 8 9import BoostBuild 10 11t = BoostBuild.Tester(pass_toolset=0, ignore_toolset_requirements=False) 12 13t.write('jamroot.jam', ''' 14import toolset ; 15import errors ; 16import feature : feature ; 17import set ; 18 19feature f1 : a b ; 20feature f2 : c d ; 21feature f3 : e f ; 22feature f4 : g h ; 23feature f5 : i j ; 24feature f6 : k l m ; 25 26rule test-rule ( properties * ) 27{ 28 if <f1>a in $(properties) 29 { 30 return <f2>d ; 31 } 32} 33 34toolset.add-defaults 35 <conditional>@test-rule 36 <f3>e:<f4>h 37 <f5>i:<f6>l 38; 39 40rule check-requirements ( target : sources * : properties * ) 41{ 42 local expected = <f2>d <f4>h <f6>m ; 43 local unexpected = <f2>c <f4>g <f6>k <f6>l ; 44 local missing = [ set.difference $(expected) : $(properties) ] ; 45 if $(missing) 46 { 47 errors.error $(missing) not present ; 48 } 49 local extra = [ set.intersection $(unexpected) : $(properties) ] ; 50 if $(extra) 51 { 52 errors.error $(extra) present ; 53 } 54} 55make test : : @check-requirements : <f6>m ; 56''') 57 58t.run_build_system() 59 60t.cleanup() 61