aboutsummaryrefslogtreecommitdiff
path: root/bestflags/testing_batch.py
diff options
context:
space:
mode:
authorYuheng Long <yuhenglong@google.com>2013-08-13 20:47:45 -0700
committerChromeBot <chrome-bot@google.com>2013-08-15 15:51:21 -0700
commite896dfd76014af3c399d1b54be022fb1663a105b (patch)
tree0ea99c0728d61be7b95d666343a46b2da1938167 /bestflags/testing_batch.py
parent4f10d39a499ad872c22402aa763037fc3351f399 (diff)
downloadtoolchain-utils-e896dfd76014af3c399d1b54be022fb1663a105b.tar.gz
Refining the documentations.
BUG=None TEST=unit testings for the pipeline stage, pipeline workers, generation, steering, task, flag, hill climbing and genetic algorithm. Change-Id: I45c83c9dc74e54b75492ceb281e6912eb347d75e Reviewed-on: https://gerrit-int.chromium.org/42802 Reviewed-by: Simon Que <sque@google.com> Reviewed-by: Luis Lozano <llozano@chromium.org> Tested-by: Yuheng Long <yuhenglong@google.com> Commit-Queue: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags/testing_batch.py')
-rw-r--r--bestflags/testing_batch.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/bestflags/testing_batch.py b/bestflags/testing_batch.py
index ad1ab4b7..f44c4f66 100644
--- a/bestflags/testing_batch.py
+++ b/bestflags/testing_batch.py
@@ -55,11 +55,11 @@ def _GenerateRandomRasks(specs):
flag_set = []
for spec in specs:
- result = flags.Search(spec)
- if result:
+ numeric_flag_match = flags.Search(spec)
+ if numeric_flag_match:
# Numeric flags.
- start = int(result.group('start'))
- end = int(result.group('end'))
+ start = int(numeric_flag_match.group('start'))
+ end = int(numeric_flag_match.group('end'))
value = random.randint(start - 1, end - 1)
if value != start - 1:
@@ -89,8 +89,12 @@ def _GenerateAllFlagsTasks(specs):
flag_set = []
for spec in specs:
- result = flags.Search(spec)
- value = (int(result.group('end')) - 1) if result else -1
+ numeric_flag_match = flags.Search(spec)
+
+ if numeric_flag_match:
+ value = (int(numeric_flag_match.group('end')) - 1)
+ else:
+ value = -1
flag_set.append(Flag(spec, value))
return set([Task(FlagSet(flag_set))])