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:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
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.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
29 test = TestSCons.TestSCons()
31 # During the development of 0.96, there was a --save-explain-info
32 # option for a brief moment that would surpress storing extra
33 # info in the .sconsign file(s). At that time, this test used two
34 # working subdirectories to test both with and without the saved info.
35 # We eliminated the --save-explain-info option and the second working
36 # subdirectory here, but didn't go back and change all the filenames.
39 SConstruct1_contents = """\
40 def build(env, target, source):
41 open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
43 env=Environment(BUILDERS={'B' : Builder(action=build)})
44 env.B('foo.mid', 'foo.in')
47 SConstruct2_contents = """\
48 def build(env, target, source):
49 open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read())
51 env=Environment(BUILDERS={'B' : Builder(action=build)})
52 env.B('foo.out', 'foo.mid')
55 test.write(['w1', 'SConstruct1'], SConstruct1_contents)
56 test.write(['w1', 'SConstruct2'], SConstruct2_contents)
57 test.write(['w1', 'foo.in'], "foo.in 1")
60 arguments="--max-drift=0 -f SConstruct1 foo.mid",
61 stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n'))
64 arguments="--max-drift=0 -f SConstruct2 foo.out",
65 stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n'))
67 test.up_to_date(chdir='w1',
68 options="--max-drift=0 -f SConstruct1",
71 test.up_to_date(chdir='w1',
72 options="--max-drift=0 -f SConstruct2",
75 test.sleep() # make sure foo.in rewrite has new mod-time
76 test.write(['w1', 'foo.in'], "foo.in 2")
78 # Because we're using --max-drift=0, we use the cached csig value
79 # and think that foo.in hasn't changed even though it has on disk.
80 test.up_to_date(chdir='w1',
81 options="--max-drift=0 -f SConstruct1",
84 # Now try with --max-drift disabled. The build of foo.out should still
85 # be considered up-to-date, but the build of foo.mid now detects the
86 # change and rebuilds, too, which then causes a rebuild of foo.out.
87 test.up_to_date(chdir='w1',
88 options="--max-drift=-1 -f SConstruct2",
92 arguments="--max-drift=-1 -f SConstruct1 foo.mid",
93 stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n'))
96 arguments="--max-drift=-1 -f SConstruct2 foo.out",
97 stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n'))