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 Verify behavior of the MD5-timestamp Decider() setting when combined with Repository() usage
35 test
= TestSCons
.TestSCons()
37 test
.subdir('Repository', 'work')
38 repository
= test
.workpath('Repository')
40 test
.write(['Repository','content1.in'], "content1.in 1\n")
41 test
.write(['Repository','content2.in'], "content2.in 1\n")
42 test
.write(['Repository','content3.in'], "content3.in 1\n")
43 # test.writable('Repository', 0)
45 test
.write(['work','SConstruct'], """\
47 DefaultEnvironment(tools=[])
48 m = Environment(tools=[])
49 m.Decider('MD5-timestamp')
50 m.Command('content1.out', 'content1.in', Copy('$TARGET', '$SOURCE'))
51 m.Command('content2.out', 'content2.in', Copy('$TARGET', '$SOURCE'))
52 m.Command('content3.out', 'content3.in', Copy('$TARGET', '$SOURCE'))
55 test
.run(chdir
='work',arguments
='.')
56 test
.up_to_date(chdir
='work',arguments
='.')
58 test
.sleep() # delay for timestamps
59 test
.write(['Repository','content1.in'], "content1.in 2\n")
60 test
.touch(['Repository','content2.in'])
61 time_content
= os
.stat(os
.path
.join(repository
,'content3.in'))[stat
.ST_MTIME
]
62 test
.write(['Repository','content3.in'], "content3.in 2\n")
63 test
.touch(['Repository','content3.in'], time_content
)
65 # We should only see content1.out rebuilt. The timestamp of content2.in
66 # has changed, but its content hasn't, so the follow-on content check says
67 # to not rebuild it. The content of content3.in has changed, but that's
68 # masked by the fact that its timestamp is the same as the last run.
70 expect
= test
.wrap_stdout("""\
71 Copy("content1.out", "%s")
72 """ % os
.path
.join(repository
, 'content1.in'))
74 test
.run(chdir
='work', arguments
='.', stdout
=expect
)
75 test
.up_to_date(chdir
='work', arguments
='.')
81 # indent-tabs-mode:nil
83 # vim: set expandtab tabstop=4 shiftwidth=4: