MCPcopy Index your code
hub / github.com/nodejs/node / ReadStatusFile

Function ReadStatusFile

deps/v8/tools/testrunner/local/statusfile.py:240–297  ·  view source on GitHub ↗

Status file format Status file := [section] section = [CONDITION, section_rules] section_rules := {path: outcomes} outcomes := outcome | [outcome, ...] outcome := SINGLE_OUTCOME | [CONDITION, SINGLE_OUTCOME, SINGLE_OUTCOME, ...]

(content, variables)

Source from the content-addressed store, hash-verified

238
239
240def ReadStatusFile(content, variables):
241 """Status file format
242 Status file := [section]
243 section = [CONDITION, section_rules]
244 section_rules := {path: outcomes}
245 outcomes := outcome | [outcome, ...]
246 outcome := SINGLE_OUTCOME | [CONDITION, SINGLE_OUTCOME, SINGLE_OUTCOME, ...]
247 """
248
249 # Empty defaults for rules and prefix_rules. Variant-independent
250 # rules are mapped by "", others by the variant name.
251 rules = {variant: {} for variant in ALL_VARIANTS}
252 rules[""] = {}
253 prefix_rules = {variant: {} for variant in ALL_VARIANTS}
254 prefix_rules[""] = {}
255
256 # This method can be called with the same `variables` object multiple times.
257 # Ensure we only update `variables` (and check it for consistency) once.
258 if ALWAYS not in variables:
259 # Ensure we don't silently overwrite any build variables with our set of
260 # default keywords in VARIABLES.
261 for var in VARIABLES:
262 assert var not in variables, (
263 "build_config variable '%s' conflicts with VARIABLES" % var)
264 variables.update(VARIABLES)
265
266 for conditional_section in ReadContent(content):
267 assert type(conditional_section) == list
268 assert len(conditional_section) == 2
269 condition, section = conditional_section
270 exp = _EvalExpression(condition, variables)
271
272 # The expression is variant-independent and evaluates to False.
273 if exp is False:
274 continue
275
276 # The expression is variant-independent and evaluates to True.
277 if exp is True:
278 _ReadSection(
279 section,
280 variables,
281 rules[''],
282 prefix_rules[''],
283 )
284 continue
285
286 # The expression is variant-dependent (contains "variant" keyword)
287 if exp == VARIANT_EXPRESSION:
288 # If the expression contains one or more "variant" keywords, we evaluate
289 # it for all possible variants and create rules for those that apply.
290 for variant in ALL_VARIANTS:
291 _EvalVariantExpression(
292 condition, section, variables, variant, rules, prefix_rules)
293 continue
294
295 assert False, "Make sure expressions evaluate to boolean values"
296
297 return Freeze(rules), Freeze(prefix_rules)

Callers 1

__init__Method · 0.85

Calls 7

FreezeFunction · 0.90
ReadContentFunction · 0.85
_EvalExpressionFunction · 0.85
_ReadSectionFunction · 0.85
_EvalVariantExpressionFunction · 0.85
updateMethod · 0.65
typeFunction · 0.50

Tested by

no test coverage detected