diff options
author | Steven Knight <knight@baldmt.com> | 2005-11-06 23:00:32 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-11-06 23:00:32 (GMT) |
commit | 6e913271bb52eb06a4221f008325ecbb5fde450a (patch) | |
tree | c9a710f51a09c3eb79f627e78c279e828c0bc713 /test | |
parent | 6100e6fec11023b5ee239b097d240b1cbd32a739 (diff) | |
download | SCons-6e913271bb52eb06a4221f008325ecbb5fde450a.zip SCons-6e913271bb52eb06a4221f008325ecbb5fde450a.tar.gz SCons-6e913271bb52eb06a4221f008325ecbb5fde450a.tar.bz2 |
Do not throw an exception if the type of a stored implicit dependency has changed since last run. (Dobes Vandermeer)
Diffstat (limited to 'test')
-rw-r--r-- | test/changed-node.py | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/test/changed-node.py b/test/changed-node.py new file mode 100644 index 0000000..99a16ac --- /dev/null +++ b/test/changed-node.py @@ -0,0 +1,142 @@ +#!/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__" + +""" +Verify that we don't throw an exception if a stored implicit +dependency has changed +""" + +import TestSCons + +test = TestSCons.TestSCons() + + + +test.subdir('d', + ['d', '1'], + ['d', '2'], + ['d', '3']) + +test.write('SConstruct', """\ +SetOption('implicit_cache', 1) +SetOption('max_drift', 1) +SourceCode('.', None) + +def lister(target, source, env): + import os + fp = open(str(target[0]), 'w') + s = str(source[0]) + if os.path.isdir(s): + for l in os.listdir(str(source[0])): + fp.write(l + '\\n') + else: + fp.write(s + '\\n') + fp.close() + +builder = Builder(action=lister, + source_factory=Dir, + source_scanner=DirScanner) +env = Environment(tools=[]) +env['BUILDERS']['builder'] = builder +env.builder('d/xfactor', 'd/1') +env.builder('a', 'd') +""") + +test.write(['d', '1', 'x'], "d/1/x\n") +test.write(['d', '1', 'y'], "d/1/y\n") +test.write(['d', '1', 'z'], "d/1/z\n") +test.write(['d', '2', 'x'], "d/2/x\n") +test.write(['d', '2', 'y'], "d/2/y\n") +test.write(['d', '2', 'z'], "d/2/x\n") +test.write(['d', '3', 'x'], "d/3/x\n") +test.write(['d', '3', 'y'], "d/3/y\n") +test.write(['d', '3', 'z'], "d/3/z\n") + +test.run('--debug=stacktrace') + + + +test.write('SConstruct', """\ +SetOption('implicit_cache', 1) +SetOption('max_drift', 1) +SourceCode('.', None) + +def lister(target, source, env): + import os.path + fp = open(str(target[0]), 'w') + s = str(source[0]) + if os.path.isdir(s): + for l in os.listdir(str(source[0])): + fp.write(l + '\\n') + else: + fp.write(s + '\\n') + fp.close() + +builder = Builder(action=lister, + source_factory=File) +env = Environment(tools=[]) +env['BUILDERS']['builder'] = builder + +env.builder('a', 'SConstruct') +""") + +test.run('--debug=stacktrace') + +test.pass_test() + + + + +#from os import system, rmdir, remove, mkdir, listdir +#from os.path import exists, isdir +#import sys +# +# +#def setfile(f, content): +# f = open(f, 'w') +# try: f.write(content) +# finally: f.close() +# +#def checkfile(f, content): +# assert open(f).read().strip() == content +# +#def rm(f): +# if exists(f): +# if isdir(f): +# for name in listdir(f): +# rm(f+'/'+name) +# rmdir(f) +# else: remove(f) +#def clean(full=0): +# for f in ('d','b','a','SConstruct'): +# rm(f) +# if full: +# for f in ('.sconsign.dblite', 'build.py'): +# rm(f) +# +#clean(1) +# +#clean(1) |