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__"
28 Test that use of env.SourceSignatures() correctly overrides the
36 test
= TestSCons
.TestSCons(match
= TestSCons
.match_re_dotall
)
38 base_sconstruct_contents
= """\
39 SetOption('warn', 'deprecated-source-signatures')
40 def build(env, target, source):
41 with open(str(target[0]), 'wt') as ofp, open(str(source[0]), 'rt') as ifp:
43 B = Builder(action = build)
44 env = Environment(BUILDERS = { 'B' : B })
46 env2.SourceSignatures('%s')
47 env.B(target = 'f1.out', source = 'f1.in')
48 env.B(target = 'f2.out', source = 'f2.in')
49 env2.B(target = 'f3.out', source = 'f3.in')
50 env2.B(target = 'f4.out', source = 'f4.in')
52 SourceSignatures('%s')
55 def write_SConstruct(test
, env_sigtype
, default_sigtype
):
56 contents
= base_sconstruct_contents
% (env_sigtype
, default_sigtype
)
57 test
.write('SConstruct', contents
)
60 expect
= TestSCons
.re_escape("""
61 scons: warning: The env.SourceSignatures() method is deprecated;
62 \tconvert your build to use the env.Decider() method instead.
63 """) + TestSCons
.file_expr
66 write_SConstruct(test
, 'MD5', 'timestamp')
68 test
.write('f1.in', "f1.in\n")
69 test
.write('f2.in', "f2.in\n")
70 test
.write('f3.in', "f3.in\n")
71 test
.write('f4.in', "f4.in\n")
73 test
.run(arguments
= 'f1.out f3.out', stderr
= expect
)
75 test
.run(arguments
= 'f1.out f2.out f3.out f4.out',
76 stdout
= re
.escape(test
.wrap_stdout("""\
77 scons: `f1.out' is up to date.
78 build(["f2.out"], ["f2.in"])
79 scons: `f3.out' is up to date.
80 build(["f4.out"], ["f4.in"])
90 test
.run(arguments
= 'f1.out f2.out f3.out f4.out',
91 stdout
= re
.escape(test
.wrap_stdout("""\
92 build(["f1.out"], ["f1.in"])
93 scons: `f2.out' is up to date.
94 scons: `f3.out' is up to date.
95 scons: `f4.out' is up to date.
99 test
.up_to_date(arguments
= 'f1.out f2.out f3.out f4.out', stderr
= None)
106 # indent-tabs-mode:nil
108 # vim: set expandtab tabstop=4 shiftwidth=4: