copy_time.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/python
  2. #
  3. # Copyright (c) 2008 Steven Watanabe
  4. #
  5. # Distributed under the Boost Software License, Version 1.0.
  6. # (See accompanying file LICENSE.txt or copy at
  7. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  8. # Test that the common.copy rule set the modification date of the new file to
  9. # the current time.
  10. import BoostBuild
  11. tester = BoostBuild.Tester(use_test_config=False)
  12. tester.write("test1.cpp", """\
  13. template<bool, int M, class Next>
  14. struct time_waster {
  15. typedef typename time_waster<true, M-1, time_waster>::type type1;
  16. typedef typename time_waster<false, M-1, time_waster>::type type2;
  17. typedef void type;
  18. };
  19. template<bool B, class Next>
  20. struct time_waster<B, 0, Next> {
  21. typedef void type;
  22. };
  23. typedef time_waster<true, 10, void>::type type;
  24. int f() { return 0; }
  25. """)
  26. tester.write("test2.cpp", """\
  27. template<bool, int M, class Next>
  28. struct time_waster {
  29. typedef typename time_waster<true, M-1, time_waster>::type type1;
  30. typedef typename time_waster<false, M-1, time_waster>::type type2;
  31. typedef void type;
  32. };
  33. template<bool B, class Next>
  34. struct time_waster<B, 0, Next> {
  35. typedef void type;
  36. };
  37. typedef time_waster<true, 10, void>::type type;
  38. int g() { return 0; }
  39. """)
  40. tester.write("jamroot.jam", """\
  41. obj test2 : test2.cpp ;
  42. obj test1 : test1.cpp : <dependency>test2 ;
  43. install test2i : test2 : <dependency>test1 ;
  44. """)
  45. tester.run_build_system()
  46. tester.expect_addition("bin/$toolset/debug*/test2.obj")
  47. tester.expect_addition("bin/$toolset/debug*/test1.obj")
  48. tester.expect_addition("test2i/test2.obj")
  49. tester.expect_nothing_more()
  50. test2src = tester.read("test2i/test2.obj", binary=True)
  51. test2dest = tester.read("bin/$toolset/debug*/test2.obj", binary=True)
  52. if test2src != test2dest:
  53. BoostBuild.annotation("failure", "The object file was not copied "
  54. "correctly")
  55. tester.fail_test(1)
  56. tester.run_build_system(["-d1"])
  57. tester.expect_output_lines("common.copy*", False)
  58. tester.expect_nothing_more()
  59. tester.cleanup()