Imported Upstream version 1.51.0
[platform/upstream/boost.git] / tools / build / v2 / test / core_at_file.py
1 #!/usr/bin/python
2
3 # Copyright 2011 Steven Watanabe
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) 
6
7
8 import BoostBuild
9 import os
10
11 t = BoostBuild.Tester(pass_toolset=0)
12
13 t.write("file.jam", """
14 name = n1 n2 ;
15 contents = M1 M2 ;
16 EXIT file: "@(o$(name) .txt:E= test -D$(contents))" : 0 ;
17 """)
18
19 t.run_build_system("-ffile.jam")
20 t.expect_output_line("file: on1 on2 .txt");
21 t.expect_addition("on1 on2 .txt")
22 t.expect_content("on1 on2 .txt", " test -DM1 -DM2", True)
23
24 t.rm(".")
25
26 t.write("file.jam", """
27 name = n1 n2 ;
28 contents = M1 M2 ;
29 actions run {
30 echo file: "@(o$(name) .txt:E= test -D$(contents))"
31 }
32
33 run all ;
34
35 """)
36
37 t.run_build_system("-ffile.jam -d2")
38 t.expect_output_line('echo file: "on1 on2 .txt"');
39 t.expect_addition("on1 on2 .txt")
40 t.expect_content("on1 on2 .txt", " test -DM1 -DM2", True)
41
42 t.rm(".")
43
44 t.write("file.jam", """
45 name = n1 n2 ;
46 contents = M1 M2 ;
47 file = "@($(STDOUT):E= test -D$(contents)\n)" ;
48
49 actions run {
50 $(file)
51 }
52
53 run all ;
54 """)
55
56 t.run_build_system("-ffile.jam -d1")
57 t.expect_output_line(" test -DM1 -DM2")
58
59 t.rm(".")
60
61 t.write("file.jam", """
62 name = n1 n2 ;
63 contents = M1 M2 ;
64 actions run {
65 @($(STDOUT):E= test -D$(contents)\n)
66 }
67
68 run all ;
69
70 """)
71
72 t.run_build_system("-ffile.jam -d1")
73 t.expect_output_line(" test -DM1 -DM2")
74
75 t.cleanup()