summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-09-21 11:39:19 (GMT)
committerSteven Knight <knight@baldmt.com>2001-09-21 11:39:19 (GMT)
commitf407037c97df685b54882142784d2f353aaac6b6 (patch)
tree3841c4d5ace0dbfd17e48f6f8c85c9a2f3a720d7 /test
parent635256859678b6b862b89d4c5ce890b4923e8394 (diff)
downloadSCons-f407037c97df685b54882142784d2f353aaac6b6.zip
SCons-f407037c97df685b54882142784d2f353aaac6b6.tar.gz
SCons-f407037c97df685b54882142784d2f353aaac6b6.tar.bz2
rebuild in response to changed .c file
Diffstat (limited to 'test')
-rw-r--r--test/Program.py10
-rw-r--r--test/option-j.py19
2 files changed, 24 insertions, 5 deletions
diff --git a/test/Program.py b/test/Program.py
index d517808..4189c46 100644
--- a/test/Program.py
+++ b/test/Program.py
@@ -3,6 +3,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
+import os.path
+import time
#XXX Future: be able to interpolate
@@ -121,4 +123,12 @@ test.run(program = test.workpath('foo2'), stdout = "f2a.c\nf2b.c\nf2c.c\n")
#XXXtest.up_to_date(arguments = '.')
+# make sure the programs don't get rebuilt, because nothing changed:
+oldtime1 = os.path.getmtime(test.workpath('foo1'))
+oldtime2 = os.path.getmtime(test.workpath('foo2'))
+time.sleep(1) # introduce a small delay, to make the test valid
+test.run(arguments = 'foo1 foo2')
+test.fail_test(not (oldtime1 == os.path.getmtime(test.workpath('foo1'))))
+test.fail_test(not (oldtime2 == os.path.getmtime(test.workpath('foo2'))))
+
test.pass_test()
diff --git a/test/option-j.py b/test/option-j.py
index 90d036d..cc8efa4 100644
--- a/test/option-j.py
+++ b/test/option-j.py
@@ -36,9 +36,10 @@ env.MyBuild(target = 'f1', source = 'f1.in')
env.MyBuild(target = 'f2', source = 'f2.in')
""")
-def RunTest(args):
- test.write('f1.in', 'f1.in')
- test.write('f2.in', 'f2.in')
+def RunTest(args, extra):
+ """extra is used to make scons rebuild the output file"""
+ test.write('f1.in', 'f1.in'+extra)
+ test.write('f2.in', 'f2.in'+extra)
test.run(arguments = args)
@@ -50,13 +51,21 @@ def RunTest(args):
return start2, finish1
-start2, finish1 = RunTest('-j 2 f1 f2')
+start2, finish1 = RunTest('-j 2 f1 f2', "first")
# fail if the second file was not started
# before the first one was finished
test.fail_test(not (start2 < finish1))
-start2, finish1 = RunTest('f1 f2')
+s2, f1 = RunTest('-j 2 f1 f2', "first")
+
+# re-run the test with the same input, fail if we don't
+# get back the same times, which would indicate that
+# SCons rebuilt the files even though nothing changed
+test.fail_test(start2 != s2)
+test.fail_test(finish1 != f1)
+
+start2, finish1 = RunTest('f1 f2', "second")
# fail if the second file was started
# before the first one was finished