Update tex builder to handle the case where a \input{foo}
[scons.git] / test / Interactive / basic.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 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
25
26 """
27 Verify basic operation of the --interactive command line option to build
28 a target, rebuild it when the input changes, and not rebuild it when
29 the input doesn't change.
30
31 Also tests that "scons" can be used as a synonym for "build".
32 """
33
34 import TestSCons
35
36 test = TestSCons.TestSCons()
37
38 test.write('SConstruct', """\
39 Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'))
40 Command('1', [], Touch('$TARGET'))
41 Command('2', [], Touch('$TARGET'))
42 """)
43
44 test.write('foo.in', "foo.in 1\n")
45
46
47
48 scons = test.start(arguments = '-Q --interactive')
49
50 scons.send("build foo.out 1\n")
51
52 test.wait_for(test.workpath('1'))
53
54 test.must_match(test.workpath('foo.out'), "foo.in 1\n")
55
56
57
58 test.write('foo.in', "foo.in 2\n")
59
60 # Verify that "scons" can be used as a synonmy for the "build" command.
61 scons.send("scons foo.out 2\n")
62
63 test.wait_for(test.workpath('2'))
64
65 test.must_match(test.workpath('foo.out'), "foo.in 2\n")
66
67
68
69 scons.send("build foo.out\n")
70
71 expect_stdout = """\
72 scons>>> Copy("foo.out", "foo.in")
73 Touch("1")
74 scons>>> Copy("foo.out", "foo.in")
75 Touch("2")
76 scons>>> scons: `foo.out' is up to date.
77 scons>>> 
78 """
79
80 test.finish(scons, stdout = expect_stdout)
81
82
83
84 test.pass_test()
85
86 # Local Variables:
87 # tab-width:4
88 # indent-tabs-mode:nil
89 # End:
90 # vim: set expandtab tabstop=4 shiftwidth=4: