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 Verify that targets retrieved from CacheDir() are reported as
29 up-to-date by the -q option.
31 Thanks to dvitek for the test case.
34 # Demonstrate a regression between 0.96.1 and 0.96.93.
36 # SCons would incorrectly believe files are stale if they were retrieved
37 # from the cache in a previous invocation.
39 # What this script does:
40 # 1. Set up two identical C project directories called 'alpha' and
41 # 'beta', which use the same cache
42 # 2. Invoke scons on 'alpha'
43 # 3. Invoke scons on 'beta', which successfully draws output
44 # files from the cache
45 # 4. Invoke scons again, asserting (with -q) that 'beta' is up to date
47 # Step 4 failed in 0.96.93. In practice, this problem would lead to
48 # lots of unecessary fetches from the cache during incremental
49 # builds (because they behaved like non-incremental builds).
53 test = TestSCons.TestSCons()
55 test.subdir('cache', 'alpha', 'beta')
58 int main(){ return 0; }
64 Program('foo', 'foo.c')
65 """ % test.workpath('cache')
67 test.write('alpha/foo.c', foo_c)
68 test.write('alpha/SConstruct', sconstruct)
70 test.write('beta/foo.c', foo_c)
71 test.write('beta/SConstruct', sconstruct)
73 # First build, populates the cache
74 test.run(chdir = 'alpha', arguments = '.')
76 # Second build, everything is a cache hit
77 test.run(chdir = 'beta', arguments = '.')
79 # Since we just built 'beta', it ought to be up to date.
80 test.run(chdir = 'beta', arguments = '. -q')