toolset_defaults.py 1.2 KB

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