diff options
author | Ludwig Hähne <pankrat@tigris.org> | 2008-09-08 20:23:30 (GMT) |
---|---|---|
committer | Ludwig Hähne <pankrat@tigris.org> | 2008-09-08 20:23:30 (GMT) |
commit | 81e7f4fc4b7244507df996a5944743bb391781a8 (patch) | |
tree | df69a77b65c8cc4f4204d5f1870d2e35087cd78a /test/ExecuteInvalidateCache.py | |
parent | 043febbaa29e21174ebf96ffe21cd91aca6cae95 (diff) | |
download | SCons-81e7f4fc4b7244507df996a5944743bb391781a8.zip SCons-81e7f4fc4b7244507df996a5944743bb391781a8.tar.gz SCons-81e7f4fc4b7244507df996a5944743bb391781a8.tar.bz2 |
Issue 1307: Invalidate node caches after Execute()
Diffstat (limited to 'test/ExecuteInvalidateCache.py')
-rw-r--r-- | test/ExecuteInvalidateCache.py | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/test/ExecuteInvalidateCache.py b/test/ExecuteInvalidateCache.py new file mode 100644 index 0000000..aad12e4 --- /dev/null +++ b/test/ExecuteInvalidateCache.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +""" +Test the Execute() functions clears the memoized values of affected target Nodes +when used with Delete(). Derived from Tigris issue 1307. +""" + +import TestSCons +import os.path + +test = TestSCons.TestSCons() + +subfn = os.path.join('sub', 'foo') + +test.write('SConstruct', """\ +def exists(node): + if node.exists(): + print str(node), "exists" + else: + print str(node), "does not exist" + +Execute(Delete('abc')) +n1 = File('abc') +exists( n1 ) +Execute(Touch('abc')) +exists( n1 ) +Execute(Delete('abc')) +exists( n1 ) + +env = Environment() +env.Execute(Delete('def')) +n2 = env.File('def') +exists( n2 ) +env.Execute(Touch('def')) +exists( n2 ) +env.Execute(Delete(n2)) +exists( n2 ) + +Execute(Touch('abc')) +exists( n1 ) +Execute(Move('def', 'abc')) +exists( n1 ) +exists( n2 ) + +Execute(Copy('abc', 'def')) +exists( n1 ) + +n3 = File("%(subfn)s") +exists( n3 ) +Execute(Mkdir('sub')) +Execute(Touch("%(subfn)s")) +exists( n3 ) +""" % locals()) + + +expect = test.wrap_stdout(read_str="""\ +Delete("abc") +abc does not exist +Touch("abc") +abc exists +Delete("abc") +abc does not exist +Delete("def") +def does not exist +Touch("def") +def exists +Delete("def") +def does not exist +Touch("abc") +abc exists +Move("def", "abc") +abc does not exist +def exists +Copy("abc", "def") +abc exists +%(subfn)s does not exist +Mkdir("sub") +Touch("%(subfn)s") +%(subfn)s exists +""" % locals(), build_str = "scons: `.' is up to date.\n") + +test.run(arguments = '.', stdout = expect) + +test.pass_test() |