Update tests for now discovering dependencies on quoted commands
[scons.git] / test / explain / alias-order.py
1 #!/usr/bin/env python
2 #
3 # __COPYRIGHT__
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 #
24
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
26
27 """
28 Verify a lot of the basic operation of the --debug=explain option.
29 """
30
31 import TestSCons
32
33 _python_ = TestSCons._python_
34
35 test = TestSCons.TestSCons()
36
37 args = '--debug=explain target2.dat'
38
39 test.subdir('src')
40 test.write(['src', 'SConstruct'],"""
41 env = Environment()
42
43 def action( source, target, env ):
44     f = open( str(target[0]), 'w' )
45     f.write( source[0].get_contents())
46     f.close()
47
48 builder = env.Builder( action=action )
49
50 builder( env, target = "target1.dat", source = "source1.dat" )
51 alias = env.Alias( "alias", "source2.dat" )
52 builder( env, target = "target2.dat", source = ["target1.dat"] )
53 env.Depends( "target2.dat", alias )
54 """
55 )
56
57 test.write(["src", "source1.dat"], "a" )
58 test.write(["src", "source2.dat"], "a" )
59
60 expect = test.wrap_stdout("""\
61 scons: building `target1.dat' because it doesn't exist
62 action(["target1.dat"], ["source1.dat"])
63 scons: building `target2.dat' because it doesn't exist
64 action(["target2.dat"], ["target1.dat"])
65 """)
66
67 test.run(chdir='src', arguments=args, stdout=expect)
68
69 test.write(["src", "source1.dat"], "b" )
70
71 expect = test.wrap_stdout("""\
72 scons: rebuilding `target1.dat' because `source1.dat' changed
73 action(["target1.dat"], ["source1.dat"])
74 scons: rebuilding `target2.dat' because `target1.dat' changed
75 action(["target2.dat"], ["target1.dat"])
76 """)
77
78 test.run(chdir='src', arguments=args, stdout=expect)
79
80
81 test.pass_test()