summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-05-01 19:21:11 +0000
committerSteven Knight <knight@baldmt.com>2004-05-01 19:21:11 +0000
commit7cb6652c567c78a667b8759f293d0c6c75360a50 (patch)
treee8eb13d3c86c19da758a1384c01d198d45a2488b /test
parent28ad1a68eea6bb49178a9837a95bcba973ed015d (diff)
downloadscons-7cb6652c567c78a667b8759f293d0c6c75360a50.tar.gz
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 e982fbe8..10dfb29c 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 cfc4a25c..52b45050 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',