summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-01 19:21:11 (GMT)
committerSteven Knight <knight@baldmt.com>2004-05-01 19:21:11 (GMT)
commit813976940844198600a08144299f85a792480211 (patch)
treee8eb13d3c86c19da758a1384c01d198d45a2488b /test
parent0f502e03db08b7c2920c8affb7d6b1f9dcf492ef (diff)
downloadSCons-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.py114
-rw-r--r--test/scan-once.py2
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',