diff options
author | Steven Knight <knight@baldmt.com> | 2003-05-15 17:50:29 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-05-15 17:50:29 (GMT) |
commit | ed374e833a6880b96d52df7bbe39c915bde22dae (patch) | |
tree | 61811ab80c03f5d347d8b0794604777cffea1574 /test/SideEffect.py | |
parent | a87fd3919a6f6cab61e9da1c71b2737943259273 (diff) | |
download | SCons-ed374e833a6880b96d52df7bbe39c915bde22dae.zip SCons-ed374e833a6880b96d52df7bbe39c915bde22dae.tar.gz SCons-ed374e833a6880b96d52df7bbe39c915bde22dae.tar.bz2 |
Fix SideEffect() and BuildDir(). (Anthony Roach)
Diffstat (limited to 'test/SideEffect.py')
-rw-r--r-- | test/SideEffect.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/SideEffect.py b/test/SideEffect.py index cf83b6e..f0eeee8 100644 --- a/test/SideEffect.py +++ b/test/SideEffect.py @@ -150,4 +150,40 @@ test.run(arguments='log') test.fail_test(not os.path.exists(test.workpath('log/bar.out'))) test.fail_test(not os.path.exists(test.workpath('log/blat.out'))) +test.write('SConstruct', +""" +def copy(source, target): + open(target, "wb").write(open(source, "rb").read()) + +def build(env, source, target): + copy(str(source[0]), str(target[0])) + if target[0].side_effects: + side_effect = open(str(target[0].side_effects[0]), "ab") + side_effect.write('%s -> %s\\n'%(str(source[0]), str(target[0]))) + +Build = Builder(action=build) +env = Environment(BUILDERS={'Build':Build}) +Export('env') +SConscript('SConscript', build_dir='build', duplicate=0)""") + +test.write('SConscript', """ +Import('env') +env.Build('foo.out', 'foo.in') +env.Build('bar.out', 'bar.in') +env.Build('blat.out', 'blat.in') +env.SideEffect('log.txt', ['foo.out', 'bar.out', 'blat.out']) +""") + +test.write('foo.in', 'foo.in\n') +test.write('bar.in', 'bar.in\n') + +test.run(arguments = 'build/foo.out build/bar.out') + +expect = """\ +foo.in -> build/foo.out +bar.in -> build/bar.out +""" + +assert test.read('build/log.txt') == expect + test.pass_test() |