aboutsummaryrefslogtreecommitdiff
path: root/bestflags/generation_test.py
diff options
context:
space:
mode:
authorYuheng Long <yuhenglong@google.com>2013-07-22 13:51:17 -0700
committerChromeBot <chrome-bot@google.com>2013-07-25 17:25:37 -0700
commita5712a2c71aa665dcca808963d152228890c8364 (patch)
tree176ebb146015c9275bae9f5f66ecc761a42dacd2 /bestflags/generation_test.py
parentfefa5c0174b32eb359eca91acebab772356a4473 (diff)
downloadtoolchain-utils-a5712a2c71aa665dcca808963d152228890c8364.tar.gz
Add the steering stage of the framework.
BUG=None TEST=unit testings for the pipeline stage, pipeline workers, generation and steering. Change-Id: Id92bcf04ee24dfbc918f59ac8d87d30ee69e47b3 Reviewed-on: https://gerrit-int.chromium.org/41454 Reviewed-by: Simon Que <sque@google.com> Reviewed-by: Luis Lozano <llozano@chromium.org> Commit-Queue: Yuheng Long <yuhenglong@google.com> Tested-by: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags/generation_test.py')
-rw-r--r--bestflags/generation_test.py24
1 files changed, 3 insertions, 21 deletions
diff --git a/bestflags/generation_test.py b/bestflags/generation_test.py
index 748a9886..1249f7dd 100644
--- a/bestflags/generation_test.py
+++ b/bestflags/generation_test.py
@@ -13,7 +13,7 @@ import random
import unittest
from generation import Generation
-from mock_task import MockTask
+from mock_task import IdentifierMockTask
# Pick an integer at random.
@@ -27,24 +27,6 @@ NUMTASKS = 20
STRIDE = 7
-class GenerationMockTask(MockTask):
- """This class defines the mock task to test the Generation class.
-
- The task instances will be inserted into a set. Therefore the hash and the
- equal methods are overridden. The generation class considers the identifier to
- set the cost of the task in a set, thus the identifier is used in the
- overriding methods.
- """
-
- def __hash__(self):
- return self._identifier
-
- def __eq__(self, other):
- if isinstance(other, MockTask):
- return self._identifier == other.GetIdentifier(self._stage)
- return False
-
-
class GenerationTest(unittest.TestCase):
"""This class test the Generation class.
@@ -66,7 +48,7 @@ class GenerationTest(unittest.TestCase):
testing_tasks = range(NUMTASKS)
# The tasks for the generation to be tested.
- generation_tasks = [GenerationMockTask(TESTSTAGE, t) for t in testing_tasks]
+ generation_tasks = [IdentifierMockTask(TESTSTAGE, t) for t in testing_tasks]
gen = Generation(set(generation_tasks), None)
@@ -81,7 +63,7 @@ class GenerationTest(unittest.TestCase):
# Mark a task as done by calling the UpdateTask method of the generation.
# Send the generation the task as well as its results.
- gen.UpdateTask(GenerationMockTask(TESTSTAGE, testing_task))
+ gen.UpdateTask(IdentifierMockTask(TESTSTAGE, testing_task))
# The Done method should return true after all the tasks in the permuted
# list is set.