Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: client/common_lib/control_data.py

Issue 6124004: Revert "Merge remote branch 'cros/upstream' into autotest-rebase" (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/common_lib/base_utils_unittest.py ('k') | client/common_lib/logging_manager.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # Copyright 2008 Google Inc. Released under the GPL v2 2 # Copyright 2008 Google Inc. Released under the GPL v2
3 3
4 import compiler, textwrap, types 4 import compiler, textwrap, types
5 5
6 6
7 REQUIRED_VARS = set(['author', 'doc', 'name', 'time', 'test_class', 7 REQUIRED_VARS = set(['author', 'doc', 'name', 'time', 'test_class',
8 'test_category', 'test_type']) 8 'test_category', 'test_type'])
9 9
10 class ControlVariableException(Exception): 10 class ControlVariableException(Exception):
11 pass 11 pass
12 12
13 13
14 class ControlData(object): 14 class ControlData(object):
15 def __init__(self, vars, path, raise_warnings=False): 15 def __init__(self, vars, path, raise_warnings=False):
16 # Defaults 16 # Defaults
17 self.path = path 17 self.path = path
18 self.dependencies = set() 18 self.dependencies = set()
19 self.experimental = False 19 self.experimental = False
20 self.run_verify = True 20 self.run_verify = True
21 self.sync_count = 1 21 self.sync_count = 1
22 self.test_parameters = set()
23 22
24 diff = REQUIRED_VARS - set(vars) 23 diff = REQUIRED_VARS - set(vars)
25 if len(diff) > 0: 24 if len(diff) > 0:
26 warning = ("WARNING: Not all required control " 25 warning = ("WARNING: Not all required control "
27 "variables were specified in %s. Please define " 26 "variables were specified in %s. Please define "
28 "%s.") % (self.path, ', '.join(diff)) 27 "%s.") % (self.path, ', '.join(diff))
29 if raise_warnings: 28 if raise_warnings:
30 raise ControlVariableException(warning) 29 raise ControlVariableException(warning)
31 print textwrap.wrap(warning, 80) 30 print textwrap.wrap(warning, 80)
32 31
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 self._set_string('test_class', val.lower()) 127 self._set_string('test_class', val.lower())
129 128
130 129
131 def set_test_category(self, val): 130 def set_test_category(self, val):
132 self._set_string('test_category', val.lower()) 131 self._set_string('test_category', val.lower())
133 132
134 133
135 def set_test_type(self, val): 134 def set_test_type(self, val):
136 self._set_option('test_type', val, ['client', 'server']) 135 self._set_option('test_type', val, ['client', 'server'])
137 136
138
139 def set_test_parameters(self, val): 137 def set_test_parameters(self, val):
140 self._set_set('test_parameters', val) 138 self._set_set('test_parameters', val)
141 139
142 140
143 def _extract_const(n): 141 def _extract_const(n):
144 assert(n.__class__ == compiler.ast.Assign) 142 assert(n.__class__ == compiler.ast.Assign)
145 assert(n.expr.__class__ == compiler.ast.Const) 143 assert(n.expr.__class__ == compiler.ast.Const)
146 assert(n.expr.value.__class__ in (str, int, float, unicode)) 144 assert(n.expr.value.__class__ in (str, int, float, unicode))
147 assert(n.nodes.__class__ == list) 145 assert(n.nodes.__class__ == list)
148 assert(len(n.nodes) == 1) 146 assert(len(n.nodes) == 1)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 for n in mod.node.nodes: 185 for n in mod.node.nodes:
188 for fn in (_extract_const, _extract_name): 186 for fn in (_extract_const, _extract_name):
189 try: 187 try:
190 key, val = fn(n) 188 key, val = fn(n)
191 189
192 vars[key] = val 190 vars[key] = val
193 except AssertionError, e: 191 except AssertionError, e:
194 pass 192 pass
195 193
196 return ControlData(vars, path, raise_warnings) 194 return ControlData(vars, path, raise_warnings)
OLDNEW
« no previous file with comments | « client/common_lib/base_utils_unittest.py ('k') | client/common_lib/logging_manager.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698