summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/TaskmasterTests.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/TaskmasterTests.py')
-rw-r--r--src/engine/SCons/TaskmasterTests.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py
index 62d3d6a..dc23159 100644
--- a/src/engine/SCons/TaskmasterTests.py
+++ b/src/engine/SCons/TaskmasterTests.py
@@ -171,7 +171,7 @@ class TaskmasterTestCase(unittest.TestCase):
"""Test fetching the next task
"""
global built_text
-
+
n1 = Node("n1")
tm = SCons.Taskmaster.Taskmaster([n1, n1])
t = tm.next_task()
@@ -1031,6 +1031,37 @@ class TaskmasterTestCase(unittest.TestCase):
assert n2.postprocessed
assert n3.postprocessed
+ def test_trace(self):
+ """Test Taskmaster tracing
+ """
+ import StringIO
+
+ trace = StringIO.StringIO()
+ n1 = Node("n1")
+ n2 = Node("n2")
+ n3 = Node("n3", [n1, n2])
+ tm = SCons.Taskmaster.Taskmaster([n1, n1, n3], trace=trace)
+ t = tm.next_task()
+ t.prepare()
+ t.execute()
+ n1.set_state(SCons.Node.executed)
+ t = tm.next_task()
+ t.prepare()
+ t.execute()
+ t = tm.next_task()
+
+ value = trace.getvalue()
+ expect = """\
+Taskmaster: 'n1': building
+Taskmaster: 'n1': already handled
+Taskmaster: 'n3': waiting on unstarted children:
+ ['n2']
+Taskmaster: 'n2': building
+Taskmaster: 'n3': waiting on unfinished children:
+ ['n2']
+"""
+ assert value == expect, value
+
if __name__ == "__main__":