]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/core_dependencies.py
3 # Copyright 2003 Vladimir Prus
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)
7 # This tests correct handling of dependencies, specifically, on generated
8 # sources, and from generated sources.
14 t
= BoostBuild
.Tester(pass_toolset
=0)
16 t
.write("core-dependency-helpers", """
19 INCLUDES $(1) : $(2) ;
27 code
= """include core-dependency-helpers ;
33 echo '#include <foo.h>' > $(<)
37 HDRRULE on b foo.h bar.h = hdrrule ;
38 HDRSCAN on b foo.h bar.h = \"#include <(.*)>\" ;
41 # This creates 'a' which depends on 'b', which is generated. The generated 'b'
42 # contains '#include <foo.h>' and no rules for foo.h are given. The system
43 # should error out on the first invocation.
44 t
.run_build_system("-f-", stdin
=code
)
45 t
.fail_test(string
.find(t
.stdout(), "...skipped a for lack of foo.h...") == -1)
49 # Now test that if target 'c' also depends on 'b', then it will not be built, as
51 t
.run_build_system("-f-", stdin
=code
+ " copy c : b ; DEPENDS c : b ; DEPENDS all : c ; ")
52 t
.fail_test(string
.find(t
.stdout(), "...skipped c for lack of foo.h...") == -1)
56 # Now add a rule for creating foo.h.
64 t
.run_build_system("-f-", stdin
=code
)
66 # Run two times, adding explicit dependency from all to foo.h at the beginning
67 # and at the end, to make sure that foo.h is generated before 'a' in all cases.
69 def mk_correct_order_func(s1
, s2
):
71 n1
= string
.find(s
, s1
)
72 n2
= string
.find(s
, s2
)
73 return ( n1
!= -1 ) and ( n2
!= -1 ) and ( n1
< n2
)
76 correct_order
= mk_correct_order_func("create-foo", "copy a")
78 t
.rm(["a", "b", "foo.h"])
79 t
.run_build_system("-d+2 -f-", stdin
=code
+ " DEPENDS all : foo.h ;")
80 t
.fail_test(not correct_order(t
.stdout()))
82 t
.rm(["a", "b", "foo.h"])
83 t
.run_build_system("-d+2 -f-", stdin
=" DEPENDS all : foo.h ; " + code
)
84 t
.fail_test(not correct_order(t
.stdout()))
86 # Now foo.h exists. Test include from b -> foo.h -> bar.h -> biz.h. b and foo.h
87 # already have updating actions.
89 t
.write("foo.h", "#include <bar.h>")
90 t
.write("bar.h", "#include <biz.h>")
91 t
.run_build_system("-d+2 -f-", stdin
=code
)
92 t
.fail_test(string
.find(t
.stdout(), "...skipped a for lack of biz.h...") == -1)
94 # Add an action for biz.h.
104 correct_order
= mk_correct_order_func("create-biz", "copy a")
105 t
.run_build_system("-d+2 -f-", stdin
=code
+ " DEPENDS all : biz.h ;")
106 t
.fail_test(not correct_order(t
.stdout()))
109 t
.run_build_system("-d+2 -f-", stdin
=" DEPENDS all : biz.h ; " + code
)
110 t
.fail_test(not correct_order(t
.stdout()))
115 DEPENDS all : main d ;
144 HDRSCAN on <1>c = (.*) ;
145 HDRRULE on <1>c = hdrrule ;
153 correct_order
= mk_correct_order_func("create-d", "copy main")
154 t
.run_build_system("-d2 -f-", stdin
=code
)
155 t
.fail_test(not correct_order(t
.stdout()))