diff options
author | Steven Knight <knight@baldmt.com> | 2004-05-01 19:21:11 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-05-01 19:21:11 (GMT) |
commit | 813976940844198600a08144299f85a792480211 (patch) | |
tree | e8eb13d3c86c19da758a1384c01d198d45a2488b /test | |
parent | 0f502e03db08b7c2920c8affb7d6b1f9dcf492ef (diff) | |
download | SCons-813976940844198600a08144299f85a792480211.zip SCons-813976940844198600a08144299f85a792480211.tar.gz SCons-813976940844198600a08144299f85a792480211.tar.bz2 |
Fix use of timestamps with --implicit-cache. (Anthony Roach)
Diffstat (limited to 'test')
-rw-r--r-- | test/SourceSignatures.py | 114 | ||||
-rw-r--r-- | test/scan-once.py | 2 |
2 files changed, 115 insertions, 1 deletions
diff --git a/test/SourceSignatures.py b/test/SourceSignatures.py index e982fbe..10dfb29 100644 --- a/test/SourceSignatures.py +++ b/test/SourceSignatures.py @@ -27,6 +27,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import imp import os import os.path +import time import TestSCons @@ -172,4 +173,117 @@ scons: `f8.out' is up to date. test.up_to_date(arguments = 'f5.out f6.out f7.out f8.out') +# Ensure that switching signature types causes a rebuild: +test.write('SConstruct', """ +SourceSignatures('MD5') + +def build(env, target, source): + open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'switch.out', source = 'switch.in') +""") + +test.write('switch.in', "switch.in\n") + +test.run(arguments = 'switch.out', + stdout = test.wrap_stdout("""\ +build("switch.out", "switch.in") +""")) + +test.up_to_date(arguments = 'switch.out') + +test.write('SConstruct', """ +SourceSignatures('timestamp') + +def build(env, target, source): + open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'switch.out', source = 'switch.in') +""") + +test.run(arguments = 'switch.out', + stdout = test.wrap_stdout("""\ +build("switch.out", "switch.in") +""")) + +test.up_to_date(arguments = 'switch.out') + +test.write('SConstruct', """ +SourceSignatures('MD5') + +def build(env, target, source): + open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'switch.out', source = 'switch.in') +""") + +test.run(arguments = 'switch.out', + stdout = test.wrap_stdout("""\ +build("switch.out", "switch.in") +""")) + +test.up_to_date(arguments = 'switch.out') + +test.write('switch.in', "switch.in 2\n") + +test.run(arguments = 'switch.out', + stdout = test.wrap_stdout("""\ +build("switch.out", "switch.in") +""")) + + +# Test both implicit_cache and timestamp signatures at the same time: +test.write('SConstruct', """ +SetOption('implicit_cache', 1) +SourceSignatures('timestamp') + +def build(env, target, source): + open(str(target[0]), 'wt').write(open(str(source[0]), 'rt').read()) +B = Builder(action = build) +env = Environment(BUILDERS = { 'B' : B }) +env.B(target = 'both.out', source = 'both.in') +""") + +test.write('both.in', "both.in 1\n") + +test.run(arguments = 'both.out', + stdout = test.wrap_stdout("""\ +build("both.out", "both.in") +""")) + +time.sleep(2) + +test.write('both.in', "both.in 2\n") + +test.run(arguments = 'both.out', + stdout = test.wrap_stdout("""\ +build("both.out", "both.in") +""")) + +time.sleep(2) + +test.write('both.in', "both.in 3\n") + +test.run(arguments = 'both.out', + stdout = test.wrap_stdout("""\ +build("both.out", "both.in") +""")) + +time.sleep(2) + +test.write('both.in', "both.in 4\n") + +test.run(arguments = 'both.out', + stdout = test.wrap_stdout("""\ +build("both.out", "both.in") +""")) + +time.sleep(2) + + +test.up_to_date(arguments = 'both.out') + test.pass_test() diff --git a/test/scan-once.py b/test/scan-once.py index cfc4a25..52b4505 100644 --- a/test/scan-once.py +++ b/test/scan-once.py @@ -62,7 +62,7 @@ def scan(node, env, envkey, arg): print 'XScanner: node =', os.path.split(str(node))[1] return [] -def exists_check(node): +def exists_check(node, env): return os.path.exists(str(node)) XScanner = Scanner(name = 'XScanner', |