diff options
| author | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2006-07-25 02:30:45 (GMT) |
| commit | dd9bbc79353ae90b2402c16b1613dad4e502d250 (patch) | |
| tree | 42f857f72bb4dcab6d876d1f9c73e0a1dd70d8c2 /src/engine/SCons/TaskmasterTests.py | |
| parent | 57fcbbc5d24fb16f988e4fe3294d5d49abef8e2a (diff) | |
| download | SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.zip SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.gz SCons-dd9bbc79353ae90b2402c16b1613dad4e502d250.tar.bz2 | |
Merged revisions 1441-1539 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1441 | stevenknight | 2006-04-22 23:06:53 -0400 (Sat, 22 Apr 2006) | 1 line
0.96.D397 - The scons command, branch 0.96.91.
........
r1442 | stevenknight | 2006-04-27 00:45:12 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D398 - The scons command, branch 0.96.92.
........
r1443 | stevenknight | 2006-04-27 00:49:25 -0400 (Thu, 27 Apr 2006) | 1 line
0.96.D399 - Taskmaster clean-ups in anticipation of refactoring speedups.
........
r1450 | stevenknight | 2006-05-02 00:04:55 -0400 (Tue, 02 May 2006) | 1 line
0.96.D400 - Fix VC+++ 2005 Express detection. (Atul Varma) Fix parsing Intel C compiler Li
........
r1451 | stevenknight | 2006-05-02 01:14:24 -0400 (Tue, 02 May 2006) | 1 line
0.96.D401 - Enhance ParseConfig() to understand -arch and -isysroot options. (Gary Oberbrun
........
r1458 | stevenknight | 2006-05-02 23:21:04 -0400 (Tue, 02 May 2006) | 1 line
0.96.D402 - Make strfunction handling consistent. (David Gruener)
........
r1459 | stevenknight | 2006-05-02 23:37:08 -0400 (Tue, 02 May 2006) | 1 line
0.96.D403 - Comment out the test of CVS checkout from the old tigris.org repository.
........
r1460 | stevenknight | 2006-05-03 23:47:54 -0400 (Wed, 03 May 2006) | 1 line
0.96.D404 - Preserve white space in display Action string. (David Gruener)
........
r1461 | stevenknight | 2006-05-04 09:16:15 -0400 (Thu, 04 May 2006) | 1 line
0.96.D405 - Add MergeFlags() and AddFlags() methods. (Greg Noel) Support recognizing compi
........
r1462 | stevenknight | 2006-05-04 23:46:53 -0400 (Thu, 04 May 2006) | 1 line
0.96.D406 - Fix stack trace when ParseFlags has a null string.
........
r1464 | stevenknight | 2006-05-05 17:21:27 -0400 (Fri, 05 May 2006) | 1 line
0.96.D408 - Fix the string displayed by InstallAs() when called through the default construc
........
r1465 | stevenknight | 2006-05-05 18:30:28 -0400 (Fri, 05 May 2006) | 1 line
0.96.D409 - Fix test/ParseConfig.py, broken in the previous checkin by ParseFlags() changes.
........
r1466 | stevenknight | 2006-05-05 20:42:35 -0400 (Fri, 05 May 2006) | 1 line
0.96.D407 - Avoid recursive calls to main() in SConf test programs. (Karol Pietrzak)
........
r1467 | stevenknight | 2006-05-06 00:27:21 -0400 (Sat, 06 May 2006) | 1 line
0.96.D410 - Catch errors from commands that ParseConfig() calls. (John Pye)
........
r1468 | stevenknight | 2006-05-06 10:55:38 -0400 (Sat, 06 May 2006) | 1 line
0.96.D411 - Significant taskmaster speedup by using reference counts, not list manipulation.
........
r1469 | stevenknight | 2006-05-06 18:38:02 -0400 (Sat, 06 May 2006) | 1 line
0.96.D413 - TeX improvements.
........
r1471 | stevenknight | 2006-05-07 09:07:58 -0400 (Sun, 07 May 2006) | 2 lines
Delete properties interfering with clean .jpg checkout.
........
r1472 | stevenknight | 2006-05-07 09:23:54 -0400 (Sun, 07 May 2006) | 1 line
0.96.D412 - Windows portability fixes for two tests and ParseConfig() execution.
........
r1473 | stevenknight | 2006-05-07 09:30:11 -0400 (Sun, 07 May 2006) | 1 line
0.96.D414 - Various man page and documentation updates.
........
r1474 | stevenknight | 2006-05-07 23:53:12 -0400 (Sun, 07 May 2006) | 1 line
0.96.D415 - Initial infrastructure for executing tests under QMTest. (Stefan Seefeld)
........
r1476 | stevenknight | 2006-05-09 00:03:47 -0400 (Tue, 09 May 2006) | 1 line
0.96.D416 - Fix QMTest infrastructure to avoid listing directories with no tests and to find
........
r1477 | stevenknight | 2006-05-16 06:47:51 -0400 (Tue, 16 May 2006) | 1 line
0.96.D417 - Fix Alias turning Entries into Nodes or Dirs too soon.
........
r1478 | stevenknight | 2006-05-17 08:32:58 -0400 (Wed, 17 May 2006) | 1 line
0.96.D418 - Next QMTest changes (including fixing copyrights).
........
r1479 | stevenknight | 2006-05-18 05:07:06 -0400 (Thu, 18 May 2006) | 1 line
0.96.D419 - Fix DVIPDF tests after recent changes.
........
r1497 | stevenknight | 2006-05-23 08:47:01 -0400 (Tue, 23 May 2006) | 1 line
0.96.D420 - Better error message when trying to build a file from an unknown sufix. (Gary O
........
r1498 | stevenknight | 2006-05-23 09:38:52 -0400 (Tue, 23 May 2006) | 1 line
0.96.D421 - Suppress duplicate entries in latest TeX patch. (Joel B. Mohler)
........
r1499 | stevenknight | 2006-05-23 22:00:06 -0400 (Tue, 23 May 2006) | 1 line
0.96.D422 - Add tests for tuple variable expansion. (Gary Oberbrunner)
........
r1515 | stevenknight | 2006-06-12 06:44:24 -0400 (Mon, 12 Jun 2006) | 1 line
0.96.D423 - More QMTest work: start giving runtest.py its own tests, more functionality for
........
r1517 | stevenknight | 2006-06-21 07:34:30 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D424 - Move test/Configure.py and test/Options.py to avoid confusion with similarly-nam
........
r1518 | stevenknight | 2006-06-21 12:40:37 -0400 (Wed, 21 Jun 2006) | 1 line
0.96.D425 - Change the QMTest infrastructure to use File naming, not Python. Rename tests w
........
r1533 | stevenknight | 2006-07-23 20:10:08 -0400 (Sun, 23 Jul 2006) | 1 line
0.96.D426 - Fix ramifications of changing when Node disambiguation happens.
........
r1535 | stevenknight | 2006-07-24 06:40:43 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1534" from
http://scons.tigris.org/svn/scons/trunk
........
r1536 | stevenknight | 2006-07-24 21:45:40 -0400 (Mon, 24 Jul 2006) | 2 lines
Remove svnmerge-integrated property to start over.
........
r1538 | stevenknight | 2006-07-24 21:51:32 -0400 (Mon, 24 Jul 2006) | 3 lines
Initialized merge tracking via "svnmerge" with revisions "1-1440" from
http://scons.tigris.org/svn/scons/trunk
........
Diffstat (limited to 'src/engine/SCons/TaskmasterTests.py')
| -rw-r--r-- | src/engine/SCons/TaskmasterTests.py | 145 |
1 files changed, 58 insertions, 87 deletions
diff --git a/src/engine/SCons/TaskmasterTests.py b/src/engine/SCons/TaskmasterTests.py index 7e24d2b..8d71d71 100644 --- a/src/engine/SCons/TaskmasterTests.py +++ b/src/engine/SCons/TaskmasterTests.py @@ -54,7 +54,8 @@ class Node: self.csig = None self.state = SCons.Node.no_state self.prepared = None - self.waiting_parents = [] + self.waiting_parents = {} + self.waiting_s_e = {} self.side_effect = 0 self.side_effects = [] self.alttargets = [] @@ -109,13 +110,13 @@ class Node: def scanner_key(self): return self.name - + def add_to_waiting_parents(self, node): - self.waiting_parents.append(node) - + self.waiting_parents[node] = 1 + def call_for_all_waiting_parents(self, func): func(self) - for parent in self.waiting_parents: + for parent in self.waiting_parents.keys(): parent.call_for_all_waiting_parents(func) def get_state(self): @@ -186,7 +187,7 @@ class TaskmasterTestCase(unittest.TestCase): n1 = Node("n1") n2 = Node("n2") n3 = Node("n3", [n1, n2]) - + tm = SCons.Taskmaster.Taskmaster([n3]) t = tm.next_task() @@ -194,18 +195,21 @@ class TaskmasterTestCase(unittest.TestCase): t.execute() assert built_text == "n1 built", built_text t.executed() + t.postprocess() t = tm.next_task() t.prepare() t.execute() assert built_text == "n2 built", built_text t.executed() + t.postprocess() t = tm.next_task() t.prepare() t.execute() assert built_text == "n3 built", built_text t.executed() + t.postprocess() assert tm.next_task() == None @@ -236,18 +240,21 @@ class TaskmasterTestCase(unittest.TestCase): t.execute() assert built_text == "n1 up-to-date", built_text t.executed() + t.postprocess() t = tm.next_task() t.prepare() t.execute() assert built_text == "n2 up-to-date", built_text t.executed() + t.postprocess() t = tm.next_task() t.prepare() t.execute() assert built_text == "n3 up-to-date top", built_text t.executed() + t.postprocess() assert tm.next_task() == None @@ -259,41 +266,34 @@ class TaskmasterTestCase(unittest.TestCase): n5 = Node("n5", [n3, n4]) tm = SCons.Taskmaster.Taskmaster([n5]) - assert not tm.is_blocked() - t1 = tm.next_task() assert t1.get_target() == n1 - assert not tm.is_blocked() - + t2 = tm.next_task() assert t2.get_target() == n2 - assert not tm.is_blocked() t4 = tm.next_task() assert t4.get_target() == n4 - assert tm.is_blocked() t4.executed() - assert tm.is_blocked() - + t4.postprocess() + t1.executed() - assert tm.is_blocked() + t1.postprocess() t2.executed() - assert not tm.is_blocked() + t2.postprocess() t3 = tm.next_task() assert t3.get_target() == n3 - assert tm.is_blocked() t3.executed() - assert not tm.is_blocked() + t3.postprocess() t5 = tm.next_task() assert t5.get_target() == n5, t5.get_target() - assert tm.is_blocked() # still executing t5 t5.executed() - assert not tm.is_blocked() + t5.postprocess() assert tm.next_task() == None - + n4 = Node("n4") n4.set_state(SCons.Node.executed) tm = SCons.Taskmaster.Taskmaster([n4]) @@ -303,9 +303,8 @@ class TaskmasterTestCase(unittest.TestCase): n2 = Node("n2", [n1]) tm = SCons.Taskmaster.Taskmaster([n2,n2]) t = tm.next_task() - assert tm.is_blocked() t.executed() - assert not tm.is_blocked() + t.postprocess() t = tm.next_task() assert tm.next_task() == None @@ -318,14 +317,17 @@ class TaskmasterTestCase(unittest.TestCase): target = t.get_target() assert target == n1, target t.executed() + t.postprocess() t = tm.next_task() target = t.get_target() assert target == n2, target t.executed() + t.postprocess() t = tm.next_task() target = t.get_target() assert target == n3, target t.executed() + t.postprocess() assert tm.next_task() == None n1 = Node("n1") @@ -339,15 +341,19 @@ class TaskmasterTestCase(unittest.TestCase): t = tm.next_task() assert t.get_target() == n1 t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n2 t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n3 t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n4 t.executed() + t.postprocess() assert tm.next_task() == None assert scan_called == 4, scan_called @@ -368,28 +374,26 @@ class TaskmasterTestCase(unittest.TestCase): tm = SCons.Taskmaster.Taskmaster([n1,n2,n3,n4,n5]) t = tm.next_task() assert t.get_target() == n1 - assert n4.state == SCons.Node.executing - assert tm.is_blocked() + assert n4.state == SCons.Node.pending, n4.state t.executed() - assert not tm.is_blocked() + t.postprocess() t = tm.next_task() assert t.get_target() == n2 - assert tm.is_blocked() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n3 - assert tm.is_blocked() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n4 - assert tm.is_blocked() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n5 - assert tm.is_blocked() # still executing n5 assert not tm.next_task() t.executed() - assert not tm.is_blocked() + t.postprocess() n1 = Node("n1") n2 = Node("n2") @@ -402,31 +406,40 @@ class TaskmasterTestCase(unittest.TestCase): t = tm.next_task() assert t.get_target() == n3, t.get_target() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n2, t.get_target() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n1, t.get_target() t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n4, t.get_target() t.executed() + t.postprocess() n5 = Node("n5") n6 = Node("n6") n7 = Node("n7") n6.alttargets = [n7] + tm = SCons.Taskmaster.Taskmaster([n5]) t = tm.next_task() assert t.get_target() == n5 t.executed() + t.postprocess() + tm = SCons.Taskmaster.Taskmaster([n6]) t = tm.next_task() assert t.get_target() == n7 t.executed() + t.postprocess() t = tm.next_task() assert t.get_target() == n6 t.executed() + t.postprocess() n1 = Node("n1") n2 = Node("n2", [n1]) @@ -441,6 +454,7 @@ class TaskmasterTestCase(unittest.TestCase): tm = SCons.Taskmaster.Taskmaster([n1]) t = tm.next_task() t.executed() + t.postprocess() s = n1.get_state() assert s == SCons.Node.up_to_date, s @@ -590,56 +604,19 @@ class TaskmasterTestCase(unittest.TestCase): def test_cycle_detection(self): """Test detecting dependency cycles - """ n1 = Node("n1") n2 = Node("n2", [n1]) n3 = Node("n3", [n2]) n1.kids = [n3] + tm = SCons.Taskmaster.Taskmaster([n3]) try: - tm = SCons.Taskmaster.Taskmaster([n3]) t = tm.next_task() except SCons.Errors.UserError, e: assert str(e) == "Dependency cycle: n3 -> n1 -> n2 -> n3", str(e) else: - assert 0 - - def test_is_blocked(self): - """Test whether a task is blocked - - Both default and overridden in a subclass. - """ - tm = SCons.Taskmaster.Taskmaster() - assert not tm.is_blocked() - - class MyTM(SCons.Taskmaster.Taskmaster): - def _find_next_ready_node(self): - self.ready = 1 - tm = MyTM() - assert not tm.is_blocked() - - class MyTM(SCons.Taskmaster.Taskmaster): - def _find_next_ready_node(self): - self.ready = None - self.pending = [] - self.executing = [] - tm = MyTM() - assert not tm.is_blocked() - - class MyTM(SCons.Taskmaster.Taskmaster): - def _find_next_ready_node(self): - self.ready = None - self.pending = [1] - tm = MyTM() - assert tm.is_blocked() - - class MyTM(SCons.Taskmaster.Taskmaster): - def _find_next_ready_node(self): - self.ready = None - self.executing = [1] - tm = MyTM() - assert tm.is_blocked() + assert 'Did not catch expected UserError' def test_next_top_level_candidate(self): """Test the next_top_level_candidate() method @@ -650,9 +627,9 @@ class TaskmasterTestCase(unittest.TestCase): tm = SCons.Taskmaster.Taskmaster([n3]) t = tm.next_task() - assert tm.executing == [n1], tm.executing + assert t.targets == [n1], t.targets t.fail_stop() - assert t.targets == [n3], t.targets + assert t.targets == [n3], map(str, t.targets) assert t.top == 1, t.top def test_stop(self): @@ -665,13 +642,14 @@ class TaskmasterTestCase(unittest.TestCase): n1 = Node("n1") n2 = Node("n2") n3 = Node("n3", [n1, n2]) - + tm = SCons.Taskmaster.Taskmaster([n3]) t = tm.next_task() t.prepare() t.execute() assert built_text == "n1 built", built_text t.executed() + t.postprocess() assert built_text == "n1 built really", built_text tm.stop() @@ -702,9 +680,9 @@ class TaskmasterTestCase(unittest.TestCase): n1 = Node("n1") tm = SCons.Taskmaster.Taskmaster([n1]) t = tm.next_task() - assert tm.executing == [n1], tm.executing + assert t.targets == [n1], map(str, t.targets) tm.failed(n1) - assert tm.executing == [], tm.executing + assert t.targets == [n1], map(str, t.targets) def test_executed(self): """Test when a task has been executed @@ -759,7 +737,6 @@ class TaskmasterTestCase(unittest.TestCase): def test_prepare(self): """Test preparation of multiple Nodes for a task - """ n1 = Node("n1") n2 = Node("n2") @@ -818,7 +795,7 @@ class TaskmasterTestCase(unittest.TestCase): n6.side_effects = [ n8 ] n7.side_effects = [ n9, n10 ] - + tm = SCons.Taskmaster.Taskmaster([n6, n7]) t = tm.next_task() # More bogus reaching in and setting the targets. @@ -832,7 +809,6 @@ class TaskmasterTestCase(unittest.TestCase): def test_execute(self): """Test executing a task - """ global built_text global cache_text @@ -994,7 +970,7 @@ class TaskmasterTestCase(unittest.TestCase): t.exception_set(("exception 4", "XYZZY")) def fw_exc(exc): raise 'exception_forwarded', exc - tm.exception_raise = fw_exc + tm.exception_raise = fw_exc try: t.exception_raise() except: @@ -1007,7 +983,6 @@ class TaskmasterTestCase(unittest.TestCase): def test_postprocess(self): """Test postprocessing targets to give them a chance to clean up - """ n1 = Node("n1") tm = SCons.Taskmaster.Taskmaster([n1]) @@ -1053,17 +1028,13 @@ class TaskmasterTestCase(unittest.TestCase): value = trace.getvalue() expect = """\ -Taskmaster: 'n1': children: - [] - evaluating -Taskmaster: 'n1': already handled +Taskmaster: 'n1': evaluating n1 +Taskmaster: 'n1': already handled (executed) Taskmaster: 'n3': children: ['n1', 'n2'] waiting on unstarted children: ['n2'] -Taskmaster: 'n2': children: - [] - evaluating +Taskmaster: 'n2': evaluating n2 Taskmaster: 'n3': children: ['n1', 'n2'] waiting on unfinished children: |
