diff options
author | Steven Knight <knight@baldmt.com> | 2005-01-22 19:33:27 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2005-01-22 19:33:27 (GMT) |
commit | f7158d025b936cc3cf3f0579ef39df98dc74e8cb (patch) | |
tree | 215b20a3cd51bde9b2163aa213992b29e7a5a02b /src/engine/SCons/ExecutorTests.py | |
parent | 7a59fd0e789fb1c924d9feca02e4b83a93924844 (diff) | |
download | SCons-f7158d025b936cc3cf3f0579ef39df98dc74e8cb.zip SCons-f7158d025b936cc3cf3f0579ef39df98dc74e8cb.tar.gz SCons-f7158d025b936cc3cf3f0579ef39df98dc74e8cb.tar.bz2 |
Reduce the number of scanner calls in large cross-products of targets and sources.
Diffstat (limited to 'src/engine/SCons/ExecutorTests.py')
-rw-r--r-- | src/engine/SCons/ExecutorTests.py | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py index b503a74..555d485 100644 --- a/src/engine/SCons/ExecutorTests.py +++ b/src/engine/SCons/ExecutorTests.py @@ -63,6 +63,7 @@ class MyBuilder: class MyNode: def __init__(self, name=None, pre=[], post=[]): self.name = name + self.implicit = [] self.pre_actions = pre self.post_actions = post def __str__(self): @@ -76,13 +77,16 @@ class MyNode: [self], ['s1', 's2']) apply(executor, (self, errfunc), {}) + def get_implicit_deps(self, env, scanner, path): + return ['dep-' + str(self)] + def add_to_implicit(self, deps): + self.implicit.extend(deps) class MyScanner: - def path(self, env, dir, target, source): - target = map(str, target) - source = map(str, source) - return "scanner: %s, %s, %s, %s" % (env['SCANNERVAL'], dir, target, source) - + def path(self, env, cwd, target, source): + return () + def select(self, node): + return self class ExecutorTestCase(unittest.TestCase): @@ -143,7 +147,12 @@ class ExecutorTestCase(unittest.TestCase): [t], ['s1', 's2']) - s = MyScanner() + class LocalScanner: + def path(self, env, dir, target, source): + target = map(str, target) + source = map(str, source) + return "scanner: %s, %s, %s, %s" % (env['SCANNERVAL'], dir, target, source) + s = LocalScanner() p = x.get_build_scanner_path(s) assert p == "scanner: sss, here, ['t'], ['s1', 's2']", p @@ -276,6 +285,16 @@ class ExecutorTestCase(unittest.TestCase): ts = x.get_timestamp() assert ts == 0, ts + def test_scan(self): + """Test scanning the sources for implicit dependencies""" + env = MyEnvironment(S='string', SCANNERVAL='scn') + targets = [MyNode('t')] + sources = [MyNode('s1'), MyNode('s2')] + x = SCons.Executor.Executor('b', env, [{}], targets, sources) + scanner = MyScanner() + deps = x.scan(scanner) + assert targets[0].implicit == ['dep-s1', 'dep-s2'], targets[0].implicit + if __name__ == "__main__": suite = unittest.TestSuite() |