aboutsummaryrefslogtreecommitdiff
path: root/bestflags
diff options
context:
space:
mode:
authorYuheng Long <yuhenglong@google.com>2013-08-06 15:30:38 -0700
committerChromeBot <chrome-bot@google.com>2013-08-07 15:24:58 -0700
commitc1fb0f1051208907df137371f3d100132f19cf10 (patch)
treee10f826b6fa029d962456237bb5c173f930cef85 /bestflags
parentf1f606e1c5b559aa264518a89595afd787f12e8a (diff)
downloadtoolchain-utils-c1fb0f1051208907df137371f3d100132f19cf10.tar.gz
Add underscore to separate words in variables.
BUG=None TEST=unit testings for the pipeline stage, pipeline workers, generation, steering, task, flag and hill climbing. Change-Id: I0efdf5e7ad85b42f37519b6e0cebea8352bbf563 Reviewed-on: https://gerrit-int.chromium.org/42430 Reviewed-by: Simon Que <sque@google.com> Tested-by: Yuheng Long <yuhenglong@google.com> Commit-Queue: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags')
-rw-r--r--bestflags/generation_test.py16
-rw-r--r--bestflags/pipeline_process_test.py17
2 files changed, 17 insertions, 16 deletions
diff --git a/bestflags/generation_test.py b/bestflags/generation_test.py
index 1249f7dd..cdb4b7ab 100644
--- a/bestflags/generation_test.py
+++ b/bestflags/generation_test.py
@@ -17,13 +17,13 @@ from mock_task import IdentifierMockTask
# Pick an integer at random.
-TESTSTAGE = -125
+TEST_STAGE = -125
# The number of tasks to be put in a generation to be tested.
-NUMTASKS = 20
+NUM_TASKS = 20
# The stride of permutation used to shuffle the input list of tasks. Should be
-# relatively prime with NUMTASKS.
+# relatively prime with NUM_TASKS.
STRIDE = 7
@@ -45,15 +45,15 @@ class GenerationTest(unittest.TestCase):
random.seed(0)
- testing_tasks = range(NUMTASKS)
+ testing_tasks = range(NUM_TASKS)
# The tasks for the generation to be tested.
- generation_tasks = [IdentifierMockTask(TESTSTAGE, t) for t in testing_tasks]
+ tasks = [IdentifierMockTask(TEST_STAGE, t) for t in testing_tasks]
- gen = Generation(set(generation_tasks), None)
+ gen = Generation(set(tasks), None)
# Permute the list.
- permutation = [(t * STRIDE) % NUMTASKS for t in range(NUMTASKS)]
+ permutation = [(t * STRIDE) % NUM_TASKS for t in range(NUM_TASKS)]
permuted_tasks = [testing_tasks[index] for index in permutation]
# The Done method of the Generation should return false before all the tasks
@@ -63,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(IdentifierMockTask(TESTSTAGE, testing_task))
+ gen.UpdateTask(IdentifierMockTask(TEST_STAGE, testing_task))
# The Done method should return true after all the tasks in the permuted
# list is set.
diff --git a/bestflags/pipeline_process_test.py b/bestflags/pipeline_process_test.py
index 08b4e87d..989fd742 100644
--- a/bestflags/pipeline_process_test.py
+++ b/bestflags/pipeline_process_test.py
@@ -18,7 +18,7 @@ import pipeline_process
# Pick an integer at random.
ERROR = -334
# Pick an integer at random.
-TESTSTAGE = -8
+TEST_STAGE = -8
def MockHelper(done_dict, helper_queue, _, result_queue):
@@ -34,11 +34,11 @@ def MockHelper(done_dict, helper_queue, _, result_queue):
# verify that it does not get duplicate "1"s in the test.
result_queue.put(ERROR)
else:
- result_queue.put(('helper', task.GetIdentifier(TESTSTAGE)))
+ result_queue.put(('helper', task.GetIdentifier(TEST_STAGE)))
def MockWorker(task, _, result_queue):
- result_queue.put(('worker', task.GetIdentifier(TESTSTAGE)))
+ result_queue.put(('worker', task.GetIdentifier(TEST_STAGE)))
class PipelineProcessTest(unittest.TestCase):
@@ -59,13 +59,14 @@ class PipelineProcessTest(unittest.TestCase):
inp = manager.Queue()
output = manager.Queue()
- process = pipeline_process.PipelineProcess(2, 'testing', {}, TESTSTAGE, inp,
- MockHelper, MockWorker, output)
+ process = pipeline_process.PipelineProcess(2, 'testing', {}, TEST_STAGE,
+ inp, MockHelper, MockWorker,
+ output)
process.start()
- inp.put(MockTask(TESTSTAGE, 1))
- inp.put(MockTask(TESTSTAGE, 1))
- inp.put(MockTask(TESTSTAGE, 2))
+ inp.put(MockTask(TEST_STAGE, 1))
+ inp.put(MockTask(TEST_STAGE, 1))
+ inp.put(MockTask(TEST_STAGE, 2))
inp.put(pipeline_process.POISONPILL)
process.join()