Lines Matching refs:self
77 def __init__(self, suite, path, name, test_config):
78 self.suite = suite # TestSuite object
80 self.path = path # string, e.g. 'div-mod', 'test-api/foo'
81 self.name = name # string that identifies test in the status file
83 self.variant = None # name of the used testing variant
84 self.variant_flags = [] # list of strings, flags specific to this test
87 self.origin = None # Test that this test is subtest of.
88 self.processor = None # Processor that created this subtest.
89 self.procid = '%s/%s' % (self.suite.name, self.name) # unique id
90 self.keep_output = False # Can output of this test be dropped
93 self._test_config = test_config
94 self._random_seed = None # Overrides test config value if not None
97 self._statusfile_outcomes = None
98 self._expected_outcomes = None
99 self._checked_flag_contradictions = False
100 self._statusfile_flags = None
101 self.expected_failure_reason = None
103 self._prepare_outcomes()
105 def create_subtest(self, processor, subtest_id, variant=None, flags=None,
107 subtest = copy.copy(self)
108 subtest.origin = self
117 assert self.variant is None
122 def _prepare_outcomes(self, force_update=True):
123 if force_update or self._statusfile_outcomes is None:
129 outcomes = self.suite.statusfile.get_outcomes(self.name, self.variant)
130 self._statusfile_outcomes = list(filter(not_flag, outcomes))
131 self._statusfile_flags = list(filter(is_flag, outcomes))
132 self._expected_outcomes = (
133 self._parse_status_file_outcomes(self._statusfile_outcomes))
135 def _parse_status_file_outcomes(self, outcomes):
137 '--use-strict' not in self.variant_flags):
157 def allow_timeouts(self):
158 if self.expected_outcomes == outproc.OUTCOMES_PASS:
159 self._expected_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT
160 elif self.expected_outcomes == outproc.OUTCOMES_FAIL:
161 self._expected_outcomes = outproc.OUTCOMES_FAIL_OR_TIMEOUT
162 elif statusfile.TIMEOUT not in self.expected_outcomes:
163 self._expected_outcomes = (
164 self.expected_outcomes + [statusfile.TIMEOUT])
166 def allow_pass(self):
167 if self.expected_outcomes == outproc.OUTCOMES_TIMEOUT:
168 self._expected_outcomes = outproc.OUTCOMES_PASS_OR_TIMEOUT
169 elif self.expected_outcomes == outproc.OUTCOMES_FAIL:
170 self._expected_outcomes = outproc.OUTCOMES_FAIL_OR_PASS
171 elif statusfile.PASS not in self.expected_outcomes:
172 self._expected_outcomes = (
173 self.expected_outcomes + [statusfile.PASS])
176 def expected_outcomes(self):
212 self._statusfile_outcomes = outproc.OUTCOMES_FAIL
213 self._expected_outcomes = outproc.OUTCOMES_FAIL
214 self.expected_failure_reason = ("Rule " + rule + " in " +
218 if not self._checked_flag_contradictions:
219 self._checked_flag_contradictions = True
221 file_specific_flags = (self._get_source_flags() + self._get_suite_flags()
222 + self._get_statusfile_flags())
224 extra_flags = normalize_flags(self._get_extra_flags())
228 if self.variant in ALL_VARIANT_FLAGS:
229 for flags in ALL_VARIANT_FLAGS[self.variant]:
236 if self.variant in INCOMPATIBLE_FLAGS_PER_VARIANT:
237 check_flags(INCOMPATIBLE_FLAGS_PER_VARIANT[self.variant], file_specific_flags,
238 "INCOMPATIBLE_FLAGS_PER_VARIANT[\""+self.variant+"\"]")
243 if self.suite.statusfile.variables[variable]:
252 return self._expected_outcomes
255 def do_skip(self):
256 return (statusfile.SKIP in self._statusfile_outcomes and
257 not self.suite.test_config.run_skipped)
260 def is_heavy(self):
261 return statusfile.HEAVY in self._statusfile_outcomes
264 def is_slow(self):
265 return self.is_heavy or statusfile.SLOW in self._statusfile_outcomes
268 def is_fail_ok(self):
269 return statusfile.FAIL_OK in self._statusfile_outcomes
272 def is_pass_or_fail(self):
273 return (statusfile.PASS in self._statusfile_outcomes and
274 statusfile.FAIL in self._statusfile_outcomes and
275 statusfile.CRASH not in self._statusfile_outcomes)
278 def is_fail(self):
279 return (statusfile.FAIL in self._statusfile_outcomes and
280 statusfile.PASS not in self._statusfile_outcomes)
283 def only_standard_variant(self):
284 return statusfile.NO_VARIANTS in self._statusfile_outcomes
286 def get_command(self):
287 params = self._get_cmd_params()
288 env = self._get_cmd_env()
289 shell = self.get_shell()
292 shell_flags = self._get_shell_flags()
293 timeout = self._get_timeout(params)
294 return self._create_cmd(shell, shell_flags + params, env, timeout)
296 def _get_cmd_params(self):
311 self._get_files_params() +
312 self._get_random_seed_flags() +
313 self._get_mode_flags() +
314 self._get_extra_flags() +
315 self._get_variant_flags() +
316 self._get_source_flags() +
317 self._get_suite_flags() +
318 self._get_statusfile_flags()
321 def _get_cmd_env(self):
324 def _get_files_params(self):
327 def _get_timeout_param(self):
330 def _get_random_seed_flags(self):
331 return ['--random-seed=%d' % self.random_seed]
334 def random_seed(self):
335 return self._random_seed or self._test_config.random_seed
337 def _get_extra_flags(self):
338 return self._test_config.extra_flags
340 def _get_variant_flags(self):
341 return self.variant_flags
343 def _get_statusfile_flags(self):
348 return self._statusfile_flags
350 def _get_mode_flags(self):
351 return self._test_config.mode_flags
353 def _get_source_flags(self):
356 def _get_suite_flags(self):
359 def _get_shell_flags(self):
362 def _get_timeout(self, params):
363 timeout = self._test_config.timeout
372 if self._get_timeout_param() == TIMEOUT_LONG:
374 if self.is_slow:
378 def get_shell(self):
381 def _get_suffix(self):
384 def _create_cmd(self, shell, params, env, timeout):
386 cmd_prefix=self._test_config.command_prefix,
387 shell=os.path.abspath(os.path.join(self._test_config.shell_dir, shell)),
391 verbose=self._test_config.verbose,
392 resources_func=self._get_resources,
396 def _parse_source_flags(self, source=None):
397 source = source or self.get_source()
403 def is_source_available(self):
404 return self._get_source_path() is not None
406 def get_source(self):
407 return read_file(self._get_source_path())
409 def _get_source_path(self):
412 def _get_resources(self):
420 def skip_predictable(self):
425 def output_proc(self):
426 if self.expected_outcomes is outproc.OUTCOMES_PASS:
428 return outproc.OutProc(self.expected_outcomes)
430 def __cmp__(self, other):
436 (self.suite.name, self.name, self.variant),
440 def __str__(self):
441 return self.suite.name + '/' + self.name
445 def get_shell(self):
448 def _get_shell_flags(self):
451 def _get_resources_for_file(self, file):
481 def _get_resources(self):
483 if not self._get_source_path():
486 to_check = [self._get_source_path()]
491 for resource in self._get_resources_for_file(next_resource):
498 def skip_predictable(self):
500 return (statusfile.FAIL in self.expected_outcomes or
501 self.output_proc.negative)