Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / build / test / core_modifiers.py
1 #!/usr/bin/python
2
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)
6
7 # This tests the "existing" and "updated" modifiers on actions.
8
9 import BoostBuild
10 import string
11
12 t = BoostBuild.Tester(pass_toolset=0)
13
14 code = """
15 DEPENDS all : a ;
16 ALWAYS a ;
17 NOTFILE a ;
18
19 actions existing make-a
20 {
21     echo $(>) > list
22 }
23 make-a a : a-1 a-2 a-3 ;
24 DEPENDS a : a-1 a-2 a-3 ;
25 NOCARE a-1 a-2 ;
26
27 actions make-a3
28 {
29    echo foo > $(<)
30 }
31 make-a3 a-3 ;
32 """
33
34 t.write("file.jam", code)
35 t.write("a-1", "")
36
37 t.run_build_system("-ffile.jam")
38 t.fail_test(string.strip(t.read("list")) != "a-1")
39 t.rm(["a-3", "list"])
40
41 code = string.replace(code, "existing", "updated")
42 t.write("file.jam", code)
43 t.run_build_system("-ffile.jam")
44 t.fail_test(string.strip(t.read("list")) != "a-3")
45
46 code = string.replace(code, "updated", "existing updated")
47 t.write("file.jam", code)
48 t.run_build_system("-ffile.jam")
49 t.fail_test(string.strip(t.read("list")) != "a-1 a-3")
50
51 t.cleanup()