summaryrefslogtreecommitdiffstats
path: root/src/boost/tools/build/test/toolset_defaults.py
blob: 6d76c10fda681c77ff6eca64808b40d6ce1e628f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python

# Copyright 2018 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 the handling of toolset.add-defaults

import BoostBuild

t = BoostBuild.Tester(pass_toolset=0, ignore_toolset_requirements=False)

t.write('jamroot.jam', '''
import toolset ;
import errors ;
import feature : feature ;
import set ;

feature f1 : a b ;
feature f2 : c d ;
feature f3 : e f ;
feature f4 : g h ;
feature f5 : i j ;
feature f6 : k l m ;

rule test-rule ( properties * )
{
  if <f1>a in $(properties)
  {
    return <f2>d ;
  }
}

toolset.add-defaults
  <conditional>@test-rule
  <f3>e:<f4>h
  <f5>i:<f6>l
;

rule check-requirements ( target : sources * : properties * )
{
  local expected = <f2>d <f4>h <f6>m ;
  local unexpected = <f2>c <f4>g <f6>k <f6>l ;
  local missing = [ set.difference $(expected) : $(properties) ] ;
  if $(missing)
  {
    errors.error $(missing) not present ;
  }
  local extra = [ set.intersection $(unexpected) : $(properties) ] ;
  if $(extra)
  {
    errors.error $(extra) present ;
  }
}
make test : : @check-requirements : <f6>m ;
''')

t.run_build_system()

t.cleanup()