summaryrefslogtreecommitdiff
path: root/test/Value.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-07-21 13:44:04 +0000
committerSteven Knight <knight@baldmt.com>2003-07-21 13:44:04 +0000
commit78c4fae66e565b081bfadd947c2fc9466c57ec03 (patch)
tree271ebb383c81ef5f176d4e76bcae840feb1c432f /test/Value.py
parentd77bd9aa09a469f734d52951f09ec8b649d33482 (diff)
downloadscons-78c4fae66e565b081bfadd947c2fc9466c57ec03.tar.gz
Give Value Nodes timestamps. (Chad Austin)
Diffstat (limited to 'test/Value.py')
-rw-r--r--test/Value.py120
1 files changed, 70 insertions, 50 deletions
diff --git a/test/Value.py b/test/Value.py
index f3df6fea..11fb72a3 100644
--- a/test/Value.py
+++ b/test/Value.py
@@ -33,7 +33,13 @@ import TestCmd
test = TestSCons.TestSCons(match=TestCmd.match_re)
-test.write('SConstruct', """
+for source_signature in ['MD5', 'timestamp']:
+
+ print "Testing Value node with source signatures:", source_signature
+
+ test.write('SConstruct', """
+SourceSignatures(r'%s')
+
class Custom:
def __init__(self, value): self.value = value
def __str__(self): return "C=" + str(self.value)
@@ -50,54 +56,68 @@ env['BUILDERS']['B'] = Builder(action = create)
env.B('f1.out', Value(P))
env.B('f2.out', Value(L))
env.B('f3.out', Value(C))
-""")
-
-
-test.run()
-out1 = """create("f1.out", "'/usr/local'")"""
-out2 = """create("f2.out", "10")"""
-out3 = """create\\("f3.out", "<.*.Custom instance at """
-test.fail_test(string.find(test.stdout(), out1) == -1)
-test.fail_test(string.find(test.stdout(), out2) == -1)
-test.fail_test(re.search(out3, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr/local')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '10')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr/local')
-
-test.up_to_date(arguments = ".")
-
-test.run(arguments = 'prefix=/usr')
-out4 = """create("f1.out", "'/usr'")"""
-out5 = """create("f2.out", "4")"""
-out6 = """create\\("f3.out", "<.*.Custom instance at """
-test.fail_test(string.find(test.stdout(), out4) == -1)
-test.fail_test(string.find(test.stdout(), out5) == -1)
-test.fail_test(re.search(out6, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr')
-
-test.unlink('f3.out')
-
-test.run(arguments = 'prefix=/var')
-out4 = """create("f1.out", "'/var'")"""
-test.fail_test(string.find(test.stdout(), out4) == -1)
-test.fail_test(string.find(test.stdout(), out5) != -1)
-test.fail_test(re.search(out6, test.stdout()) == None)
-
-test.fail_test(not os.path.exists(test.workpath('f1.out')))
-test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/var')
-test.fail_test(not os.path.exists(test.workpath('f2.out')))
-test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
-test.fail_test(not os.path.exists(test.workpath('f3.out')))
-test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/var')
+""" % source_signature)
+
+ test.run(arguments='-c')
+ test.run()
+
+ out1 = """create("f1.out", "'/usr/local'")"""
+ out2 = """create("f2.out", "10")"""
+ out3 = """create\\("f3.out", "<.*.Custom instance at """
+ #" <- unconfuses emacs syntax highlighting
+ test.fail_test(string.find(test.stdout(), out1) == -1)
+ test.fail_test(string.find(test.stdout(), out2) == -1)
+ test.fail_test(re.search(out3, test.stdout()) == None)
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr/local')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '10')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr/local')
+
+ if source_signature == 'MD5':
+ test.up_to_date(arguments='.')
+
+ test.run(arguments='prefix=/usr')
+ out4 = """create("f1.out", "'/usr'")"""
+ out5 = """create("f2.out", "4")"""
+ out6 = """create\\("f3.out", "<.*.Custom instance at """
+ #" <- unconfuses emacs syntax highlighting
+ test.fail_test(string.find(test.stdout(), out4) == -1)
+ test.fail_test(string.find(test.stdout(), out5) == -1)
+ test.fail_test(re.search(out6, test.stdout()) == None)
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr')
+
+ if source_signature == 'MD5':
+ test.up_to_date('prefix=/usr', '.')
+
+ test.unlink('f3.out')
+
+ test.run(arguments='prefix=/var')
+ out4 = """create("f1.out", "'/var'")"""
+
+ test.fail_test(string.find(test.stdout(), out4) == -1)
+ if source_signature == 'MD5':
+ test.fail_test(string.find(test.stdout(), out5) != -1)
+ else:
+ test.fail_test(string.find(test.stdout(), out5) == -1)
+ test.fail_test(re.search(out6, test.stdout()) == None)
+
+ if source_signature == 'MD5':
+ test.up_to_date('prefix=/var', '.')
+
+ test.fail_test(not os.path.exists(test.workpath('f1.out')))
+ test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/var')
+ test.fail_test(not os.path.exists(test.workpath('f2.out')))
+ test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4')
+ test.fail_test(not os.path.exists(test.workpath('f3.out')))
+ test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/var')
test.pass_test()