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 that the NoCache environment method works.
32 test
= TestSCons
.TestSCons()
34 test
.subdir('alpha', 'beta')
37 DefaultEnvironment(tools=[])
42 # This is bad form, but the easiest way to produce a test case.
43 # Obviously, this could be cached if the inputs were passed in a
47 def ActionWithUndeclaredInputs(target,source,env):
48 with open(target[0].get_abspath(),'w') as f:
51 Command('foo_cached', [], ActionWithUndeclaredInputs)
52 NoCache(Command('foo_notcached', [], ActionWithUndeclaredInputs))
53 Command('bar_cached', [], ActionWithUndeclaredInputs)
54 Command('bar_notcached', [], ActionWithUndeclaredInputs)
55 NoCache('bar_notcached')
57 # Make sure NoCache doesn't vomit when applied to a Dir
58 NoCache(Command(Dir('aoeu'), [], Mkdir('$TARGET')))
61 test
.write('alpha/SConstruct', sconstruct
% (test
.workpath('cache'), 'alpha'))
63 test
.write('beta/SConstruct', sconstruct
% (test
.workpath('cache'), 'beta'))
65 # First build, would populate the cache without NoCache
66 test
.run(chdir
= 'alpha', arguments
= '.')
68 # Second build, without NoCache there would be a cache hit
69 test
.run(chdir
= 'beta', arguments
= '.')
71 test
.must_match(['beta','foo_cached'], 'alpha')
72 test
.must_match(['beta','foo_notcached'], 'beta')
73 test
.must_match(['beta','bar_cached'], 'alpha')
74 test
.must_match(['beta','bar_notcached'], 'beta')
80 # indent-tabs-mode:nil
82 # vim: set expandtab tabstop=4 shiftwidth=4: