project_test3.py 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/usr/bin/python
  2. # Copyright 2002, 2003 Dave Abrahams
  3. # Copyright 2002, 2003, 2004, 2006 Vladimir Prus
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE.txt or copy at
  6. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  7. import BoostBuild
  8. import os
  9. t = BoostBuild.Tester(translate_suffixes=0)
  10. # First check some startup.
  11. t.set_tree("project-test3")
  12. os.remove("jamroot.jam")
  13. t.run_build_system(status=1)
  14. t.expect_output_lines("*.yfc-compile\" unknown in module*")
  15. t.set_tree("project-test3")
  16. t.run_build_system()
  17. t.expect_addition("bin/$toolset/debug*/a.obj")
  18. t.expect_content("bin/$toolset/debug*/a.obj", """\
  19. $toolset/debug*
  20. a.cpp
  21. """)
  22. t.expect_addition("bin/$toolset/debug*/a.exe")
  23. t.expect_content("bin/$toolset/debug*/a.exe",
  24. "$toolset/debug*\n" +
  25. "bin/$toolset/debug*/a.obj lib/bin/$toolset/debug*/b.obj " +
  26. "lib2/bin/$toolset/debug*/c.obj lib2/bin/$toolset/debug*/d.obj " +
  27. "lib2/helper/bin/$toolset/debug*/e.obj " +
  28. "lib3/bin/$toolset/debug*/f.obj\n"
  29. )
  30. t.expect_addition("lib/bin/$toolset/debug*/b.obj")
  31. t.expect_content("lib/bin/$toolset/debug*/b.obj", """\
  32. $toolset/debug*
  33. lib/b.cpp
  34. """)
  35. t.expect_addition("lib/bin/$toolset/debug*/m.exe")
  36. t.expect_content("lib/bin/$toolset/debug*/m.exe", """\
  37. $toolset/debug*
  38. lib/bin/$toolset/debug*/b.obj lib2/bin/$toolset/debug*/c.obj
  39. """)
  40. t.expect_addition("lib2/bin/$toolset/debug*/c.obj")
  41. t.expect_content("lib2/bin/$toolset/debug*/c.obj", """\
  42. $toolset/debug*
  43. lib2/c.cpp
  44. """)
  45. t.expect_addition("lib2/bin/$toolset/debug*/d.obj")
  46. t.expect_content("lib2/bin/$toolset/debug*/d.obj", """\
  47. $toolset/debug*
  48. lib2/d.cpp
  49. """)
  50. t.expect_addition("lib2/bin/$toolset/debug*/l.exe")
  51. t.expect_content("lib2/bin/$toolset/debug*/l.exe", """\
  52. $toolset/debug*
  53. lib2/bin/$toolset/debug*/c.obj bin/$toolset/debug*/a.obj
  54. """)
  55. t.expect_addition("lib2/helper/bin/$toolset/debug*/e.obj")
  56. t.expect_content("lib2/helper/bin/$toolset/debug*/e.obj", """\
  57. $toolset/debug*
  58. lib2/helper/e.cpp
  59. """)
  60. t.expect_addition("lib3/bin/$toolset/debug*/f.obj")
  61. t.expect_content("lib3/bin/$toolset/debug*/f.obj", """\
  62. $toolset/debug*
  63. lib3/f.cpp lib2/helper/bin/$toolset/debug*/e.obj
  64. """)
  65. t.touch("a.cpp")
  66. t.run_build_system()
  67. t.expect_touch(["bin/$toolset/debug*/a.obj",
  68. "bin/$toolset/debug*/a.exe",
  69. "lib2/bin/$toolset/debug*/l.exe"])
  70. t.run_build_system(["release", "optimization=off,speed"])
  71. t.expect_addition(["bin/$toolset/release/optimization-off*/a.exe",
  72. "bin/$toolset/release/optimization-off*/a.obj",
  73. "bin/$toolset/release*/a.exe",
  74. "bin/$toolset/release*/a.obj"])
  75. t.run_build_system(["--clean-all"])
  76. t.expect_removal(["bin/$toolset/debug*/a.obj",
  77. "bin/$toolset/debug*/a.exe",
  78. "lib/bin/$toolset/debug*/b.obj",
  79. "lib/bin/$toolset/debug*/m.exe",
  80. "lib2/bin/$toolset/debug*/c.obj",
  81. "lib2/bin/$toolset/debug*/d.obj",
  82. "lib2/bin/$toolset/debug*/l.exe",
  83. "lib3/bin/$toolset/debug*/f.obj"])
  84. # Now test target ids in command line.
  85. t.set_tree("project-test3")
  86. t.run_build_system(["lib//b.obj"])
  87. t.expect_addition("lib/bin/$toolset/debug*/b.obj")
  88. t.expect_nothing_more()
  89. t.run_build_system(["--clean", "lib//b.obj"])
  90. t.expect_removal("lib/bin/$toolset/debug*/b.obj")
  91. t.expect_nothing_more()
  92. t.run_build_system(["lib//b.obj"])
  93. t.expect_addition("lib/bin/$toolset/debug*/b.obj")
  94. t.expect_nothing_more()
  95. t.run_build_system(["release", "lib2/helper//e.obj", "/lib3//f.obj"])
  96. t.expect_addition("lib2/helper/bin/$toolset/release*/e.obj")
  97. t.expect_addition("lib3/bin/$toolset/release*/f.obj")
  98. t.expect_nothing_more()
  99. # Test project ids in command line work as well.
  100. t.set_tree("project-test3")
  101. t.run_build_system(["/lib2"])
  102. t.expect_addition("lib2/bin/$toolset/debug*/" *
  103. BoostBuild.List("c.obj d.obj l.exe"))
  104. t.expect_addition("bin/$toolset/debug*/a.obj")
  105. t.expect_nothing_more()
  106. t.run_build_system(["lib"])
  107. t.expect_addition("lib/bin/$toolset/debug*/" *
  108. BoostBuild.List("b.obj m.exe"))
  109. t.expect_nothing_more()
  110. t.cleanup()