]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2013 Steven Watanabe | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 | 5 | # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt) |
7c673cae FG |
6 | |
7 | # Tests that action sources are not reordered | |
8 | ||
9 | import BoostBuild | |
10 | ||
11 | t = BoostBuild.Tester() | |
12 | ||
13 | t.write("check-order.jam", """\ | |
14 | import type ; | |
15 | import generators ; | |
16 | ||
17 | type.register ORDER_TEST : order-test ; | |
18 | ||
19 | SPACE = " " ; | |
20 | nl = "\n" ; | |
21 | actions check-order | |
22 | { | |
23 | echo$(SPACE)$(>[1])>$(<[1]) | |
24 | echo$(SPACE)$(>[2-])>>$(<[1])$(nl) | |
25 | } | |
26 | ||
27 | generators.register-composing check-order.check-order : C : ORDER_TEST ; | |
28 | """) | |
29 | ||
30 | t.write( | |
31 | 'check-order.py', | |
32 | """ | |
33 | import bjam | |
34 | ||
35 | from b2.build import type as type_, generators | |
36 | from b2.tools import common | |
37 | from b2.manager import get_manager | |
38 | ||
39 | MANAGER = get_manager() | |
40 | ENGINE = MANAGER.engine() | |
41 | ||
42 | type_.register('ORDER_TEST', ['order-test']) | |
43 | ||
44 | generators.register_composing('check-order.check-order', ['C'], ['ORDER_TEST']) | |
45 | ||
46 | def check_order(targets, sources, properties): | |
47 | ENGINE.set_target_variable(targets, 'SPACE', ' ') | |
48 | ENGINE.set_target_variable(targets, 'nl', '\\n') | |
49 | ||
50 | ENGINE.register_action( | |
51 | 'check-order.check-order', | |
52 | function=check_order, | |
53 | command=''' | |
54 | echo$(SPACE)$(>[1])>$(<[1]) | |
55 | echo$(SPACE)$(>[2-])>>$(<[1])$(nl) | |
56 | ''' | |
57 | ) | |
58 | """ | |
59 | ) | |
60 | ||
61 | # The aliases are necessary for this test, since | |
62 | # the targets were sorted by virtual target | |
63 | # id, not by file name. | |
64 | t.write("jamroot.jam", """\ | |
65 | import check-order ; | |
66 | alias file1 : file1.c ; | |
67 | alias file2 : file2.c ; | |
68 | alias file3 : file3.c ; | |
69 | order-test check : file2 file1 file3 ; | |
70 | """) | |
71 | ||
72 | t.write("file1.c", "") | |
73 | t.write("file2.c", "") | |
74 | t.write("file3.c", "") | |
75 | ||
76 | t.run_build_system() | |
11fdf7f2 TL |
77 | t.expect_addition("bin/check.order-test") |
78 | t.expect_content("bin/check.order-test", """\ | |
7c673cae FG |
79 | file2.c |
80 | file1.c | |
81 | file3.c | |
82 | """, True) | |
83 | ||
84 | t.cleanup() |