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