本文整理汇总了Python中webkitpy.layout_tests.controllers.test_result_writer.TestResultWriter类的典型用法代码示例。如果您正苦于以下问题:Python TestResultWriter类的具体用法?Python TestResultWriter怎么用?Python TestResultWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestResultWriter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _look_for_new_crash_logs
def _look_for_new_crash_logs(self, result_summary, start_time):
"""Since crash logs can take a long time to be written out if the system is
under stress do a second pass at the end of the test run.
result_summary: the results of the test run
start_time: time the tests started at. We're looking for crash
logs after that time.
"""
crashed_processes = []
for test, result in result_summary.unexpected_results.iteritems():
if (result.type != test_expectations.CRASH):
continue
for failure in result.failures:
if not isinstance(failure, test_failures.FailureCrash):
continue
crashed_processes.append(
[test, failure.process_name, failure.pid])
crash_logs = self._port.look_for_new_crash_logs(
crashed_processes, start_time)
if crash_logs:
for test, crash_log in crash_logs.iteritems():
writer = TestResultWriter(self._port._filesystem, self._port,
self._port.results_directory(), test)
writer.write_crash_log(crash_log)
示例2: run_single
def run_single(self, driver, url, time_out_ms, record=False):
server = self._start_replay_server(self._archive_path, record)
if not server:
_log.error("Web page replay didn't start.")
return None
try:
_log.debug("Waiting for Web page replay to start.")
if not server.wait_until_ready():
_log.error("Web page replay didn't start.")
return None
_log.debug("Web page replay started. Loading the page.")
output = super(ReplayPerfTest, self).run_single(driver, self._url, time_out_ms, should_run_pixel_test=True)
if self.run_failed(output):
return None
if not output.image:
_log.error("Loading the page did not generate image results")
_log.error(output.text)
return None
filesystem = self._port.host.filesystem
dirname = filesystem.dirname(self._archive_path)
filename = filesystem.split(self._archive_path)[1]
writer = TestResultWriter(filesystem, self._port, dirname, filename)
if record:
writer.write_image_files(actual_image=None, expected_image=output.image)
else:
writer.write_image_files(actual_image=output.image, expected_image=None)
return output
finally:
server.stop()
示例3: _look_for_new_crash_logs
def _look_for_new_crash_logs(self, run_results, start_time):
"""Looks for and writes new crash logs, at the end of the test run.
Since crash logs can take a long time to be written out if the system is
under stress, do a second pass at the end of the test run.
Args:
run_results: The results of the test run.
start_time: Time the tests started at. We're looking for crash
logs after that time.
"""
crashed_processes = []
for test, result in run_results.unexpected_results_by_name.iteritems():
if result.type != test_expectations.CRASH:
continue
for failure in result.failures:
if not isinstance(failure, test_failures.FailureCrash):
continue
if failure.has_log:
continue
crashed_processes.append([test, failure.process_name, failure.pid])
sample_files = self._port.look_for_new_samples(crashed_processes, start_time)
if sample_files:
for test, sample_file in sample_files.iteritems():
writer = TestResultWriter(self._filesystem, self._port, self._port.results_directory(), test)
writer.copy_sample_file(sample_file)
crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time)
if crash_logs:
for test, crash_log in crash_logs.iteritems():
writer = TestResultWriter(self._filesystem, self._port, self._port.results_directory(), test)
writer.write_crash_log(crash_log)
示例4: _look_for_new_crash_logs
def _look_for_new_crash_logs(self, run_results, start_time):
"""Since crash logs can take a long time to be written out if the system is
under stress do a second pass at the end of the test run.
run_results: the results of the test run
start_time: time the tests started at. We're looking for crash
logs after that time.
"""
crashed_processes = []
for test, result in run_results.unexpected_results_by_name.iteritems():
if (result.type != test_expectations.CRASH):
continue
for failure in result.failures:
if not isinstance(failure, test_failures.FailureCrash):
continue
crashed_processes.append([test, failure.process_name, failure.pid])
sample_files = self._port.look_for_new_samples(crashed_processes, start_time)
if sample_files:
for test, sample_file in sample_files.iteritems():
writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test)
writer.copy_sample_file(sample_file)
crash_logs = self._port.look_for_new_crash_logs(crashed_processes, start_time)
if crash_logs:
for test, crash_log in crash_logs.iteritems():
writer = TestResultWriter(self._port._filesystem, self._port, self._port.results_directory(), test)
writer.write_crash_log(crash_log)
# Check if this crashing 'test' is already in list of crashed_processes, if not add it to the run_results
if not any(process[0] == test for process in crashed_processes):
result = test_results.TestResult(test)
result.type = test_expectations.CRASH
result.is_other_crash = True
run_results.add(result, expected=False, test_is_slow=False)
_log.debug("Adding results for other crash: " + str(test))