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.
28 test
= TestSCons
.TestSCons()
30 # During the development of 0.96, there was a --save-explain-info
31 # option for a brief moment that would surpress storing extra
32 # info in the .sconsign file(s). At that time, this test used two
33 # working subdirectories to test both with and without the saved info.
34 # We eliminated the --save-explain-info option and the second working
35 # subdirectory here, but didn't go back and change all the filenames.
38 SConstruct1_contents
= """\
39 def build(env, target, source):
40 with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi:
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 with open(str(target[0]), 'wt') as fo, open(str(source[0]), 'rt') as fi:
52 env=Environment(BUILDERS={'B' : Builder(action=build)})
53 env.B('foo.out', 'foo.mid')
56 test
.write(['w1', 'SConstruct1'], SConstruct1_contents
)
57 test
.write(['w1', 'SConstruct2'], SConstruct2_contents
)
58 test
.write(['w1', 'foo.in'], "foo.in 1")
62 arguments
="--max-drift=0 -f SConstruct1 foo.mid",
63 stdout
=test
.wrap_stdout('build(["foo.mid"], ["foo.in"])\n'),
67 arguments
="--max-drift=0 -f SConstruct2 foo.out",
68 stdout
=test
.wrap_stdout('build(["foo.out"], ["foo.mid"])\n'),
70 test
.up_to_date(chdir
='w1', options
="--max-drift=0 -f SConstruct1", arguments
="foo.mid")
71 test
.up_to_date(chdir
='w1', options
="--max-drift=0 -f SConstruct2", arguments
="foo.out")
73 test
.sleep() # delay for timestamps
74 test
.write(['w1', 'foo.in'], "foo.in 2")
76 # Because we're using --max-drift=0, we use the cached csig value
77 # and think that foo.in hasn't changed even though it has on disk.
78 test
.up_to_date(chdir
='w1',
79 options
="--max-drift=0 -f SConstruct1",
82 # Now try with --max-drift disabled. The build of foo.out should still
83 # be considered up-to-date, but the build of foo.mid now detects the
84 # change and rebuilds, too, which then causes a rebuild of foo.out.
86 chdir
='w1', options
="--max-drift=-1 -f SConstruct2", arguments
="foo.out"
90 arguments
="--max-drift=-1 -f SConstruct1 foo.mid",
91 stdout
=test
.wrap_stdout('build(["foo.mid"], ["foo.in"])\n'),
95 arguments
="--max-drift=-1 -f SConstruct2 foo.out",
96 stdout
=test
.wrap_stdout('build(["foo.out"], ["foo.mid"])\n'),
103 # indent-tabs-mode:nil
105 # vim: set expandtab tabstop=4 shiftwidth=4: