[ci skip] update generated files
[scons.git] / test / Interactive / taskmastertrace.py
blob381005a9ddff6ef31f46c5dcd1ed82cd5c5238df
1 #!/usr/bin/env python
3 # MIT License
5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 """
28 Verify use of the --taskmastertrace= option to the "build" command
29 of --interactive mode.
30 """
32 import TestSCons
34 test = TestSCons.TestSCons()
36 test.write('SConstruct', """\
37 DefaultEnvironment(tools=[])
38 Command('foo.out', 'foo.in', Copy('$TARGET', '$SOURCE'))
39 Command('1', [], Touch('$TARGET'))
40 Command('2', [], Touch('$TARGET'))
41 """)
43 test.write('foo.in', "foo.in 1\n")
46 scons = test.start(arguments = '-Q --interactive --experimental=legacy_sched')
48 scons.send("build foo.out 1\n")
50 test.wait_for(test.workpath('1'))
52 test.must_match(test.workpath('foo.out'), "foo.in 1\n")
56 test.write('foo.in', "foo.in 2\n")
58 scons.send("build --taskmastertrace=- foo.out\n")
60 test.wait_for(test.workpath('foo.out'))
62 scons.send("build 2\n")
64 test.wait_for(test.workpath('2'))
66 test.must_match(test.workpath('foo.out'), "foo.in 2\n")
70 scons.send("build foo.out\n")
72 expect_stdout = """\
73 scons>>> Copy("foo.out", "foo.in")
74 Touch("1")
75 scons>>>
76 Taskmaster: Looking for a node to evaluate
77 Taskmaster: Considering node <no_state 0 'foo.out'> and its children:
78 Taskmaster: <no_state 0 'foo.in'>
79 Taskmaster: adjusted ref count: <pending 1 'foo.out'>, child 'foo.in'
80 Taskmaster: Considering node <no_state 0 'foo.in'> and its children:
81 Taskmaster: Evaluating <pending 0 'foo.in'>
83 Task.make_ready_current(): node <pending 0 'foo.in'>
84 Task.prepare(): node <up_to_date 0 'foo.in'>
85 Task.executed_with_callbacks(): node <up_to_date 0 'foo.in'>
86 Task.postprocess(): node <up_to_date 0 'foo.in'>
87 Task.postprocess(): removing <up_to_date 0 'foo.in'>
88 Task.postprocess(): adjusted parent ref count <pending 0 'foo.out'>
90 Taskmaster: Looking for a node to evaluate
91 Taskmaster: Considering node <pending 0 'foo.out'> and its children:
92 Taskmaster: <up_to_date 0 'foo.in'>
93 Taskmaster: Evaluating <pending 0 'foo.out'>
95 Task.make_ready_current(): node <pending 0 'foo.out'>
96 Task.prepare(): node <executing 0 'foo.out'>
97 Task.execute(): node <executing 0 'foo.out'>
98 Copy("foo.out", "foo.in")
99 Task.executed_with_callbacks(): node <executing 0 'foo.out'>
100 Task.postprocess(): node <executed 0 'foo.out'>
102 Taskmaster: Looking for a node to evaluate
103 Taskmaster: No candidate anymore.
104 scons>>> Touch("2")
105 scons>>> scons: `foo.out' is up to date.
106 scons>>>
109 test.finish(scons, stdout = expect_stdout)
111 test.pass_test()
113 # Local Variables:
114 # tab-width:4
115 # indent-tabs-mode:nil
116 # End:
117 # vim: set expandtab tabstop=4 shiftwidth=4: